org.apache.commons.math3.geometry.euclidean.threed
Class Ellipsoid

java.lang.Object
  extended by org.apache.commons.math3.geometry.euclidean.threed.Ellipsoid
All Implemented Interfaces:
Serializable, IEllipsoid, Shape, SolidShape
Direct Known Subclasses:
Spheroid

public class Ellipsoid
extends Object
implements IEllipsoid, Serializable

This is the Ellipsoid (also called Revolved Ellipsoid) class.This class cannot represent all ellipsoid objects.

It creates an ellipsoid object.

Usage: With two Vector3D for position and Rev. Axis and three doubles for the three semi axes, call

Ellipsoid myEllipsoid = new Ellipsoid(position, axis, a, b, c)

Since:
1.2
Version:
$Id: Ellipsoid.java 17583 2017-05-10 13:05:10Z bignon $
Author:
Rami Houdroge
See Also:
IEllipsoid, SolidShape, Serialized Form
Concurrency :
immutable

Constructor Summary
Ellipsoid(Vector3D myPosition, Vector3D myRevAxis, Vector3D myXAxis, double myA, double myB, double myC)
          This constructor builds a ellipsoid from its centers position, its revolution axis and its transverse and conjugate radii.
 
Method Summary
 Vector3D[] closestPointTo(Line line)
          This method computes the point on the line that is the closest to the ellipsoid.
 Vector3D closestPointTo(Vector3D point)
          Computes the point, on the ellipsoid surface, that is the closest to a point of space.
 double distanceTo(Line line)
          Get the smallest distance from the line to the ellipsoid
 double distanceTo(Vector3D point)
          Computes the distance to the closest point on the ellipsoid.
 Vector3D getAffineLocalExpression(Vector3D myVector)
          Express a Vector3D in ellipsoid local basis.
 Vector3D getAffineStandardExpression(Vector3D myVector)
          Express a Vector3D in standard basis.
 double[] getCartesianCoordinates(double theta, double phi)
          Convert from Ellipsoid to Cartesian coordinates
 Vector3D getCenter()
          Get ellipsoid center
 double[] getEllipsoidicCoordinates(Vector3D point)
          Convert from Cartesian to Ellipsoid coordinates
 Vector3D[] getIntersectionPoints(Line line)
          If more than one intersection points are found, the closest to the line's origin is returned first
 Matrix3D getLocalBasisTransform()
          Get transformation matrix (from standard basis to ellipsoid local basis)
 Vector3D getNormal(Vector3D point)
          Computes the normal vector to the surface in local basis
 double getSemiA()
          Get the length of the semi principal axis X
 double getSemiB()
          Get the length of the semi principal axis Y
 double getSemiC()
          Get the length of the semi principal axis Z
 Vector3D getSemiPrincipalX()
           
 Vector3D getSemiPrincipalY()
           
 Vector3D getSemiPrincipalZ()
           
 Matrix3D getStandardBasisTransform()
          Get transformation matrix (from ellipsoid local basis to standard basis)
 Vector3D getVectorialLocalExpression(Vector3D myVector)
          Express a Vector3D in ellipsoid local basis.
 Vector3D getVectorialStandardExpression(Vector3D myVector)
          Express a Vector3D in standard basis.
 boolean intersects(Line line)
          This method returns true if the line intersects the ellipsoid
 void setNewtonThreshold(double newThreshold)
          Setter for Newton algorithm threshold used to compute closest point and distance to the ellipsoid.
 String toString()
          Get a representation for this ellipsoid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Ellipsoid

public Ellipsoid(Vector3D myPosition,
                 Vector3D myRevAxis,
                 Vector3D myXAxis,
                 double myA,
                 double myB,
                 double myC)
This constructor builds a ellipsoid from its centers position, its revolution axis and its transverse and conjugate radii. A ellipsoid, or ellipsoid of revolution, is a quadric surface obtained by rotating an ellipse about one of its principal axes.

Parameters:
myPosition - The position of the ellipsoids center
myRevAxis - The axis of revolution of the ellipsoid
myXAxis - The axis of semi major axis a. Will be normalized and taken orthogonal to myRevAxis.
myA - Transverse radius : semi axis of the ellipsoid along a direction orthogonal to the axis of revolution
myB - Transverse radius : semi axis of the ellipsoid along a direction orthogonal to the axis of revolution (orthogonal to myA direction)
myC - Conjugate radius : semi axis of the ellipsoid along the axis of revolution
Throws:
IllegalArgumentException - if semi-axis or norm of revolution axis is null
Method Detail

getSemiPrincipalX

public Vector3D getSemiPrincipalX()
Returns:
the ellipsoid semi principal X vector

getSemiPrincipalY

public Vector3D getSemiPrincipalY()
Returns:
the ellipsoid semi principal Y vector

getSemiPrincipalZ

public Vector3D getSemiPrincipalZ()
Returns:
the ellipsoid semi principal Z vector

getCenter

public Vector3D getCenter()
Get ellipsoid center

Specified by:
getCenter in interface IEllipsoid
Returns:
the position of the ellipsoids center

getSemiA

public double getSemiA()
Get the length of the semi principal axis X

Specified by:
getSemiA in interface IEllipsoid
Returns:
semi principal axis X length

getSemiB

public double getSemiB()
Get the length of the semi principal axis Y

Specified by:
getSemiB in interface IEllipsoid
Returns:
semi principal axis Y length

getSemiC

public double getSemiC()
Get the length of the semi principal axis Z

Specified by:
getSemiC in interface IEllipsoid
Returns:
semi principal axis Z length

getStandardBasisTransform

public Matrix3D getStandardBasisTransform()
Get transformation matrix (from ellipsoid local basis to standard basis)

Returns:
standardBasisTransform the local basis transform matrix

getLocalBasisTransform

public Matrix3D getLocalBasisTransform()
Get transformation matrix (from standard basis to ellipsoid local basis)

Returns:
localBasisTransform the local basis transformation matrix

getAffineLocalExpression

public Vector3D getAffineLocalExpression(Vector3D myVector)
Express a Vector3D in ellipsoid local basis. Warning : Affine transformation

Parameters:
myVector - Vector expressed in standard basis
Returns:
vectorRef Same vector expressed in ellipsoid local basis

getAffineStandardExpression

public Vector3D getAffineStandardExpression(Vector3D myVector)
Express a Vector3D in standard basis. Warning : Affine transformation

Parameters:
myVector - Vector expressed in ellipsoid local basis
Returns:
vectorRef Same vector expressed in standard basis

getVectorialLocalExpression

public Vector3D getVectorialLocalExpression(Vector3D myVector)
Express a Vector3D in ellipsoid local basis. Warning : Vectorial transformation

Parameters:
myVector - Vector expressed in standard basis
Returns:
vectorRef Same vector expressed in ellipsoid local basis

getVectorialStandardExpression

public Vector3D getVectorialStandardExpression(Vector3D myVector)
Express a Vector3D in standard basis. Warning : Vectorial transformation

Parameters:
myVector - Vector expressed in ellipsoid local basis
Returns:
vectorRef Same vector expressed in standard basis

getCartesianCoordinates

public double[] getCartesianCoordinates(double theta,
                                        double phi)
Convert from Ellipsoid to Cartesian coordinates

Parameters:
theta - theta angle in local basis
phi - phi angle
Returns:
triplet (x,y,z) as a double[] expressed in ellipsoid local basis

getEllipsoidicCoordinates

public double[] getEllipsoidicCoordinates(Vector3D point)
Convert from Cartesian to Ellipsoid coordinates

Parameters:
point - Point as a Vector3D in local basis
Returns:
angle coordinates (theta, phi)

getNormal

public Vector3D getNormal(Vector3D point)
Computes the normal vector to the surface in local basis

Specified by:
getNormal in interface IEllipsoid
Parameters:
point - Point as a Vector3D in local basis
Returns:
the normal vector in local basis

getIntersectionPoints

public Vector3D[] getIntersectionPoints(Line line)
If more than one intersection points are found, the closest to the line's origin is returned first

Specified by:
getIntersectionPoints in interface Shape
Parameters:
line - line with which the intersections are calculated
Returns:
intersections an array of Vector3D objects. Empty if no intersections

intersects

public boolean intersects(Line line)
This method returns true if the line intersects the ellipsoid

Specified by:
intersects in interface Shape
Parameters:
line - line for the computation of the intersection
Returns:
a boolean set to true if the line indeed intersects the ellipsoid

closestPointTo

public Vector3D closestPointTo(Vector3D point)
Computes the point, on the ellipsoid surface, that is the closest to a point of space.

Specified by:
closestPointTo in interface IEllipsoid
Parameters:
point - the point expressed in standard basis
Returns:
the closest point to the user point on the ellipsoid surface

distanceTo

public double distanceTo(Vector3D point)
Computes the distance to the closest point on the ellipsoid. If the point is inside the ellipsoid, the returned distance is negative. This method calls the method closestPointTo(Vector3D) that computes the coordinates of the closest point on the ellipsoid and returns the distance between the user point and the returned point.

Parameters:
point - point coordinates in standard basis
Returns:
distance to the closest point on the ellipsoid

closestPointTo

public Vector3D[] closestPointTo(Line line)
This method computes the point on the line that is the closest to the ellipsoid.

Specified by:
closestPointTo in interface Shape
Parameters:
line - line for the shortest distance computation
Returns:
Array of length 2 containing the point of the ellipsoid (slot [0]) and the point of the line (slot [1]) expressed as Vector3D

distanceTo

public double distanceTo(Line line)
Get the smallest distance from the line to the ellipsoid

Specified by:
distanceTo in interface Shape
Parameters:
line - the line
Returns:
the computed distance

setNewtonThreshold

public void setNewtonThreshold(double newThreshold)
Setter for Newton algorithm threshold used to compute closest point and distance to the ellipsoid. Default value for this threshold is 1E-11.

Parameters:
newThreshold - new threshold to set

toString

public String toString()
Get a representation for this ellipsoid. The given parameters are in the same order as in the constructor.

Overrides:
toString in class Object
Returns:
a representation for this ellipsoid


Copyright © 2017 CNES. All Rights Reserved.