ComputationalGeometry
PointOrientation
determine the orientation of points accurately
Calling Sequence
Parameters
Description
Examples
Compatibility
PointOrientation( P1, P2, P3 )
PointOrientation( P1, P2, P3, P4 )
PointOrientation( A, pos )
Pn
-
three points in real 2-D or four points in real 3-D space given as lists or rtables of their coordinates
A
an array of point coordinates in 2-D or 3-D space. Each point is a row in the array. A must be C_order and datatype=float[8]
pos
positive integer indices of the three or four rows of A to treat as input
This command returns a string describing the orientation of the points.
In dimension two, if the third point is on the left side of the ray starting at the first point and going through the second point then the points are in counterclockwise orientation and the command returns "ccw". If the third point is on the right then "cw" is returned. If the three points are on a line then "degenerate" is returned.
The check is done by carefully computing the signed area of the triangle formed by the three points.
In dimension three, the command returns "ccw" if the fourth point is below the plane defined by the first three and "cw" if it is above (using a right-hand rule for plane orientation). If the first three points are on a line, or the fourth point lies on the plane, then "degenerate" is returned.
The last calling sequence is designed for checking large collections of points without having to make copies of their values.
with⁡ComputationalGeometry:
a≔0,0;b≔1,1;c≔0.4,0.8;d≔0.8,0.4;e≔0.5,0.5
a≔0,0
b≔1,1
c≔0.4,0.8
d≔0.8,0.4
e≔0.5,0.5
plots:-display⁡plottools:-point⁡a,b,c,d,e,symbolsize=20,plots:-textplot⁡c,c,align=above,left,plots:-textplot⁡d,d,align=below,right,plots:-textplot⁡e,e,align=above,left,plottools:-arrow⁡a,b,0.001,0.025,0.05,axes=box
PointOrientation⁡a,b,c
ccw
PointOrientation⁡a,b,d
cw
PointOrientation⁡a,b,e
degenerate
A≔Array⁡a,b,c,d,e,datatype=float8,order=C_order
A≔0.0.1.1.0.4000000000000000.8000000000000000.8000000000000000.4000000000000000.5000000000000000.500000000000000
PointOrientation⁡A,1,2,5
Points in three dimensions
a≔0,0,0;b≔1,1,0;c≔0.4,0.8,0
a≔0,0,0
b≔1,1,0
c≔0.4,0.8,0
d≔0.8,0.4,−1;e≔0.5,0.5,1;f≔0.5,0.5,0
d≔0.8,0.4,−1
e≔0.5,0.5,1
f≔0.5,0.5,0
plots:-display⁡plottools:-point⁡a,b,c,d,e,f,symbolsize=20,plots:-textplot⁡a,a,b,b,c,c,d,d,e,e,f,f,dimension=3,align=left,above,plottools:-polygon⁡−0.1,−0.1,0,1.1,−0.1,0,1.1,1.1,0,−0.1,1.1,0,color=Green,plots:-arrow⁡a,0,0,0.4,axes=box
PointOrientation⁡a,b,c,d
PointOrientation⁡a,b,c,e
PointOrientation⁡a,b,c,f
PointOrientation⁡a,b,f,e
The ComputationalGeometry[PointOrientation] command was introduced in Maple 2019.
For more information on Maple 2019 changes, see Updates in Maple 2019.
See Also
ComputationalGeometry[PointInCircle]
Download Help Document