gnome.utilities.geometry.poly_clockwise

code for checking if a polygon is cockwise or counter-clockwise

There are two versions:

is_clockwise_convex only works for convex polygons – but is faster, it only needs to check three points.

is_clockwise checks all points, but works for convex and cocave

(note: that’s the same as the area calculation)

from: http://paulbourke.net/geometry/clockwise/

Module Contents

Functions

is_clockwise(poly)

returns True if the polygon is clockwise ordered, false if not

is_clockwise_convex(poly)

returns True if the polygon is clockwise ordered, false if not

gnome.utilities.geometry.poly_clockwise.is_clockwise(poly)

returns True if the polygon is clockwise ordered, false if not

expects a sequence of tuples, or something like it (Nx2 array for instance), of the points:

[ (x1, y1), (x2, y2), (x3, y3), …(xi, yi) ]

See: http://paulbourke.net/geometry/clockwise/

gnome.utilities.geometry.poly_clockwise.is_clockwise_convex(poly)

returns True if the polygon is clockwise ordered, false if not

expects a sequence of tuples, or something like it, of the points:

[ (x1, y1), (x2, y2), (x3, y3), …(xi, yi) ]

This only works for concave polygons. See:

http://paulbourke.net/geometry/clockwise/