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

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

public final class RightCircularCylinder
extends Object
implements CrossSectionProvider, Cylinder, Serializable

This is a describing class for a 3D right 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: RightCircularCylinder.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 a radius, a height and two Vector3D : Vector3D origin = new Vector3D(1.0, 6.0, -2.0); Vector3D direction = new Vector3D(6.0, -3.0, -1.0); double radius = 2.0; double length = 5.0; RightCircularCylinder cylinder = new RightCircularCylinder(origin, direction, radius, height); Creation with a line, a height and a radius : RightCircularCylinder cylinder = new RightCircularCylinder(line, radius, height); Intersection with a line : boolean intersects = cylinder(line);

Concurrency :
immutable

Constructor Summary
RightCircularCylinder(Line inDirection, double inRadius, double inLength)
          Build an infinite right circular cylinder from its radius and its axis as a line
RightCircularCylinder(Vector3D inOrigin, Vector3D inDirection, double inRadius, double inHeight)
          Build an infinite right circular cylinder from its radius and the origin and 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.
 double getCrossSection(Vector3D crossDirection)
          Computes the cross section from the direction defined by a Vector3D.
 Vector3D getDirection()
           
 Vector3D[] getIntersectionPoints(Line line)
          Compute the intersection points with a line.
 double getLength()
           
 Vector3D getOrigin()
           
 double getRadius()
           
 boolean intersects(Line line)
          Tests the intersection with a line.
 String toString()
          Get a representation for this right circular cylinder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RightCircularCylinder

public RightCircularCylinder(Line inDirection,
                             double inRadius,
                             double inLength)
Build an infinite right circular cylinder from its radius and its axis as a line

Parameters:
inDirection - the direction of the axis of the cylinder
inRadius - the radius of the cylinder
inLength - the height of the cylinder on its axis
Throws:
IllegalArgumentException - if the radius or the height is negative or null, or if the direction vector has a null norm.

RightCircularCylinder

public RightCircularCylinder(Vector3D inOrigin,
                             Vector3D inDirection,
                             double inRadius,
                             double inHeight)
Build an infinite right circular cylinder from its radius and the origin and direction of its axis

Parameters:
inOrigin - the origin of the axis
inDirection - the direction of the axis
inRadius - the radius of the cylinder
inHeight - the height of the cylinder on its axis
Throws:
IllegalArgumentException - if the radius or the height is negative or null, or if the direction vector has a null norm.
Method Detail

getOrigin

public Vector3D getOrigin()
Returns:
the origin

getDirection

public Vector3D getDirection()
Returns:
the direction

getLength

public double getLength()
Returns:
the height

getRadius

public double getRadius()
Returns:
the radius

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 representation for this right circular cylinder. The given parameters are in the same order as in the constructor.

Overrides:
toString in class Object
Returns:
a representation for this right circular cylinder

getCrossSection

public double getCrossSection(Vector3D crossDirection)
Computes the cross section from the direction defined by a Vector3D.

Specified by:
getCrossSection in interface CrossSectionProvider
Parameters:
crossDirection - the direction vector
Returns:
the cross section


Copyright © 2017 CNES. All Rights Reserved.