Good way to check whether 2 frustums intersect

Started by
5 comments, last by B_old 17 years ago
Hi, I want to check whether to (view)frustums intersect. I have found some code that does the test. It uses the 8 corner points of each frustum. Currently I only store the 6 planes for each frustum, and all intersection tests worked with them. So now I am wondering what you use to make such a test? [Edited by - B_old on April 9, 2007 12:58:00 PM]
Advertisement
Does it have to be accurate? For best accuracy and speed, I'd use the SAT. Although you have to be careful, with the size of the volumes, you'd run into some possibly serious quantisation problems. Floating point number accuracy has its limits, and if you do the basic SAT test, it will square potentially large values. But there are ways round that. Namely, store the edge directions as normalised vectors and use that.

Everything is better with Metal.

You could also check if there are planes that are intersecting, this can be done quickly with halfspaces.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
That's what the SAT does in essence. The first few tests is basically telling you if one of the frustum intersects the planes of teh other one. Then the test gets refined by testing the planes resulting from the edge cross products for extra accuracy. That part can be ignored if you just want a fast but loose test.

Everything is better with Metal.

Quote:Original post by daniel_i_l
You could also check if there are planes that are intersecting, this can be done quickly with halfspaces.

Do you mean to check whether one of the frustums planes intersect with the other frustum or with any of the other frustums planes?

you check the vertices of the frustum against the planes of the other frustum. If you find a case where all vertices lie on the the 'outside' side of a plane, then there is no intersection possible.

Everything is better with Metal.

Quote:Original post by oliii
you check the vertices of the frustum against the planes of the other frustum. If you find a case where all vertices lie on the the 'outside' side of a plane, then there is no intersection possible.

Thanks, that makes sense.
I actually tried it, and it seems to work quite well. Doesn't even so terribly slow to me either.

This topic is closed to new replies.

Advertisement