public class Parallelepiped extends Object implements SolidShape, CrossSectionProvider, Serializable
This is a describing class for a rectangle parallelepiped shape, with some algorithm to compute intersections and distances to some other objects.
Shape.distanceTo(Line)
,
Shape.intersects(Line)
,
Serialized FormCreation with three Vector3D and two doubles : Parallelepiped parallelepiped = new Parallelepiped(center, vectorU, pseudoVectorV, length, width, height); Intersection with a line : boolean intersects = parallelepiped(line);
Constructor and Description |
---|
Parallelepiped(Vector3D inCenter,
Vector3D inU,
Vector3D inV,
double inLength,
double inWidth,
double inHeight)
Build a parallelepiped from the position of its center, two vectors to describe its local frame and dimensions.
|
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 |
getCenter() |
Vector3D[] |
getCorners() |
double |
getCrossSection(Vector3D direction)
Computes the cross section from the direction
defined by a Vector3D.
|
Plate[] |
getFaces() |
double |
getHeight() |
Vector3D[] |
getIntersectionPoints(Line line)
Compute the intersection points with a line.
|
double |
getLength() |
Vector3D |
getU() |
Vector3D |
getV() |
Vector3D |
getW() |
double |
getWidth() |
boolean |
intersects(Line line)
Tests the intersection with a line.
|
String |
toString()
Get a representation for this parallelepiped.
|
public Parallelepiped(Vector3D inCenter, Vector3D inU, Vector3D inV, double inLength, double inWidth, double inHeight)
inCenter
- the center of the plateinU
- a non-normalised vector parallel to uinV
- the second vector defining the plate's plane : corrected to be orthogonal to UinLength
- the parallelepiped's length along UinWidth
- the parallelepiped's width along V (once corrected)inHeight
- the parallelepiped's heightIllegalArgumentException
- if the vectors do not define a plane, or if the dimensions are negative or nullpublic Vector3D getCenter()
public Vector3D getU()
public Vector3D getV()
public Vector3D getW()
public double getLength()
public double getWidth()
public double getHeight()
public Vector3D[] getCorners()
public Plate[] getFaces()
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 direction)
getCrossSection
in interface CrossSectionProvider
direction
- the direction vectorCopyright © 2018 CNES. All Rights Reserved.