0

I am trying to implement the giftwrapping algorithm on a set of points to find their convex hull.

It says that the next point in the convex hull is the leftmost point (this is from wikipedia) from the point of view of the last point found. However, I'm not sure as to how you are supposed to find the second point because you only have one point so far.

If the last point found is p' and the one before p' is p'', I thought the newest point would be point p that forms the largest angle with vector (p'',p'). However, when finding the second point, we do not have a p''.

James
  • 706
  • 3
  • 8
  • 16

1 Answers1

1

As seanmcl says, this is not an OCaml question. Reading Wikipedia it looks to me like you're looking for the biggest angle with most recent point pi as center, relative to a line passing through pi, where all points of the hull are on one side of the line (or on the line). For the second point looks like you can use a vertical line (if you start with the leftmost or rightmost point). After that you can use a line through the most recent two points.

Jeffrey Scofield
  • 65,646
  • 2
  • 72
  • 108