public class QuickEllipsoid extends Object
Represents an ellipsoid defined by its centroid, eigenvalues and 3x3 eigenvector matrix. Semiaxis lengths (radii) are calculated as the inverse square root of the eigenvalues.
Constructor and Description |
---|
QuickEllipsoid(double[] radii,
double[] centroid,
double[][] eigenVectors)
Construct an QuickEllipsoid from the radii (a,b,c), centroid (cx, cy, cz) and
Eigenvectors.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y,
double z)
Method based on the inequality (X-X0)^T H (X-X0) ≤ 1 Where X is the test
point, X0 is the centroid, H is the ellipsoid's 3x3 matrix
|
void |
contract(double increment)
Constrict all three axes by a fractional increment
|
QuickEllipsoid |
copy()
Perform a deep copy of this QuickEllipsoid
|
void |
dilate(double da,
double db,
double dc)
Dilate the ellipsoid semiaxes by independent absolute amounts
|
double[][] |
getAxisAlignRandomlyDistributedSurfacePoints(int n) |
double[] |
getCentre() |
double[] |
getRadii()
Gets a copy of the radii.
|
double[][] |
getRotation()
Return a copy of the ellipsoid's eigenvector matrix
|
double[] |
getSortedRadii()
Get the radii sorted in ascending order.
|
double[][] |
getSurfacePoints(double[][] vectors) |
double |
getVolume()
Gets the volume of this ellipsoid, calculated as PI * a * b * c * 4 / 3
|
void |
rotate(double[][] rotation)
Rotate the ellipsoid by the given 3x3 Matrix
|
void |
setCentroid(double x,
double y,
double z)
Translate the ellipsoid to a given new centroid
|
void |
setRotation(double[][] rotation)
Set rotation to the supplied rotation matrix.
|
static double[][] |
transpose(double[][] a)
Transpose a 3x3 matrix in double[][] format.
|
public QuickEllipsoid(double[] radii, double[] centroid, double[][] eigenVectors)
radii
- radii (a,b,c) as a double arraycentroid
- ellipsoid centre x,y,z coordinates as a double arrayeigenVectors
- the orientation of the ellipsoid.public static double[][] transpose(double[][] a)
a
- a matrix.public boolean contains(double x, double y, double z)
x
- x-coordinate of the point.y
- y-coordinate of the point.z
- z-coordinate of the point.public void contract(double increment)
increment
- scaling factor.public QuickEllipsoid copy()
public void dilate(double da, double db, double dc) throws IllegalArgumentException
da
- value added to the 1st radius.db
- value added to the 2nd radius.dc
- value added to the 3rd radius.IllegalArgumentException
- if new semi-axes are non-positive.public double[] getCentre()
public double[] getRadii()
public double[][] getRotation()
public void setRotation(double[][] rotation)
rotation
- a 3x3 rotation matrixpublic double[] getSortedRadii()
public double[][] getSurfacePoints(double[][] vectors)
public double[][] getAxisAlignRandomlyDistributedSurfacePoints(int n)
public double getVolume()
public void rotate(double[][] rotation)
rotation
- a 3x3 rotation matrixpublic void setCentroid(double x, double y, double z)
x
- new centroid x-coordinatey
- new centroid y-coordinatez
- new centroid z-coordinateCopyright © 2018–2022 BoneJ. All rights reserved.