ComputationalGeometry
PointOnSegment
determine if a point lies on a line segment
Calling Sequence
Parameters
Description
Examples
Compatibility
PointOnSegment( P, L )
PointOnSegment( M, locs )
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
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.
with⁡ComputationalGeometry:
a≔0,0;b≔1,1;c≔0.4,0.4;d≔1.1,1.1;e≔0.5,0.55
a≔0,0
b≔1,1
c≔0.4,0.4
d≔1.1,1.1
e≔0.5,0.55
plots:-display⁡plottools:-point⁡a,b,c,d,e,symbolsize=20,plots:-textplot⁡c,c,align=above,left,plots:-textplot⁡d,d,align=below,left,plots:-textplot⁡e,e,align=above,left,plottools:-line⁡a,b,axes=box
PointOnSegment⁡c,a,b
true
PointOnSegment⁡d,a,b
false
PointOnSegment⁡e,a,b
M≔Array⁡a,b,c,d,e,datatype=float8,order=C_order
M≔0.0.1.1.0.4000000000000000.4000000000000001.100000000000001.100000000000000.5000000000000000.550000000000000
PointOnSegment⁡M,3,1,2
PointOnSegment⁡M,5,1,2
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]
Download Help Document