next up previous
Next: Algorithm's Pseudo-Code Up: No Title Previous: No Title

Graham's Algorithm

The basic idea of Graham's algorithm is simple. Assume that we are given a point inside the hull, and further assume that no three points in the given set (including ) are collinear. Sort the points by angle, counter clockwise about . The points are now processed in their sorted order, and the hull grown incrementally around the set. At any step, the hull will be correct for the points examined so far. The hull so far is maintained in a stack of points. Initially, the stack contains the first two points in the sorted list, . The next point is added, if the set of three points make a left turn at . This implies that is a convex chain, a condition that will be maintained throughout for all the points in the stack.





Dinesh Manocha
Tue Feb 17 23:44:05 EST 1998