|
![](/i/fill.gif) |
On Thu, 19 Nov 1998 03:42:40 +0200, Margus Ramst <mar### [at] peak edu ee> wrote:
>> Do you currently ignore cells whose closest point is further than
>> the closest one found so far?
>
>No. But if I'm not mistaken, I would still have to check the distance between
>the current intersection point and the closest point of the adjacent cell? If
>so, this would give me no advantage.
Except that the closest point for a face-adjacent cell will always
have two coordinates the same as the current intersection point, so
you don't need to use vlength. For the other 20 cells you'd have
to compute a distance anyway, so you might not save anything unless
one of those cells has more than one or two light sources in it or
unless the difference on a single axis is already larger than the
bound. For example, if you can throw away a face-adjacent cell,
you can automatically throw away 8 more cells. For the 2d case:
+---+---+---+
| | | X |
| | | |
+---+---+---+
| |A | * |
| | B | |
+---+---+---+
| | | X |
| | | |
+---+---+---+
If you have an intersection at A, and the closest point you've found
is at B, you don't have to test the cell marked with a *, because it
is further away than your closest point so far. Since you don't need
to test it, you also don't need to test the two marked with X's. The
3d case is even better, because you can throw away 9 cells with a
single floating-point comparison.
Post a reply to this message
|
![](/i/fill.gif) |