next up previous
Next: Degeneracies Up: Graham's Algorithm Previous: Algorithm's Pseudo-Code

Issues

The algorithm presented assumes two things:

  1. A technique to find an interior point .
  2. The points and have to be extremas (points). For example, if is not an extremal point, the algorithm may not terminate. Similarly if is not an extremal point, it will be popped out of the stack.
Linear time algorithms to compute the interior points are known. However, it is possible to avoid that calculation. Not only is it unnecessary, but it may force the use of floating point numbers, even when all the point coordinates are integers.

To get around the second problem, we modify the algorithm somewhat. The main idea is to compute a point on the hull (say the one with minimal y coordinate). All the points are sorted with respect to this point on the hull. We label the points based on this sorting and use it to initialize two points on the stack.

The modified version of Graham's algorithm is: Algorithm
Find rightmost lowest point; label it .
Sort all other points angularly about ,
break ties in favor of closeness to ;
label .
Stack ; t indexes top
i = 1
while do
if is left of
then Push( and increment i.
else Pop( .

Its complexity is .



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