sort

This function can sort points in two different ways. The first one is according to x-coordinate, the other one is according to y-coordinate

var points = Points.sortX(points);
var points = Points.sortY(points);
Warning: This function does not sort visually, after sort operation points[0] is guaranteed to be the smallest.