Class Ellipsoid

java.lang.Object
org.bonej.ops.ellipsoid.Ellipsoid

public class Ellipsoid extends Object
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 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

      public void setA(double a) throws IllegalArgumentException
      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

      public void setB(double b) throws IllegalArgumentException
      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

      public void setC(double c) throws IllegalArgumentException
      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

      public org.joml.Vector3d getCentroid()
      Gets a copy of center point of the ellipsoid.
      Returns:
      the centroid of the ellipsoid.
    • setCentroid

      public void setCentroid(org.joml.Vector3dc centroid)
      Sets the coordinates of the centroid of the ellipsoid.
      Parameters:
      centroid - the new coordinates of the center point.
    • getOrientation

      public org.joml.Matrix4d 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

      public void setOrientation(org.joml.Matrix3dc semiAxes)
      Sets the values of the orientation vectors of the ellipsoid.

      The 1st column vector will correspond to radius a, and the 3rd to radius c.

      Parameters:
      semiAxes - matrix with the orientations of the semi-axes as column vectors.
    • getSemiAxes

      public List<org.joml.Vector3d> 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

      public void initSampling(net.imagej.ops.OpEnvironment ops)
      Initializes the ellipsoid point sampling function.
      Parameters:
      ops - the op environment of the current context.
    • samplePoints

      public List<org.joml.Vector3d> samplePoints(long n) throws RuntimeException
      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

      public void setSemiAxes(org.joml.Vector3dc u, org.joml.Vector3dc v, org.joml.Vector3dc w)
      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 a will 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.