Ranks the slope of a pair of vectors through the origin in clockwise order. This is more robust than comparing their arc tangents using atan2.
First install using npm:
npm install compare-slope
Then use as follows:
var compareSlope =console
a comes before
b in a counter-clockwise ordering.
bare both represented by arrays of at least length 2
bis clockwise from
ais clockwise from
Note: Somewhat arbitrarily, the degenerate point at the origin is ranked before all other points.
(c) 2013 Mikola Lysenko. MIT License