Implemented convex hull algorithm.