java.lang.Object
org.bonej.ops.ellipsoid.Ellipsoid
A class that stores the properties of an ellipsoid.
The class doesn't allow degenerate cases like a disc where one or more of the radii is zero.
- Author:
- Richard Domander, Alessandro Felder
-
Constructor Summary
ConstructorsConstructorDescriptionEllipsoid(double a, double b, double c) Constructs an Ellipsoid.Constructs an Ellipsoid from semi-axes. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetA()Gets the smallest radius of the ellipsoid.doublegetB()Gets the second radius of the ellipsoid.doublegetC()Gets the largest radius of the ellipsoid.Gets a copy of center point of the ellipsoid.Gets a copy of the orientation unit vectors of the ellipsoid.Returns a copy of the semi-axes of the ellipsoid.doubleGets the volume of the ellipsoid.voidInitializes the ellipsoid point sampling function.samplePoints(long n) Return a random collection of points on the ellipsoid surface.voidsetA(double a) Sets the smallest radius of the ellipsoid.voidsetB(double b) Sets the second radius of the ellipsoid.voidsetC(double c) Sets the largest radius of the ellipsoid.voidsetCentroid(org.joml.Vector3dc centroid) Sets the coordinates of the centroid of the ellipsoid.voidsetOrientation(org.joml.Matrix3dc semiAxes) Sets the values of the orientation vectors of the ellipsoid.voidSets the semi-axes of the ellipsoid.
-
Constructor Details
-
Ellipsoid
public Ellipsoid(double a, double b, double c) Constructs an Ellipsoid.The radii will be sorted in the constructor.
- Parameters:
a- smallest radius of the ellipsoid.b- 2nd radius of the ellipsoid.c- largest radius of the ellipsoid.
-
Ellipsoid
Constructs an Ellipsoid from semi-axes.- Parameters:
u- a semi-axis of the ellipsoid.v- a semi-axis of the ellipsoid.w- a semi-axis of the ellipsoid.- See Also:
-
-
Method Details
-
getA
public double getA()Gets the smallest radius of the ellipsoid.- Returns:
- the real value radius.
-
setA
Sets the smallest radius of the ellipsoid.- Parameters:
a- new value for the smallest radius.- Throws:
IllegalArgumentException- if the radius is non-positive, non-finite, or greater than b or c.
-
getB
public double getB()Gets the second radius of the ellipsoid.- Returns:
- the real value radius.
-
setB
Sets the second radius of the ellipsoid.- Parameters:
b- new value for the second radius.- Throws:
IllegalArgumentException- if the radius is non-positive, non-finite, or greater than c or less than a.
-
getC
public double getC()Gets the largest radius of the ellipsoid.- Returns:
- the real value radius.
-
setC
Sets the largest radius of the ellipsoid.- Parameters:
c- new value for the smallest radius.- Throws:
IllegalArgumentException- if the radius is non-positive, non-finite or less than b or c.
-
getCentroid
Gets a copy of center point of the ellipsoid.- Returns:
- the centroid of the ellipsoid.
-
setCentroid
Sets the coordinates of the centroid of the ellipsoid.- Parameters:
centroid- the new coordinates of the center point.
-
getOrientation
Gets a copy of the orientation unit vectors of the ellipsoid.The orientations are the column vectors of the matrix.
NB the vectors may form a left-handed basis! This may cause exceptions if the matrix is used with other linear algebra libraries.
- Returns:
- orientations of the semi-axes in homogeneous coordinates.
-
setOrientation
Sets the values of the orientation vectors of the ellipsoid.The 1st column vector will correspond to radius
a, and the 3rd to radiusc.- Parameters:
semiAxes- matrix with the orientations of the semi-axes as column vectors.
-
getSemiAxes
Returns a copy of the semi-axes of the ellipsoid.- Returns:
- semi-axes with radii a, b, c.
-
getVolume
public double getVolume()Gets the volume of the ellipsoid.- Returns:
- ellipsoid volume.
-
initSampling
Initializes the ellipsoid point sampling function.- Parameters:
ops- the op environment of the current context.
-
samplePoints
Return a random collection of points on the ellipsoid surface.- Parameters:
n- number of points generated.- Returns:
- a collection of points isotropically distributed on the ellipsoid.
- Throws:
RuntimeException- if sampling hasn't been initialized.- See Also:
-
setSemiAxes
Sets the semi-axes of the ellipsoid.Semi-axes will be sorted by length in ascending order so that the shortest vector becomes the 1st and the longest the 3rd column vector in the orientation matrix. Thus radius
awill be the length of the 1st column vector etc.- Parameters:
u- a semi-axis of the ellipsoid.v- a semi-axis of the ellipsoid.w- a semi-axis of the ellipsoid.
-