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

java.lang.Object
  extended by org.apache.commons.math3.geometry.euclidean.threed.EllipticCylinder
All Implemented Interfaces:
Serializable, Cylinder, Shape, SolidShape

public final class EllipticCylinder
extends Object
implements Cylinder, Serializable

This is a describing class for a 3D oblique circular cylinder ended by two planes normal to its axis, with some algorithm to compute intersections and distances to some other objects.

Since:
1.0
Version:
$Id: EllipticCylinder.java 11374 2014-10-30 15:39:29Z sabatini $
Author:
Thomas Trapier
See Also:
Shape.distanceTo(Line), Shape.intersects(Line), Serialized Form
Use sample :

Creation with two radiuses, a height and three Vector3D : Vector3D origin = new Vector3D(1.0, 6.0, -2.0); Vector3D direction = new Vector3D(6.0, -3.0, -1.0); Vector3D uVector = new Vector3D(-5.0, 3.0, 0.0); double radiusA = 2.0; double radiusB = 2.0; double height = 5.0; ObliqueCircularCylinder cylinder = new ObliqueCircularCylinder(origin, direction, uVector, radiusA, radiusB, length); Intersection with a line : boolean intersects = cylinder(line);

Concurrency :
immutable

Constructor Summary
EllipticCylinder(Vector3D inOrigin, Vector3D inDirection, Vector3D inUvector, double inRadiusA, double inRadiusB, double inHeight)
          Build an oblique circular cylinder from its radiuses, the height, the origin, the approximative u vector of the local frame and the direction of its axis.
 
Method Summary
 Vector3D[] closestPointTo(Line line)
          Computes the points of the shape and the line realizing the shortest distance.
 double distanceTo(Line line)
          Computes the distance to a line.
 Vector3D getDirection()
           
 double getHeight()
           
 Vector3D[] getIntersectionPoints(Line line)
          Compute the intersection points with a line.
 Vector3D getOrigin()
           
 double getRadiusA()
           
 double getRadiusB()
           
 Vector3D getU()
           
 Vector3D getV()
           
 boolean intersects(Line line)
          Tests the intersection with a line.
 String toString()
          Get a string representation for this elliptic cylinder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EllipticCylinder

public EllipticCylinder(Vector3D inOrigin,
                        Vector3D inDirection,
                        Vector3D inUvector,
                        double inRadiusA,
                        double inRadiusB,
                        double inHeight)
Build an oblique circular cylinder from its radiuses, the height, the origin, the approximative u vector of the local frame and the direction of its axis.

Parameters:
inOrigin - the origin of the axis
inDirection - the direction of the axis
inUvector - approximative U vector of the local frame : corrected to be orthogonal to the direction
inRadiusA - the angle of the cone on U direction
inRadiusB - the angle of the cone on V direction
inHeight - the height of the cone on its axis
Throws:
IllegalArgumentException - if one radius or the height is negative or null, or if the direction vector or u vector has a null norm, or if they are parallel.
Method Detail

getHeight

public double getHeight()
Returns:
the height

getRadiusA

public double getRadiusA()
Returns:
the radiusA, on U axis of the local frame

getRadiusB

public double getRadiusB()
Returns:
the radiusB, on V axis of the local frame

getOrigin

public Vector3D getOrigin()
Returns:
the origin

getU

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

getV

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

getDirection

public Vector3D getDirection()
Returns:
the direction of the axis

intersects

public 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 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 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

closestPointTo

public 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.

toString

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

Overrides:
toString in class Object
Returns:
a string representation for this elliptic cylinder


Copyright © 2016 CNES. All Rights Reserved.