Example

Polygon Winding

geometric.polygonWind(polygon[, order]) returns a polygon in the specified winding order. If an order string is passed as either "cw" or "clockwise", returns a polygon with a clockwise winding order. Otherwise, returns a polygon with a counter-clockwise winding order. Returns null if the polygon has fewer than three points.

Uses the convention that a polygon with a negative signed area has a clockwise winding order, and a polygon with a positive signed area has a counter-clockwise winding order. As a result, the winding order will appear reversed on computer screens where the y-axis is reversed (i.e. 0 is on top rather than on bottom).

Draw a polygon, choose the winding order, and inspect the numbered vertices returned by polygonWind.

Vertices

5

Signed area

26016

0011223344

Code