GEOS
3.8.0dev

#include <Orientation.h>
Public Types  
enum  { CLOCKWISE = 1, COLLINEAR = 0, COUNTERCLOCKWISE = 1, RIGHT = 1, LEFT = 1, STRAIGHT = 0 } 
Static Public Member Functions  
static int  index (const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q) 
static bool  isCCW (const geom::CoordinateSequence *ring) 
Functions to compute the orientation of basic geometric structures including point triplets (triangles) and rings. Orientation is a fundamental property of planar geometries (and more generally geometry on twodimensional manifolds).
Orientation is notoriously subject to numerical precision errors in the case of collinear or nearly collinear points. JTS uses extendedprecision arithmetic to increase the robustness of the computation.

static 
Computes whether a ring defined by an array of Coordinates is oriented counterclockwise.
This algorithm is *only<* guaranteed to work with valid rings. If the ring is invalid (e.g. selfcrosses or touches), the computed result may not be correct.
ring  an array of Coordinates forming a ring 
IllegalArgumentException  if there are too few points to determine orientation (< 4) 