Re: [Algorithms] Problem with Woo's "Fast Ray-Box Intersection"
Brought to you by:
vexxed72
From: Andrew H. <an...@co...> - 2000-08-31 14:47:02
|
I spent a while optimizing this test. Generally you're going to test a ray against many AABBs. Instead of doing the divides each time you test a box, just do them once, and multiply instead. This is much quicker. Watch out for axis aligned rays. One or two of the deltas can be zero, but luckily this is a special case and you don't even need to do the divide. For example, if delta.x==0, all you want is: min.x <= origin.x <= max.x. I do this by swapping to a slower routine if one or more of the delta components is zero. Andrew. |