6.838, Computational Geometry; Fall 2001

Point Location

Sergi Elizalde & David Pritchard


An Incremental Randomized Algorithm

How can we construct this structure, given a set of non-crossing line segments?

Algorithm TrapezoidalMap(S)

  1. Determine a bounding box R that contains all of the segments of S
  2. Initialize T, the trapezoidal map structure and D, the search structure:
    1. T is just the single trapezoid corresponding to the whole box R
    2. D has only one node, corresponding to that trapezoid
  3. Compute a random permutation s1, s2, ..., sn of the segments of S
  4. For each segment si (in this order),
    1. Find the set of trapezoids in T properly intersected by si
    2. Remove them from T and replace them by the new trapezoids that appear because of the insertion of si
    3. Remove the leaves of D for the old trapezoids and create leaves for the new ones. Link them to the existing inner nodes by adding some new inner nodes as will be explained in a moment.

Key features of the algorithm:

Incremental: Every time we insert a segment, we have a trapezoidal map and a data structure for the segments inserted before.

It uses randomness, so there are no bad inputs.