public final class InfiniteRightCircularCylinder extends Object implements InfiniteCylinder, Serializable
This is a describing class for a 3D infinite right circular cylinder, with some algorithm to compute intersections and distances to some other objects.
Shape.distanceTo(Line)
,
Shape.intersects(Line)
,
Serialized FormCreation with a radius 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; InfiniteRightCircularCylinder cylinder = new InfiniteRightCircularCylinder(origin, direction, radius); Creation with a line and a radius : InfiniteRightCircularCylinder cylinder = new InfiniteRightCircularCylinder(line, radius); Intersection with a line : boolean intersects = cylinder(line);
Constructor and Description |
---|
InfiniteRightCircularCylinder(Line inDirection,
double inRadius)
Build an infinite right circular cylinder from its radius and its axis as a line
|
InfiniteRightCircularCylinder(Vector3D inOrigin,
Vector3D inDirection,
double inRadius)
Build an infinite right circular cylinder from its radius and the origin and direction of its axis
|
Modifier and Type | Method and Description |
---|---|
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() |
Vector3D[] |
getIntersectionPoints(Line line)
Compute the intersection points with a line.
|
Vector3D |
getOrigin() |
double |
getRadius() |
boolean |
intersects(Line line)
Tests the intersection with a line.
|
String |
toString()
Get a representation for this infinite right circular cylinder.
|
public InfiniteRightCircularCylinder(Line inDirection, double inRadius)
inDirection
- the direction : axis of the cylinderinRadius
- the radius of the cylinderIllegalArgumentException
- if the radius is negative or null, or if the direction vector has a null norm.public InfiniteRightCircularCylinder(Vector3D inOrigin, Vector3D inDirection, double inRadius)
inOrigin
- the origin of the axisinDirection
- the direction of the axisinRadius
- the radius of the cylinderIllegalArgumentException
- if the radius is negative or null, or if the direction vector has a null norm.public Vector3D getOrigin()
public Vector3D getDirection()
public double getRadius()
public boolean intersects(Line line)
intersects
in interface Shape
line
- the linepublic Vector3D[] getIntersectionPoints(Line line)
getIntersectionPoints
in interface Shape
line
- the linepublic double distanceTo(Line line)
distanceTo
in interface Shape
line
- the linepublic Vector3D[] closestPointTo(Line line)
closestPointTo
in interface Shape
line
- the lineCopyright © 2021 CNES. All rights reserved.