|
The basic insight is pretty simple. Suppose you're looking
for a can of red paint, and there are five hardware stores
on the main street of town. You're at the East end of the
street, and you want to find the nearest can of red paint,
buy it, and go on about your day.
Here's one thing you could do: go to all five stores, search
the shelves, and see if they have a can of red paint. If they
do, mark it down on a piece of paper. Once you've made it
to the West end of the street and you've checked all the stores,
return to the East end of the street. Now look at your list
and find the most Eastern store that had red paint. Enter
the store and buy your paint!
That's obviously silly. What you would want to do is stop
as soon as you found the first can of paint. So of course
you would enter the first store, and if they had red paint,
you'd buy it and be done with it. You'd know this was the
closest can to your starting point because all the other stores
are farther away. If this store doesn't have it, then you
move on to the next store in a Western direction, and so on.
That's the idea. It's pretty simple, but you need to do a
little work to convert it into ray-tracing terms. Once you
do so, you have an algorithm that's a lot faster than the
old way of doing things.
|