public interface Segment2d
Modifier and Type | Method and Description |
---|---|
MVector2d |
closestPointTo(Vector2d point)
Returns the point on this segment that is closest to the given point in
the XY-plane.
|
boolean |
contains(Vector2d point)
Returns true if the given point lies on this segment in the XY-plane,
otherwise returns false.
|
static Segment2d |
create(Vector2d startPoint,
Vector2d endPoint)
Creates an new instance.
|
double |
distance(Segment2d other)
Returns the minimum distance in the XY-plane between this and the given
segment.
|
double |
distance(Vector2d point)
Returns the minimum distance between this segment and the point in the
XY-plane.
|
double |
distanceSquared(Segment2d other)
Returns the square of the minimum distance in the XY-plane between this
and the given segment.
|
double |
distanceSquared(Vector2d point)
Returns the square of the minimum distance between this segment and the
point in the XY-plane.
|
default boolean |
equalsWithTolerance(Segment2d other,
double tolerance)
Returns true if the start and end points of this segment are within
tolerance of the start and end points of other in the XY-plane.
|
Vector2d |
getEndPoint()
Returns the end of the segment in the XY-plane.
|
default double |
getLength()
Returns the length of the segment in 2 dimensions.
|
default double |
getLengthSquared()
Returns the square of the length of the segment in 2 dimensions.
|
Vector2d |
getStartPoint()
Returns the beginning of the segment in the XY-plane.
|
Optional<MVector2d> |
intersect(Segment2d other)
Returns the point of intersection between this segment and other in the
XY-plane.
|
default boolean |
intersects(Segment2d other)
Returns true if this segment and other intersect in the XY-plane,
otherwise returns false.
|
static Comparator<Segment2d> |
lengthComparator()
Returns a comparator that compares non-null Segments by their length in
the XY-plane.
|
default List<MVector2d> |
sample(int amount)
Samples the given amount of points from the segment.
|
Segment2d |
shortestSegmentBetween(Segment2d segment)
Returns the shortest segment from this segment to the given segment in the XY-plane.
|
static Segment2d create(Vector2d startPoint, Vector2d endPoint)
startPoint
- the start pointendPoint
- the end pointVector2d getStartPoint()
Vector2d getEndPoint()
default double getLengthSquared()
default double getLength()
double distanceSquared(Vector2d point)
point
- the point to which the square of the distance is computeddouble distance(Vector2d point)
point
- the point to which the distance is computedMVector2d closestPointTo(Vector2d point)
point
- the point in the XY-plane for which the closest point on
this Segment is computeddouble distanceSquared(Segment2d other)
other
- the segment to which the square of distance is computeddouble distance(Segment2d other)
other
- the segment to which the distance is computeddefault boolean intersects(Segment2d other)
other
- the segment that is checked for intersectionOptional<MVector2d> intersect(Segment2d other)
intersect(Segment2d)
method can be used for checking if segments
intersect. The returned vector has its Z component set to 0.other
- the segment with which the intersection point is computedboolean contains(Vector2d point)
point
- the point that is checked for being located on this segmentdefault List<MVector2d> sample(int amount)
amount
- the amount of samplesdefault boolean equalsWithTolerance(Segment2d other, double tolerance)
other
- the segment that is checked for equality within tolerancetolerance
- the allowed difference in distance between pointsSegment2d shortestSegmentBetween(Segment2d segment)
segment
- the target segment for the returned segmentstatic Comparator<Segment2d> lengthComparator()
Copyright © 2019 Solibri, Inc.. All rights reserved.