Package com.solibri.geometry.primitive2d
Interface Segment2d
- All Known Subinterfaces:
- MSegment2d
public interface Segment2d
Read-only interface for handling segments in the XY-plane.
- Since:
- 9.10.2
- 
Method SummaryModifier and TypeMethodDescriptionclosestPointTo(Vector2d point) Returns the point on this segment that is closest to the given point in the XY-plane.booleanReturns true if the given point lies on this segment in the XY-plane, otherwise returns false.static Segment2dCreates an new instance.doubleReturns the minimum distance between this segment and the point in the XY-plane.doubleReturns the minimum distance in the XY-plane between this and the given segment.doubledistanceSquared(Vector2d point) Returns the square of the minimum distance between this segment and the point in the XY-plane.doubledistanceSquared(Segment2d other) Returns the square of the minimum distance in the XY-plane between this and the given segment.default booleanequalsWithTolerance(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.Returns the end of the segment in the XY-plane.default doubleReturns the length of the segment in 2 dimensions.default doubleReturns the square of the length of the segment in 2 dimensions.Returns the beginning of the segment in the XY-plane.Returns the point of intersection between this segment and other in the XY-plane.default booleanintersects(Segment2d other) Returns true if this segment and other intersect in the XY-plane, otherwise returns false.static Comparator<Segment2d>Returns a comparator that compares non-null Segments by their length in the XY-plane.sample(int amount) Samples the given amount of points from the segment.shortestSegmentBetween(Segment2d segment) Returns the shortest segment from this segment to the given segment in the XY-plane.
- 
Method Details- 
createCreates an new instance.- Parameters:
- startPoint- the start point
- endPoint- the end point
- Returns:
- the newly created instance
- Since:
- 9.10.2
 
- 
getStartPointVector2d getStartPoint()Returns the beginning of the segment in the XY-plane.- Returns:
- the beginning of the segment in the XY-plane
- Since:
- 9.10.2
 
- 
getEndPointVector2d getEndPoint()Returns the end of the segment in the XY-plane.- Returns:
- the end of the segment in the XY-plane.
- Since:
- 9.10.2
 
- 
getLengthSquareddefault double getLengthSquared()Returns the square of the length of the segment in 2 dimensions.- Returns:
- the square of the length of the segment in 2 dimensions
- Since:
- 9.10.2
 
- 
getLengthdefault double getLength()Returns the length of the segment in 2 dimensions.- Returns:
- the length of the segment in 2 dimensions
- Since:
- 9.10.2
 
- 
distanceSquaredReturns the square of the minimum distance between this segment and the point in the XY-plane.- Parameters:
- point- the point to which the square of the distance is computed
- Returns:
- the square of the minimum distance between this segment and the point in the XY-plane
- Since:
- 9.10.2
 
- 
distanceReturns the minimum distance between this segment and the point in the XY-plane.- Parameters:
- point- the point to which the distance is computed
- Returns:
- the minimum distance between this segment and the point in the XY-plane
- Since:
- 9.10.2
 
- 
closestPointToReturns the point on this segment that is closest to the given point in the XY-plane. The Z component of the returned vector is set to 0.- Parameters:
- point- the point in the XY-plane for which the closest point on this Segment is computed
- Returns:
- the point on this segment that is closest to the given point in the XY-plane
- Since:
- 9.10.2
 
- 
distanceSquaredReturns the square of the minimum distance in the XY-plane between this and the given segment.- Parameters:
- other- the segment to which the square of distance is computed
- Returns:
- the square of the minimum distance in the XY-plane between this and the given segment
- Since:
- 9.10.2
 
- 
distanceReturns the minimum distance in the XY-plane between this and the given segment.- Parameters:
- other- the segment to which the distance is computed
- Returns:
- the minimum distance in the XY-plane between this and the given segment
- Since:
- 9.10.2
 
- 
intersectsReturns true if this segment and other intersect in the XY-plane, otherwise returns false.- Parameters:
- other- the segment that is checked for intersection
- Returns:
- true if this segment and other intersect in the XY-plane, otherwise returns false
- Since:
- 9.10.2
 
- 
intersectReturns the point of intersection between this segment and other in the XY-plane. If segments do not intersect returns null. Theintersect(Segment2d)method can be used for checking if segments intersect. The returned vector has its Z component set to 0.- Parameters:
- other- the segment with which the intersection point is computed
- Returns:
- an optional that contains the point of intersection between this segment and other in the XY-plane if it exists or an empty optional null if the segments do not intersect
- Since:
- 9.10.2
 
- 
containsReturns true if the given point lies on this segment in the XY-plane, otherwise returns false.- Parameters:
- point- the point that is checked for being located on this segment
- Returns:
- true if the given point lies on this segment in the XY-plane, otherwise returns false
- Since:
- 9.10.2
 
- 
sampleSamples the given amount of points from the segment. The start and end point are not included in the sample. If an amount of zero or less is given, an empty list is returned.- Parameters:
- amount- the amount of samples
- Returns:
- the samples as a list from start point towards the end point
 
- 
equalsWithToleranceReturns 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.- Parameters:
- other- the segment that is checked for equality within tolerance
- tolerance- the allowed difference in distance between points
- 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
- Since:
- 9.10.2
 
- 
shortestSegmentBetweenReturns the shortest segment from this segment to the given segment in the XY-plane. The returned Segment is not unique if the given Segment instances are parallel. If the segments intersect, then the ends of the returned segment will be equal.- Parameters:
- segment- the target segment for the returned segment
- Returns:
- the shortest segment from this segment to the given segment
- Since:
- 9.10.2
 
- 
lengthComparatorReturns a comparator that compares non-null Segments by their length in the XY-plane. The longer segment is considered to be greater in the ordering defined by the comparator returned by this method. This can be used for sorting Segments by length.- Returns:
- comparator that compares segments by length
- Since:
- 9.10.2
 
 
-