Class Line
java.lang.Object
org.hipparchus.geometry.euclidean.threed.Line
- All Implemented Interfaces:
Embedding<Euclidean3D,
Euclidean1D>
The class represent lines in a three dimensional space.
Each oriented line is intrinsically associated with an abscissa which is a coordinate on the line. The point at abscissa 0 is the orthogonal projection of the origin on the line, another equivalent way to express this is to say that it is the point of the line which is closest to the origin. Abscissa increases in the line direction.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclosestPoint
(Line line) Compute the point of the instance closest to another line.boolean
Check if the instance contains a point.double
Compute the shortest distance between the instance and another line.double
Compute the distance between the instance and a point.static Line
fromDirection
(Vector3D point, Vector3D direction, double tolerance) Create a line from a point and a direction.double
getAbscissa
(Vector3D point) Get the abscissa of a point with respect to the line.Get the normalized direction vector.Get the line point closest to the origin.double
Get the tolerance below which points are considered identical.intersection
(Line line) Get the intersection point of the instance and another line.boolean
isSimilarTo
(Line line) Check if the instance is similar to another line.pointAt
(double abscissa) Get one point from the line.void
Reset the instance as if built from two points.revert()
Get a line with reversed direction.toSpace
(Point<Euclidean1D> point) Transform a sub-space point into a space point.toSpace
(Vector<Euclidean1D, Vector1D> vector) Transform a sub-space point into a space point.toSubSpace
(Point<Euclidean3D> point) Transform a space point into a sub-space point.toSubSpace
(Vector<Euclidean3D, Vector3D> vector) Transform a space point into a sub-space point.Build a sub-line covering the whole line.
-
Constructor Details
-
Line
Build a line from two points.- Parameters:
p1
- first point belonging to the line (this can be any point)p2
- second point belonging to the line (this can be any point, different from p1)tolerance
- tolerance below which points are considered identical- Throws:
MathIllegalArgumentException
- if the points are equal- See Also:
-
Line
Copy constructor.The created instance is completely independent from the original instance, it is a deep copy.
- Parameters:
line
- line to copy
-
-
Method Details
-
fromDirection
Create a line from a point and a direction. Line =point
+ t *direction
, where t is any real number.- Parameters:
point
- on the line. Can be any point.direction
- of the line. Must not be the zero vector.tolerance
- below which points are considered identical.- Returns:
- a new Line with the given point and direction.
- Throws:
MathIllegalArgumentException
- ifdirection
is the zero vector.- See Also:
-
reset
Reset the instance as if built from two points.- Parameters:
p1
- first point belonging to the line (this can be any point)p2
- second point belonging to the line (this can be any point, different from p1)- Throws:
MathIllegalArgumentException
- if the points are equal
-
getTolerance
public double getTolerance()Get the tolerance below which points are considered identical.- Returns:
- tolerance below which points are considered identical
-
revert
Get a line with reversed direction.- Returns:
- a new instance, with reversed direction
-
getDirection
Get the normalized direction vector.- Returns:
- normalized direction vector
-
getOrigin
Get the line point closest to the origin.- Returns:
- line point closest to the origin
-
getAbscissa
Get the abscissa of a point with respect to the line.The abscissa is 0 if the projection of the point and the projection of the frame origin on the line are the same point.
- Parameters:
point
- point to check- Returns:
- abscissa of the point
-
pointAt
Get one point from the line.- Parameters:
abscissa
- desired abscissa for the point- Returns:
- one point belonging to the line, at specified abscissa
-
toSubSpace
Transform a space point into a sub-space point.- Parameters:
vector
- n-dimension point of the space- Returns:
- (n-1)-dimension point of the sub-space corresponding to the specified space point
-
toSpace
Transform a sub-space point into a space point.- Parameters:
vector
- (n-1)-dimension point of the sub-space- Returns:
- n-dimension point of the space corresponding to the specified sub-space point
-
toSubSpace
Transform a space point into a sub-space point.- Specified by:
toSubSpace
in interfaceEmbedding<Euclidean3D,
Euclidean1D> - Parameters:
point
- n-dimension point of the space- Returns:
- (n-1)-dimension point of the sub-space corresponding to the specified space point
- See Also:
-
toSpace
Transform a sub-space point into a space point.- Specified by:
toSpace
in interfaceEmbedding<Euclidean3D,
Euclidean1D> - Parameters:
point
- (n-1)-dimension point of the sub-space- Returns:
- n-dimension point of the space corresponding to the specified sub-space point
- See Also:
-
isSimilarTo
Check if the instance is similar to another line.Lines are considered similar if they contain the same points. This does not mean they are equal since they can have opposite directions.
- Parameters:
line
- line to which instance should be compared- Returns:
- true if the lines are similar
-
contains
Check if the instance contains a point.- Parameters:
p
- point to check- Returns:
- true if p belongs to the line
-
distance
Compute the distance between the instance and a point.- Parameters:
p
- to check- Returns:
- distance between the instance and the point
-
distance
Compute the shortest distance between the instance and another line.- Parameters:
line
- line to check against the instance- Returns:
- shortest distance between the instance and the line
-
closestPoint
Compute the point of the instance closest to another line.- Parameters:
line
- line to check against the instance- Returns:
- point of the instance closest to another line
-
intersection
Get the intersection point of the instance and another line.- Parameters:
line
- other line- Returns:
- intersection point of the instance and the other line or null if there are no intersection points
-
wholeLine
Build a sub-line covering the whole line.- Returns:
- a sub-line covering the whole line
-