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.
Shape.distanceTo(Line)
,
Shape.intersects(Line)
,
Serialized FormCreation 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);
Constructor and Description |
---|
RightCircularCylinder(Line inDirection,
double inRadius,
double inLength)
Build a right circular cylinder from its radius and its axis as a line
|
RightCircularCylinder(Vector3D inOrigin,
Vector3D inDirection,
double inRadius,
double inHeight)
Build a 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.
|
double |
getBaseSurface()
Returns the surface of the cylinder base.
|
double |
getCrossSection(Vector3D crossDirection)
Computes the cross section from the direction
defined by a Vector3D.
|
Vector3D |
getDirection() |
double |
getEquivalentTransversalSurf()
Get equivalent transversal surface.
|
Vector3D[] |
getIntersectionPoints(Line line)
Compute the intersection points with a line.
|
double |
getLength() |
Vector3D |
getOrigin() |
double |
getRadius() |
double |
getTransversalSurf()
Get transversal surface.
|
boolean |
intersects(Line line)
Tests the intersection with a line.
|
String |
toString()
Get a representation for this right circular cylinder.
|
public RightCircularCylinder(Line inDirection, double inRadius, double inLength)
inDirection
- the direction of the axis of the cylinderinRadius
- the radius of the cylinderinLength
- the height of the cylinder on its axisIllegalArgumentException
- if the radius or the height is negative or null, or if
the direction vector has a null norm.public RightCircularCylinder(Vector3D inOrigin, Vector3D inDirection, double inRadius, double inHeight)
inOrigin
- the origin of the axisinDirection
- the direction of the axisinRadius
- the radius of the cylinderinHeight
- the height of the cylinder on its axisIllegalArgumentException
- if the radius or the height is negative or null, or if
the direction vector has a null norm.public Vector3D getOrigin()
public Vector3D getDirection()
public double getLength()
public double getRadius()
public double getBaseSurface()
public double getTransversalSurf()
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 linepublic String toString()
public double getCrossSection(Vector3D crossDirection)
getCrossSection
in interface CrossSectionProvider
crossDirection
- the direction vectorpublic double getEquivalentTransversalSurf()
Copyright © 2020 CNES. All rights reserved.