ComputationalGeometry - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Geometry : Computational Geometry : ComputationalGeometry/SegmentsIntersect

ComputationalGeometry

  

SegmentsIntersect

  

determine if two line segments intersect

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

SegmentsIntersect( L1, L2 )

SegmentsIntersect( L1, L2, intersection )

SegmentsIntersect( M, locs )

SegmentsIntersect( M, locs, intersection )

Parameters

L1, L2

-

line segments given as pairs of points in 2-D space

M

-

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[8]

locs

-

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

Description

• 

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.

Examples

withComputationalGeometry:

SegmentsIntersect0,0,1,1,0,1,1,0

true

(1)

L1,0,1,5:

K1,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:-displayplottools:-lineL,legend=L,color=Red,seqplottools:-lineKi,legend=K i,color=Blue,i=1..7,seqplottools:-lineKi,legend=K i,color=Green,i=8..14,axes=boxed

None of the blue segments intersect L

seqSegmentsIntersectL,Ki,i=1..7

false

(2)

All of the green segments intersect L

seqSegmentsIntersectL,Ki,i=8..14

true

(3)

MArrayL,seqk,kinK,datatype=float8,order=C_order

(4)

SegmentsIntersectM,1,2,3,4,intersection

false

(5)

SegmentsIntersectM,1,2,25,26,intersection

1.2.

(6)

Line 11, completely contained in L

SegmentsIntersectM,1,2,23,24,intersection

1.2.50000000000000,1.3.50000000000000

(7)

Line 14, partially overlaps L

SegmentsIntersectM,1,2,29,30,intersection

1.0.,1.0.500000000000000

(8)

Compatibility

• 

The ComputationalGeometry[SegmentsIntersect] command was introduced in Maple 2019.

• 

For more information on Maple 2019 changes, see Updates in Maple 2019.

See Also

ComputationalGeometry[PointOrientation]