convex hull implementation in javascript