determine if two line segments intersect
SegmentsIntersect( L1, L2 )
SegmentsIntersect( L1, L2, intersection )
SegmentsIntersect( M, locs )
SegmentsIntersect( M, locs, intersection )
line segments given as pairs of points in 2-D space
an array of point coordinates in 2-D space. Each point is a row in the array. M must be C_order and datatype=float
positive integer indices of the three rows of M to treat as input the first location is the point and the other two the ends of the segment
This command returns true if the two line segments intersect and false if they do not. It does so using four calls to PointOrientation.
If the intersection option is given and the segments do not intersect false will be returned, otherwise the coordinate of the intersection will be returned.
If one segment is completely contained within the other, the list of endpoints of the smaller segment will be returned.
L ≔ 1,0,1,5:
K ≔ 1,−2,1,−1,0,1,0,3,2,1,2,3,1,6.5,1,8,1,6,1.5,8,0.5,4,1.5,7,0.5,0.5,1,−0.75,1,5,1.5,6,1,4.5,1.5,5,0.5,3.75,1.5,3.5,1,2.5,1,3.5,0.5,1.5,1,2,1,0,1.5,−2,1,0.5,1,−0.5:
plots:-display⁡plottools:-line⁡L,legend=L,color=Red,seq⁡plottools:-line⁡Ki,legend=K ||i,color=Blue,i=1..7,seq⁡plottools:-line⁡Ki,legend=K ||i,color=Green,i=8..14,axes=boxed
None of the blue segments intersect L
All of the green segments intersect L
M ≔ Array⁡L,seq⁡k,k∈K,datatype=float8,order=C_order
Line 11, completely contained in L
Line 14, partially overlaps L
The ComputationalGeometry[SegmentsIntersect] command was introduced in Maple 2019.
For more information on Maple 2019 changes, see Updates in Maple 2019.
Download Help Document
What kind of issue would you like to report? (Optional)