Package com.irurueta.geometry
Class Ellipsoid
java.lang.Object
com.irurueta.geometry.Ellipsoid
- All Implemented Interfaces:
Serializable
This class defines an ellipsoid.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Point3DCenter of ellipse.static final intNumber of dimensions.private static final doubleConstant to compute approximate surface area.private Rotation3DRotation.private double[]Lengths of all three semi-axes. -
Constructor Summary
ConstructorsConstructorDescriptionEmpty constructor.Ellipsoid(Point3D center, double[] semiAxesLengths, Rotation3D rotation) Sets ellipsoid parameters. -
Method Summary
Modifier and TypeMethodDescriptionReturns center of ellipsoid.Gets rotation.double[]Gets lengths of all three semi-axes.doubleReturns surface of this ellipsoid.doubleReturns volume of this ellipsoid.voidSets center of ellipsoid.final voidsetCenterAxesAndRotation(Point3D center, double[] semiAxesLengths, Rotation3D rotation) Sets ellipsoid parameters.final voidsetFromSphere(Sphere sphere) Sets parameters of this ellipsoid from a sphere.voidsetRotation(Rotation3D rotation) Sets rotation.voidsetSemiAxesLengths(double[] semiAxesLengths) Sets lengths of all three semi-axes.Converts this ellipsoid into a quadric.
-
Field Details
-
DIMENSIONS
public static final int DIMENSIONSNumber of dimensions.- See Also:
-
P
private static final double PConstant to compute approximate surface area.- See Also:
-
center
Center of ellipse. -
semiAxesLengths
private double[] semiAxesLengthsLengths of all three semi-axes. -
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
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
Returns center of ellipsoid.- Returns:
- center of ellipsoid.
-
setCenter
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
Gets rotation.- Returns:
- rotation.
-
setRotation
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
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
Sets parameters of this ellipsoid from a sphere.- Parameters:
sphere- a sphere to set parameters from.
-