public interface FrameLineSegment3DReadOnly extends LineSegment3DReadOnly, ReferenceFrameHolder
A line segment 3D is a finite-length line defined in the XY-plane by its two 3D endpoints.
In addition to representing a LineSegment3DReadOnly
, a ReferenceFrame
is
associated to a FrameLineSegment3DReadOnly
. This allows, for instance, to enforce, at
runtime, that operations on lines occur in the same coordinate system.
Because a FrameLineSegment3DReadOnly
extends LineSegment3DReadOnly
, it is
compatible with methods only requiring LineSegment3DReadOnly
. However, these methods do
NOT assert that the operation occur in the proper coordinate system. Use this feature carefully
and always prefer using methods requiring FrameLineSegment3DReadOnly
.
Modifier and Type | Method and Description |
---|---|
default double |
distance(FrameLineSegment3DReadOnly frameLineSegment3DReadOnly)
This methods computes the minimum distance between this line segment and the given one.
|
default double |
distance(FramePoint3DReadOnly point)
Returns the minimum distance between a point and this given line segment.
|
default double |
distanceSquared(FramePoint3DReadOnly point)
Returns the square of the minimum distance between a point and this given line segment.
|
default double |
dotProduct(FrameLineSegment3DReadOnly other)
Computes the dot product of this line segment with the other line segment such that:
this ·
other = Math.cos( α) * this.length() * other.length() where α is the angle from this to the other line segment. |
default boolean |
epsilonEquals(FrameLineSegment3DReadOnly other,
double epsilon)
Tests on a per-component basis on both endpoints if this line segment is equal to
other
with the tolerance epsilon . |
default boolean |
equals(FrameLineSegment3DReadOnly other)
Tests on a per component basis, if this line segment 3D is exactly equal to
other . |
default boolean |
geometricallyEquals(FrameLineSegment3DReadOnly other,
double epsilon)
Compares
this to other to determine if the two lines are geometrically similar. |
default void |
get(FixedFramePoint3DBasics firstEndpointToPack,
FixedFramePoint3DBasics secondEndpointToPack)
Gets the endpoints defining this line segment by storing their coordinates in the given
arguments.
|
default void |
get(FixedFramePoint3DBasics firstEndpointToPack,
us.ihmc.euclid.tuple3D.interfaces.Point3DBasics secondEndpointToPack)
Gets the endpoints defining this line segment by storing their coordinates in the given
arguments.
|
default void |
get(FramePoint3DBasics firstEndpointToPack,
FramePoint3DBasics secondEndpointToPack)
Gets the endpoints defining this line segment by storing their coordinates in the given
arguments.
|
default void |
get(FramePoint3DBasics firstEndpointToPack,
us.ihmc.euclid.tuple3D.interfaces.Point3DBasics secondEndpointToPack)
Gets the endpoints defining this line segment by storing their coordinates in the given
arguments.
|
default void |
get(us.ihmc.euclid.tuple3D.interfaces.Point3DBasics firstEndpointToPack,
FixedFramePoint3DBasics secondEndpointToPack)
Gets the endpoints defining this line segment by storing their coordinates in the given
arguments.
|
default void |
get(us.ihmc.euclid.tuple3D.interfaces.Point3DBasics firstEndpointToPack,
FramePoint3DBasics secondEndpointToPack)
Gets the endpoints defining this line segment by storing their coordinates in the given
arguments.
|
default FrameVector3DBasics |
getDirection(boolean normalize)
Computes the vector going from the first to the second endpoint of this line segment.
|
default void |
getDirection(boolean normalize,
FixedFrameVector3DBasics directionToPack)
Computes the vector going from the first to the second endpoint of this line segment.
|
default void |
getDirection(boolean normalize,
FrameVector3DBasics directionToPack)
Computes the vector going from the first to the second endpoint of this line segment.
|
FramePoint3DReadOnly |
getFirstEndpoint()
Gets the read-only reference to the first endpoint of this line segment.
|
FramePoint3DReadOnly |
getSecondEndpoint()
Gets the read-only reference to the second endpoint of this line segment.
|
default boolean |
isBetweenEndpoints(FramePoint3DReadOnly point)
Tests whether the projection of the given point onto this line segment is located between the two
endpoints or exactly on an endpoint.
|
default boolean |
isBetweenEndpoints(FramePoint3DReadOnly point,
double epsilon)
Tests whether the projection of the given point onto this line segment is located between the two
endpoints with a given conservative tolerance
epsilon :
if epsilon > 0 , the point has to be between the endpoints and at a minimum distance
of epsilon * this.length() from the closest endpoint. |
default FramePoint3DBasics |
midpoint()
Computes the coordinates of the point located exactly at the middle of this line segment.
|
default void |
midpoint(FixedFramePoint3DBasics midpointToPack)
Computes the coordinates of the point located exactly at the middle of this line segment.
|
default void |
midpoint(FramePoint3DBasics midpointToPack)
Computes the coordinates of the point located exactly at the middle of this line segment.
|
default boolean |
orthogonalProjection(FixedFramePoint3DBasics pointToProject)
Computes the orthogonal projection of a 3D point on this 3D line segment.
|
default boolean |
orthogonalProjection(FramePoint3DReadOnly pointToProject,
FixedFramePoint3DBasics projectionToPack)
Computes the orthogonal projection of a 3D point on this 3D line segment.
|
default boolean |
orthogonalProjection(FramePoint3DReadOnly pointToProject,
FramePoint3DBasics projectionToPack)
Computes the orthogonal projection of a 3D point on this 3D line segment.
|
default boolean |
orthogonalProjection(FramePoint3DReadOnly pointToProject,
us.ihmc.euclid.tuple3D.interfaces.Point3DBasics projectionToPack)
Computes the orthogonal projection of a 3D point on this 3D line segment.
|
default boolean |
orthogonalProjection(us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly pointToProject,
FixedFramePoint3DBasics projectionToPack)
Computes the orthogonal projection of a 3D point on this 3D line segment.
|
default boolean |
orthogonalProjection(us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly pointToProject,
FramePoint3DBasics projectionToPack)
Computes the orthogonal projection of a 3D point on this 3D line segment.
|
default FramePoint3DBasics |
orthogonalProjectionCopy(FramePoint3DReadOnly pointToProject)
Computes the orthogonal projection of a 3D point on this 3D line segment.
|
default FramePoint3DBasics |
orthogonalProjectionCopy(us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly pointToProject)
Computes the orthogonal projection of a 3D point on this 3D line segment.
|
default double |
percentageAlongLineSegment(FramePoint3DReadOnly point)
Computes a percentage along the line segment representing the location of the given point once
projected onto this line segment.
|
default FramePoint3DBasics |
pointBetweenEndpointsGivenPercentage(double percentage)
Computes the coordinates of the point located at a given percentage on this line segment:
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage) |
default void |
pointBetweenEndpointsGivenPercentage(double percentage,
FixedFramePoint3DBasics pointToPack)
Computes the coordinates of the point located at a given percentage on this line segment:
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage) |
default void |
pointBetweenEndpointsGivenPercentage(double percentage,
FramePoint3DBasics pointToPack)
Computes the coordinates of the point located at a given percentage on this line segment:
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage) |
default FramePoint3DBasics |
pointOnLineGivenPercentage(double percentage)
Computes the coordinates of the point located on the line this line segment is lying on:
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage) |
default void |
pointOnLineGivenPercentage(double percentage,
FixedFramePoint3DBasics pointToPack)
Computes the coordinates of the point located on the line this line segment is lying on:
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage) |
default void |
pointOnLineGivenPercentage(double percentage,
FramePoint3DBasics pointToPack)
Computes the coordinates of the point located on the line this line segment is lying on:
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage) |
distance, distance, distanceSquared, dotProduct, epsilonEquals, equals, firstEndpointContainsNaN, geometricallyEquals, get, getDirection, getFirstEndpointX, getFirstEndpointY, getFirstEndpointZ, getSecondEndpointX, getSecondEndpointY, getSecondEndpointZ, isBetweenEndpoints, isBetweenEndpoints, isBetweenEndpoints, length, lengthSquared, midpoint, orthogonalProjection, orthogonalProjection, percentageAlongLineSegment, percentageAlongLineSegment, pointBetweenEndpointsGivenPercentage, pointOnLineGivenPercentage, secondEndpointContainsNaN
checkReferenceFrameMatch, checkReferenceFrameMatch, getReferenceFrame
FramePoint3DReadOnly getFirstEndpoint()
getFirstEndpoint
in interface LineSegment3DReadOnly
FramePoint3DReadOnly getSecondEndpoint()
getSecondEndpoint
in interface LineSegment3DReadOnly
default void get(FixedFramePoint3DBasics firstEndpointToPack, us.ihmc.euclid.tuple3D.interfaces.Point3DBasics secondEndpointToPack)
firstEndpointToPack
- point in which the coordinates of this line segment's first endpoint
are stored. Modified.secondEndpointToPack
- point in which the coordinates of this line segment's second endpoint
are stored. Modified.ReferenceFrameMismatchException
- if this
and firstEndpointToPack
are not
expressed in the same reference frame.default void get(FramePoint3DBasics firstEndpointToPack, us.ihmc.euclid.tuple3D.interfaces.Point3DBasics secondEndpointToPack)
firstEndpointToPack
- point in which the coordinates of this line segment's first endpoint
are stored. Modified.secondEndpointToPack
- point in which the coordinates of this line segment's second endpoint
are stored. Modified.default void get(us.ihmc.euclid.tuple3D.interfaces.Point3DBasics firstEndpointToPack, FixedFramePoint3DBasics secondEndpointToPack)
firstEndpointToPack
- point in which the coordinates of this line segment's first endpoint
are stored. Modified.secondEndpointToPack
- point in which the coordinates of this line segment's second endpoint
are stored. Modified.ReferenceFrameMismatchException
- if this
and secondEndpointToPack
are not
expressed in the same reference frame.default void get(us.ihmc.euclid.tuple3D.interfaces.Point3DBasics firstEndpointToPack, FramePoint3DBasics secondEndpointToPack)
firstEndpointToPack
- point in which the coordinates of this line segment's first endpoint
are stored. Modified.secondEndpointToPack
- point in which the coordinates of this line segment's second endpoint
are stored. Modified.default void get(FixedFramePoint3DBasics firstEndpointToPack, FixedFramePoint3DBasics secondEndpointToPack)
firstEndpointToPack
- point in which the coordinates of this line segment's first endpoint
are stored. Modified.secondEndpointToPack
- point in which the coordinates of this line segment's second endpoint
are stored. Modified.ReferenceFrameMismatchException
- if this
, firstEndpointToPack
, and
secondEndpointToPack
are not expressed in the same reference frame.default void get(FramePoint3DBasics firstEndpointToPack, FramePoint3DBasics secondEndpointToPack)
firstEndpointToPack
- point in which the coordinates of this line segment's first endpoint
are stored. Modified.secondEndpointToPack
- point in which the coordinates of this line segment's second endpoint
are stored. Modified.default FrameVector3DBasics getDirection(boolean normalize)
getDirection
in interface LineSegment3DReadOnly
normalize
- whether the direction vector is to be normalized.directionToPack
- vector in which the direction is stored. Modified.default void getDirection(boolean normalize, FixedFrameVector3DBasics directionToPack)
normalize
- whether the direction vector is to be normalized.directionToPack
- vector in which the direction is stored. Modified.ReferenceFrameMismatchException
- if this
and directionToPack
are not
expressed in the same reference frame.default void getDirection(boolean normalize, FrameVector3DBasics directionToPack)
normalize
- whether the direction vector is to be normalized.directionToPack
- vector in which the direction is stored. Modified.default double distanceSquared(FramePoint3DReadOnly point)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method
returns the distance between firstEndpoint
and the given point
.
point
- 3D point to compute the distance from this line segment. Not modified.ReferenceFrameMismatchException
- if this
and point
are not expressed in
the same reference frame.default double distance(FramePoint3DReadOnly point)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method
returns the distance between firstEndpoint
and the given point
.
point
- 3D point to compute the distance from this line segment. Not modified.ReferenceFrameMismatchException
- if this
and point
are not expressed in
the same reference frame.default double distance(FrameLineSegment3DReadOnly frameLineSegment3DReadOnly)
frameLineSegment3DReadOnly
- the other line segment to compute the distance from. Not
modified.ReferenceFrameMismatchException
- if this
and frameLineSegment3DReadOnly
are not expressed in the same reference frame.default FramePoint3DBasics orthogonalProjectionCopy(us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly pointToProject)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method returns
firstEndpoint
.
WARNING: This method generates garbage.
orthogonalProjectionCopy
in interface LineSegment3DReadOnly
pointToProject
- the point to compute the projection of. Not modified.null
if the method failed.default FramePoint3DBasics orthogonalProjectionCopy(FramePoint3DReadOnly pointToProject)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method returns
firstEndpoint
.
WARNING: This method generates garbage.
pointToProject
- the point to compute the projection of. Not modified.null
if the method failed.ReferenceFrameMismatchException
- if this
and pointToProject
are not
expressed in the same reference frame.default boolean orthogonalProjection(FixedFramePoint3DBasics pointToProject)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method returns
firstEndpoint
.
pointToProject
- the point to project on this line segment. Modified.ReferenceFrameMismatchException
- if this
and pointToProject
are not
expressed in the same reference frame.default boolean orthogonalProjection(FramePoint3DReadOnly pointToProject, us.ihmc.euclid.tuple3D.interfaces.Point3DBasics projectionToPack)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method returns
firstEndpoint
.
pointToProject
- the point to compute the projection of. Not modified.projectionToPack
- point in which the projection of the point onto this line segment is
stored. Modified.ReferenceFrameMismatchException
- if this
and pointToProject
are not
expressed in the same reference frame.default boolean orthogonalProjection(us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly pointToProject, FixedFramePoint3DBasics projectionToPack)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method returns
firstEndpoint
.
pointToProject
- the point to compute the projection of. Not modified.projectionToPack
- point in which the projection of the point onto this line segment is
stored. Modified.ReferenceFrameMismatchException
- if this
and pointToProject
are not
expressed in the same reference frame.default boolean orthogonalProjection(us.ihmc.euclid.tuple3D.interfaces.Point3DReadOnly pointToProject, FramePoint3DBasics projectionToPack)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method returns
firstEndpoint
.
pointToProject
- the point to compute the projection of. Not modified.projectionToPack
- point in which the projection of the point onto this line segment is
stored. Modified.default boolean orthogonalProjection(FramePoint3DReadOnly pointToProject, FixedFramePoint3DBasics projectionToPack)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method returns
firstEndpoint
.
pointToProject
- the point to compute the projection of. Not modified.projectionToPack
- point in which the projection of the point onto this line segment is
stored. Modified.ReferenceFrameMismatchException
- if this
, pointToProject
and
projectionToPack
are not expressed in the same reference frame.default boolean orthogonalProjection(FramePoint3DReadOnly pointToProject, FramePoint3DBasics projectionToPack)
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method returns
firstEndpoint
.
pointToProject
- the point to compute the projection of. Not modified.projectionToPack
- point in which the projection of the point onto this line segment is
stored. Modified.ReferenceFrameMismatchException
- if this
and pointToProject
are not
expressed in the same reference frame.default boolean isBetweenEndpoints(FramePoint3DReadOnly point)
point
- the query. Not modified.true
if the projection of the point is between the endpoints of this line
segment, false
otherwise.ReferenceFrameMismatchException
- if this
and point
are not expressed in
the same reference frame.default boolean isBetweenEndpoints(FramePoint3DReadOnly point, double epsilon)
epsilon
:
epsilon > 0
, the point has to be between the endpoints and at a minimum distance
of epsilon * this.length()
from the closest endpoint.
epsilon < 0
, the point has to be between the endpoints or at a maximum distance of
-epsilon * this.length()
from the closest endpoint.
epsilon = 0
, the point has to be between the endpoints or equal to one of the
endpoints.
point
- the query. Not modified.epsilon
- the tolerance to use.true
if the projection of the point is between the endpoints of this line
segment, false
otherwise.ReferenceFrameMismatchException
- if this
and point
are not expressed in
the same reference frame.default double percentageAlongLineSegment(FramePoint3DReadOnly point)
0.0
representing firstEndpoint
, and 1.0
representing
secondEndpoint
.
For example, if the returned percentage is 0.5
, it means that the projection of the given
point is located at the middle of this line segment. The coordinates of the projection of the
point can be computed from the percentage
as follows:
Point3D projection = new Point3D();
projection.interpolate(lineSegmentStart, lineSegmentEnd, percentage);
Edge cases:
this.lengthSquared() <
EuclidGeometryTools.ONE_TRILLIONTH
, this method fails and
returns 0.0
.
point
- the query point. Not modified.ReferenceFrameMismatchException
- if this
and point
are not expressed in
the same reference frame.default FramePoint3DBasics pointBetweenEndpointsGivenPercentage(double percentage)
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage)
pointBetweenEndpointsGivenPercentage
in interface LineSegment3DReadOnly
percentage
- the percentage along this line segment of the point. Must be in [0, 1].pointToPack
- where the result is stored. Modified.{@link
- RuntimeException} if percentage
∉ [0, 1].ReferenceFrameMismatchException
- if this
and pointToPack
are not expressed
in the same reference frame.default void pointBetweenEndpointsGivenPercentage(double percentage, FixedFramePoint3DBasics pointToPack)
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage)
percentage
- the percentage along this line segment of the point. Must be in [0, 1].pointToPack
- where the result is stored. Modified.{@link
- RuntimeException} if percentage
∉ [0, 1].ReferenceFrameMismatchException
- if this
and pointToPack
are not expressed
in the same reference frame.default void pointBetweenEndpointsGivenPercentage(double percentage, FramePoint3DBasics pointToPack)
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage)
percentage
- the percentage along this line segment of the point. Must be in [0, 1].pointToPack
- where the result is stored. Modified.{@link
- RuntimeException} if percentage
∉ [0, 1].default FramePoint3DBasics pointOnLineGivenPercentage(double percentage)
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage)
pointOnLineGivenPercentage
in interface LineSegment3DReadOnly
percentage
- the percentage along this line segment of the point.pointToPack
- where the result is stored. Modified.default void pointOnLineGivenPercentage(double percentage, FixedFramePoint3DBasics pointToPack)
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage)
percentage
- the percentage along this line segment of the point.pointToPack
- where the result is stored. Modified.ReferenceFrameMismatchException
- if this
and pointToPack
are not expressed
in the same reference frame.default void pointOnLineGivenPercentage(double percentage, FramePoint3DBasics pointToPack)
pointToPack.interpolate(firstEndpoint, secondEndpoint, percentage)
percentage
- the percentage along this line segment of the point.pointToPack
- where the result is stored. Modified.default double dotProduct(FrameLineSegment3DReadOnly other)
this
·
other = Math.cos(
α) * this.length() * other.length()
other
- the other line segment used to compute the dot product. Not modified.ReferenceFrameMismatchException
- if this
and other
are not expressed in
the same reference frame.default FramePoint3DBasics midpoint()
midpoint
in interface LineSegment3DReadOnly
midpointToPack
- point in which the mid-point of this line segment is stored. Modified.default void midpoint(FixedFramePoint3DBasics midpointToPack)
midpointToPack
- point in which the mid-point of this line segment is stored. Modified.ReferenceFrameMismatchException
- if this
and midpointToPack
are not
expressed in the same reference frame.default void midpoint(FramePoint3DBasics midpointToPack)
midpointToPack
- point in which the mid-point of this line segment is stored. Modified.default boolean epsilonEquals(FrameLineSegment3DReadOnly other, double epsilon)
other
with the tolerance epsilon
.
If the two line segments have different frames, this method returns false
.
other
- the query. Not modified.epsilon
- the tolerance to use.true
if the two line segments are equal and are expressed in the same reference
frame, false
otherwise.default boolean geometricallyEquals(FrameLineSegment3DReadOnly other, double epsilon)
this
to other
to determine if the two lines are geometrically similar.
Two lines are considered geometrically equal is they are collinear, pointing toward the same or opposite direction.
other
- the line to compare to. Not modified.epsilon
- the tolerance of the comparison.true
if the two lines represent the same geometry, false
otherwise.ReferenceFrameMismatchException
- if this
and other
are not expressed in
the same reference frame.default boolean equals(FrameLineSegment3DReadOnly other)
other
.
If the two line segments have different frames, this method returns false
.
other
- the other line segment 3D to compare against this. Not modified.true
if the two line segments are exactly equal component-wise and are expressed
in the same reference frame, false
otherwise.