Convex Polygons Counter-Clockwise Points

A convex polygon (aka Convex Hull) has no angles pointing inwards. More precisely, no internal angles can be more than 180 degrees. Polygons should have their points arranged counter-clockwise(CCW). This will assure various computations are consistant. This example arranges a group of points so they are CCW, and builds the resultatnt polygon. (It also extracts any points that would create a concave polygon.) Computes the convex hull(polygon) using the "Graham scan" method.
Non-Contiguous Coordinates
0
1
2
3
4
5
6

Polygon CCW Coordinates
0
1
2
3
4
5
6

SVG Source:
Javascript: