PointOnSegment - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ComputationalGeometry

  

PointOnSegment

  

determine if a point lies on a line segment

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

PointOnSegment( P, L )

PointOnSegment( M, locs )

Parameters

P

-

a point in real 2-D space given as a list or rtable of coordinates

L

-

a list of a pair of points giving the ends of the line segment

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 point lies on the line segment and false if it does not.  It first checks if they are collinear using PointOrientation and then checks if the point in within the bounding box given by the endpoints of the line segment.

Examples

withComputationalGeometry:

a0,0;b1,1;c0.4,0.4;d1.1,1.1;e0.5,0.55

a0,0

b1,1

c0.4,0.4

d1.1,1.1

e0.5,0.55

(1)

plots:-displayplottools:-pointa,b,c,d,e,symbolsize=20,plots:-textplotc,c,align=above,left,plots:-textplotd,d,align=below,left,plots:-textplote,e,align=above,left,plottools:-linea,b,axes=box

PointOnSegmentc,a,b

true

(2)

PointOnSegmentd,a,b

false

(3)

PointOnSegmente,a,b

false

(4)

MArraya,b,c,d,e,datatype=float8,order=C_order

M0.0.1.1.0.4000000000000000.4000000000000001.100000000000001.100000000000000.5000000000000000.550000000000000

(5)

PointOnSegmentM,3,1,2

true

(6)

PointOnSegmentM,5,1,2

false

(7)

Compatibility

• 

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

• 

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

See Also

ComputationalGeometry[PointOrientation]