public class Ellipsoid extends Object
The class doesn't allow degenerate cases like a disc where one or more of the radii is zero.
Constructor and Description |
---|
Ellipsoid(double a,
double b,
double c)
Constructs an Ellipsoid.
|
Ellipsoid(org.joml.Vector3dc u,
org.joml.Vector3dc v,
org.joml.Vector3dc w)
Constructs an Ellipsoid from semi-axes.
|
Modifier and Type | Method and Description |
---|---|
double |
getA()
Gets the smallest radius of the ellipsoid.
|
double |
getB()
Gets the second radius of the ellipsoid.
|
double |
getC()
Gets the largest radius of the ellipsoid.
|
org.joml.Vector3d |
getCentroid()
Gets a copy of center point of the ellipsoid.
|
org.joml.Matrix4d |
getOrientation()
Gets a copy of the orientation unit vectors of the ellipsoid.
|
List<org.joml.Vector3d> |
getSemiAxes()
Returns a copy of the semi-axes of the ellipsoid.
|
double |
getVolume()
Gets the volume of the ellipsoid.
|
void |
initSampling(OpEnvironment ops)
Initializes the ellipsoid point sampling function.
|
List<org.joml.Vector3d> |
samplePoints(long n)
Return a random collection of points on the ellipsoid surface.
|
void |
setA(double a)
Sets the smallest radius of the ellipsoid.
|
void |
setB(double b)
Sets the second radius of the ellipsoid.
|
void |
setC(double c)
Sets the largest radius of the ellipsoid.
|
void |
setCentroid(org.joml.Vector3dc centroid)
Sets the coordinates of the centroid of the ellipsoid.
|
void |
setOrientation(org.joml.Matrix3dc semiAxes)
Sets the values of the orientation vectors of the ellipsoid.
|
void |
setSemiAxes(org.joml.Vector3dc u,
org.joml.Vector3dc v,
org.joml.Vector3dc w)
Sets the semi-axes of the ellipsoid.
|
public Ellipsoid(double a, double b, double c)
The radii will be sorted in the constructor.
a
- smallest radius of the ellipsoid.b
- 2nd radius of the ellipsoid.c
- largest radius of the ellipsoid.public Ellipsoid(org.joml.Vector3dc u, org.joml.Vector3dc v, org.joml.Vector3dc w)
u
- a semi-axis of the ellipsoid.v
- a semi-axis of the ellipsoid.w
- a semi-axis of the ellipsoid.setSemiAxes(Vector3dc, Vector3dc, Vector3dc)
public double getA()
public void setA(double a) throws IllegalArgumentException
a
- new value for the smallest radius.IllegalArgumentException
- if the radius is non-positive, non-finite,
or greater than b or c.public double getB()
public void setB(double b) throws IllegalArgumentException
b
- new value for the second radius.IllegalArgumentException
- if the radius is non-positive, non-finite,
or greater than c or less than a.public double getC()
public void setC(double c) throws IllegalArgumentException
c
- new value for the smallest radius.IllegalArgumentException
- if the radius is non-positive, non-finite
or less than b or c.public org.joml.Vector3d getCentroid()
public void setCentroid(org.joml.Vector3dc centroid)
centroid
- the new coordinates of the center point.public org.joml.Matrix4d getOrientation()
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.
public void setOrientation(org.joml.Matrix3dc semiAxes)
The 1st column vector will correspond to radius a
, and the 3rd to
radius c
.
semiAxes
- matrix with the orientations of the semi-axes as column
vectors.public List<org.joml.Vector3d> getSemiAxes()
public double getVolume()
public void initSampling(OpEnvironment ops)
ops
- the op environment of the current context.public List<org.joml.Vector3d> samplePoints(long n) throws RuntimeException
n
- number of points generated.RuntimeException
- if sampling hasn't been initialized.initSampling(OpEnvironment)
public void setSemiAxes(org.joml.Vector3dc u, org.joml.Vector3dc v, org.joml.Vector3dc w)
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 a
will be the length of the 1st
column vector etc.
u
- a semi-axis of the ellipsoid.v
- a semi-axis of the ellipsoid.w
- a semi-axis of the ellipsoid.Copyright © 2018–2022 BoneJ. All rights reserved.