preprocessing = p => {
  let pivot = p[0];
  for (let i = 1; i < p.length; i++) {
    if (pivot.y > p[i].y || (pivot.y === p[i].y && pivot.x > p[i].x)) {
      pivot = p[i];
    }
  }

  p.sort((a, b) => {
    const area = vectorOp.parallelogramArea(pivot, a, b);
    if (Math.abs(area) < 1e-6) {
      return (
        vectorOp.length(vectorOp.newVector(pivot, a)) -
        vectorOp.length(vectorOp.newVector(pivot, b))
      );
    }
    return -area;
  });
}
@param An array p with N points, each point should be a literal,
example: {x:0,y:0}.

Note: After the preprocessing the points will be ordered by the angle
between the vectors pivot -> pi and (0,1). Where pi is a point on p.
On the counter-clockwise direction.