public class Ellipsoid 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.
Modifier and Type | Field and Description |
---|---|
int |
id
ID field for tracking this particular ellipsoid
|
Constructor and Description |
---|
Ellipsoid(double a,
double b,
double c,
double cx,
double cy,
double cz,
double[][] eigenVectors)
Construct an Ellipsoid from the radii (a,b,c), centroid (cx, cy, cz) and
Eigenvectors.
|
Ellipsoid(Object[] ellipsoid)
Instantiate an ellipsoid from the result of FitEllipsoid
|
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
|
Ellipsoid |
copy()
Perform a deep copy of this Ellipsoid
|
void |
dilate(double da,
double db,
double dc)
Dilate the ellipsoid semiaxes by independent absolute amounts
|
double[] |
getAxisAlignedBoundingBox()
Calculate the minimal axis-aligned bounding box of this ellipsoid Thanks to
Tavian Barnes for the simplification of the maths
https://tavianator.com/2014/06/exact-bounding-boxes-for-spheres-ellipsoids
|
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[][] |
getSurfacePoints(int nPoints) |
double |
getVolume()
Gets the volume of this ellipsoid, calculated as PI * a * b * c * 4 / 3
|
double[] |
getYMinAndMax()
Calculate the minimal and maximal y values bounding this ellipsoid
|
double[] |
getZMinAndMax()
Calculate the minimal and maximal z values bounding this ellipsoid
|
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 Ellipsoid(Object[] ellipsoid)
ellipsoid
- the properties of an ellipsoid.public Ellipsoid(double a, double b, double c, double cx, double cy, double cz, double[][] eigenVectors)
a
- 1st radius.b
- 2nd radius.c
- 3rd radius.cx
- centroid x-coordinate.cy
- centroid y-coordinate.cz
- centroid z-coordinate.eigenVectors
- the orientation of the ellipsoid.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 Ellipsoid 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[] getAxisAlignedBoundingBox()
public double[] getCentre()
public double[] getRadii()
public double[][] getRotation()
public void setRotation(double[][] rotation)
rotation
- a 3x3 rotation matrixpublic double[] getSortedRadii()
public double[][] getSurfacePoints(int nPoints)
public double[][] getSurfacePoints(double[][] vectors)
public double getVolume()
public double[] getYMinAndMax()
public double[] getZMinAndMax()
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-coordinatepublic static double[][] transpose(double[][] a)
a
- a matrix.Copyright © 2018–2022 BoneJ. All rights reserved.