testXYPolygonTurningDirections MethodStatic

Test the direction of turn at the vertices of the polygon, ignoring z-coordinates.

  • For a polygon without self-intersections and successive colinear edges, this is a convexity and orientation test: all positive is convex and counterclockwise, all negative is convex and clockwise.
  • Beware that a polygon which turns through more than a full turn can cross itself and close, but is not convex.

testXYPolygonTurningDirections(points: Point3d[] | Point2d[]): number

Parameter Type Description
points Point3d[] | Point2d[]  

Returns - number

1 if all turns are to the left, -1 if all to the right, and 0 if there are any zero or reverse turns

Defined in

Last Updated: 20 June, 2023