Segment2D
Properties
Indicates if the two endpoints coincide (= segment has zero length).
Indicates if the segment is aligned to the x-axis, this is true if isDegenerate.
Indicates if the segment is aligned to the y-axis, this is true if isDegenerate.
Functions
Finds the point of the segment which is closest to the provided point.
Computes the shortest distance between the segment and the given point.
Computes the shortest distance between two segments (= the shortest distance between any two of their points).
Intersects a segment and a circle.
Checks if two segments lie on a single line.
Checks if two segments are parallel. Throws an UnsupportedOperationException if any of the two segment isDegenerate.
Checks if two segments overlap (= are collinear and share one or more points).
Maps the segment a ClosedRange, this is done by extracting either the X coordinates or the Y coordinates of the two endpoints of the segment. getXCoords indicates which pair of coordinates should be extracted (defaults to isHorizontal). This can be useful e.g. to represent portions of axis-aligned segments without creating new ones.