Class Ellipsoid

java.lang.Object
com.irurueta.geometry.Ellipsoid
All Implemented Interfaces:
Serializable

public class Ellipsoid extends Object implements Serializable
This class defines an ellipsoid.
See Also:
  • Field Details

    • DIMENSIONS

      public static final int DIMENSIONS
      Number of dimensions.
      See Also:
    • P

      private static final double P
      Constant to compute approximate surface area.
      See Also:
    • center

      private Point3D center
      Center of ellipse.
    • semiAxesLengths

      private double[] semiAxesLengths
      Lengths of all three semi-axes.
    • rotation

      private Rotation3D rotation
      Rotation.
  • Constructor Details

    • Ellipsoid

      public Ellipsoid()
      Empty constructor. Creates an ellipsoid equal to a sphere located at space origin (0,0,0) with radius 1.0.
    • Ellipsoid

      public Ellipsoid(Point3D center, double[] semiAxesLengths, Rotation3D rotation)
      Sets ellipsoid parameters.
      Parameters:
      center - center of ellipsoid.
      semiAxesLengths - lengths of all three semi-axes.
      rotation - rotation.
      Throws:
      IllegalArgumentException - if length of provided array is not three.
  • Method Details

    • getCenter

      public Point3D getCenter()
      Returns center of ellipsoid.
      Returns:
      center of ellipsoid.
    • setCenter

      public void setCenter(Point3D center)
      Sets center of ellipsoid.
      Parameters:
      center - center of ellipsoid.
      Throws:
      NullPointerException - raised if provided center is null.
    • getSemiAxesLengths

      public double[] getSemiAxesLengths()
      Gets lengths of all three semi-axes.
      Returns:
      lengths of all three semi-axes.
    • setSemiAxesLengths

      public void setSemiAxesLengths(double[] semiAxesLengths)
      Sets lengths of all three semi-axes.
      Parameters:
      semiAxesLengths - lengths of all three semi-axes.
      Throws:
      IllegalArgumentException - if length of provided array is not three.
    • getRotation

      public Rotation3D getRotation()
      Gets rotation.
      Returns:
      rotation.
    • setRotation

      public void setRotation(Rotation3D rotation)
      Sets rotation.
      Parameters:
      rotation - rotation.
    • setCenterAxesAndRotation

      public final void setCenterAxesAndRotation(Point3D center, double[] semiAxesLengths, Rotation3D rotation)
      Sets ellipsoid parameters.
      Parameters:
      center - center of ellipsoid.
      semiAxesLengths - lengths of all three semi-axes.
      rotation - rotation.
      Throws:
      IllegalArgumentException - if length of provided array is not three.
    • getVolume

      public double getVolume()
      Returns volume of this ellipsoid.
      Returns:
      volume of this ellipsoid.
    • getSurface

      public double getSurface()
      Returns surface of this ellipsoid.
      Returns:
      surface of this ellipsoid.
    • toQuadric

      public Quadric toQuadric() throws GeometryException
      Converts this ellipsoid into a quadric. Quadrics a re a more general representation of ellipsoids.
      Returns:
      a quadric representing this ellipsoid.
      Throws:
      GeometryException - if quadric cannot be determined due to numerical instabilities.
    • setFromSphere

      public final void setFromSphere(Sphere sphere)
      Sets parameters of this ellipsoid from a sphere.
      Parameters:
      sphere - a sphere to set parameters from.