18.04.2013 Views

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

War Story: Stripping Triangulations<br />

planar subdivision representing the triangulation (see Section ) captures all the information about the<br />

triangulation needed to partition it into triangle strips. Section describes our experiences constructing<br />

the graph from the triangulation.<br />

Once we had the dual graph available, the project could begin in earnest. We sought to partition the<br />

vertices of the dual graph into as few paths or strips as possible. Partitioning it into one path implied that<br />

we had discovered a Hamiltonian path, which by definition visits each vertex exactly once. Since finding<br />

a Hamiltonian path was NP-complete (see Section ), we knew not to look for an optimal algorithm,<br />

but to concentrate instead on heuristics.<br />

It is always best to start with simple heuristics before trying more complicated ones, because simple<br />

might well suffice for the job. <strong>The</strong> most natural heuristic for strip cover would be to start from an<br />

arbitrary triangle and then do a left-right walk from there until the walk ends, either by hitting the<br />

boundary of the object or a previously visited triangle. This heuristic had the advantage that it would be<br />

fast and simple, although there could be no reason to suspect that it should find the smallest possible set<br />

of left-right strips for a given triangulation.<br />

A heuristic more likely to result in a small number of strips would be greedy. Greedy heuristics always<br />

try to grab the best possible thing first. In the case of the triangulation, the natural greedy heuristic would<br />

find the starting triangle that yields the longest left-right strip, and peel that one off first.<br />

Being greedy also does not guarantee you the best possible solution, since the first strip you peel off<br />

might break apart a lot of potential strips we would have wanted to use later. Still, being greedy is a good<br />

rule of thumb if you want to get rich. Since removing the longest strip would leave the fewest number of<br />

triangles for later strips, it seemed reasonable that the greedy heuristic would out-perform the naive<br />

heuristic.<br />

But how much time does it take to find the largest strip to peel off next? Let k be the length of the walk<br />

possible from an average vertex. Using the simplest possible implementation, we could walk from each<br />

of the n vertices per iteration in order to find the largest remaining strip to report in time. With<br />

the total number of strips roughly equal to n/k, this yields an -time implementation, which would be<br />

hopelessly slow on a typical model of 20,000 triangles.<br />

How could we speed this up? It seems wasteful to rewalk from each triangle after deleting a single strip.<br />

We could maintain the lengths of all the possible future strips in a data structure. However, whenever we<br />

peel off a strip, we would have to update the lengths of all the other strips that will be affected. <strong>The</strong>se<br />

strips will be shortened because they walked through a triangle that now no longer exists. <strong>The</strong>re are two<br />

aspects of such a data structure:<br />

file:///E|/BOOK/BOOK/NODE37.HTM (2 of 4) [19/1/2003 1:28:34]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!