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

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

public abstract class AbstractEllipse
extends Object
implements SolidShape, Serializable

This is an abstract describing class for an ellipse in 3D space, with some algorithm to compute intersections and distances to some other objects.

Since:
1.0
Version:
$Id: AbstractEllipse.java 17583 2017-05-10 13:05:10Z bignon $
Author:
Thomas Trapier
See Also:
Shape.distanceTo(Line), Shape.intersects(Line), Serialized Form
Use sample :

Creation with two radiuses, and two Vector3D : Vector3D center = new Vector3D(1.0, 6.0, -2.0); Vector3D normal = new Vector3D(6.0, -3.0, -1.0); double radiusA = 2.0; double radiusB = 5.0; Ellipse ellipse = new Ellipse(center, normal, radiusA, radiusB); Intersection with a line : boolean intersects = ellipse(line);

Concurrency :
immutable

Constructor Summary
AbstractEllipse(Vector3D inCenter, Vector3D inNormal, Vector3D inUvector, double inRadiusA, double inRadiusB)
          Build an ellipse in the 3D space from its center, normal vector, approximative U vector of the local frame, and two radiuses.
 
Method Summary
 Vector3D[] closestPointTo(Line line)
          Computes the points of the shape and the line realizing the shortest distance.
 Vector3D closestPointTo(Vector3D point)
          Computes the point on the ellipse closest to a point.
 double distanceTo(Line line)
          Computes the distance to a line.
 double distanceTo(Vector3D point)
          Computes the shortest distance from a point to the ellipse.
 Vector3D getCenter()
           
 Vector3D[] getIntersectionPoints(Line line)
          Compute the intersection points with a line.
 Vector3D getNormal()
           
 double getRadiusA()
           
 double getRadiusB()
           
 Vector3D getU()
           
 Vector3D getV()
           
 boolean intersects(Line line)
          Tests the intersection with a line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEllipse

public AbstractEllipse(Vector3D inCenter,
                       Vector3D inNormal,
                       Vector3D inUvector,
                       double inRadiusA,
                       double inRadiusB)
Build an ellipse in the 3D space from its center, normal vector, approximative U vector of the local frame, and two radiuses.

Parameters:
inCenter - position of the center
inNormal - normal to the plane containing the ellipse
inUvector - approximative U vector of the local frame : corrected to be orthogonal to the normal
inRadiusA - radius on the U axis of the local frame
inRadiusB - radius on the V axis of the local frame
Throws:
IllegalArgumentException - if one radius is'nt strictly positive, if the normal or the uVector has a not strictly positive norm, or if they are parallel.
Method Detail

getCenter

public final Vector3D getCenter()
Returns:
the center

getNormal

public final Vector3D getNormal()
Returns:
the normal

getRadiusA

public final double getRadiusA()
Returns:
the radius A

getRadiusB

public final double getRadiusB()
Returns:
the radius B

getU

public final Vector3D getU()
Returns:
the u vector for the local frame

getV

public final Vector3D getV()
Returns:
the v vector for the local frame

intersects

public final boolean intersects(Line line)
Tests the intersection with a line.

Specified by:
intersects in interface Shape
Parameters:
line - the line
Returns:
true if the line intersects the shape

getIntersectionPoints

public final Vector3D[] getIntersectionPoints(Line line)
Compute the intersection points with a line.

Specified by:
getIntersectionPoints in interface Shape
Parameters:
line - the line
Returns:
the intersection points if they exist. If no intersection is found, the dimension is zero

distanceTo

public final double distanceTo(Line line)
Computes the distance to a line.

Specified by:
distanceTo in interface Shape
Parameters:
line - the line
Returns:
the shortest distance between the the line and the shape

distanceTo

public final double distanceTo(Vector3D point)
Computes the shortest distance from a point to the ellipse.

Parameters:
point - the point
Returns:
the shortest distance from the point to the ellipse

closestPointTo

public final Vector3D closestPointTo(Vector3D point)
Computes the point on the ellipse closest to a point.

Parameters:
point - the point
Returns:
the closest point on the ellipse

closestPointTo

public final Vector3D[] closestPointTo(Line line)
Computes the points of the shape and the line realizing the shortest distance. If the line intersects the shape, the returned points are identical : this point is the first common point found.

Specified by:
closestPointTo in interface Shape
Parameters:
line - the line
Returns:
the two points : first the one from the line, and the one from the shape.


Copyright © 2017 CNES. All Rights Reserved.