public final class LineSegment extends Object implements Serializable
This is a describing class for a line segment in 3D space, with a method to compute the shortest distance to a line.
Creation with two dimensions, a length and three Vector3D : Vector3D origin = new Vector3D(1.0, 6.0, -2.0); Vector3D direction = new Vector3D(6.0, -3.0, -1.0); double length = 2.0; LineSegment segment = new LineSegment(origin, direction, length); Distance to a line : double distance = segment.distanceTo(line);
Constructor and Description |
---|
LineSegment(Vector3D inOrigin,
Vector3D inDirection,
double inLength)
Build a line segment from its origin, direction and length.
|
Modifier and Type | Method and Description |
---|---|
Vector3D[] |
closestPointTo(Line line)
Computation of the closest point to a line, and the associated point of the line;
|
double |
distanceTo(Line line)
Computes the shortest distance to a line of space.
|
Vector3D |
getDirection() |
Vector3D |
getEnd() |
double |
getLength() |
Vector3D |
getOrigin() |
String |
toString()
Get a representation for this line segment.
|
public Vector3D getOrigin()
public Vector3D getEnd()
public double getLength()
public Vector3D getDirection()
public double distanceTo(Line line)
line
- the linepublic Vector3D[] closestPointTo(Line line)
line
- the lineCopyright © 2019 CNES. All rights reserved.