# Rectangle<->Frustum Intersection test?

This topic is 2555 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm basically just trying to check if a flat quad rectangle lies within the view frustum or not. The rectangle is not axis-aligned, it can have any scale or transform (position, rotation). The current frustum information I have is just the 6 planes that make up the frustum, although if I truly need I could probably calculate the 8 corners of the frustum.

I searched all over google and most of the results seem to be plane checks rather than rectangles.

EDIT: I think I might have it. Let me know if this sounds like it would work:

Check each point on the rectangle against the frustum. If any point is in the frustum then it's in view. If no points are within the frustum check if any edge of the rectangle intersects any of the frustum planes. If any edges intersect a frustum plane then it's in view.

I think this will work, and I already have the algorithms for checking points against the frustum, so I should be able to use that algorithm and the fact that all the points are outside of the frustum to handle either case.

##### Share on other sites
If the rectangle is bigger than the frustum, you'll have problems as not only will no points be inside, but no lines will pass through since it's larger in all respects. If the rectangle-line check fails, try checking the frustum's lines for intersection with the rectangle.

##### Share on other sites
If you only check for those factors you will completely miss any quad that is larger than the frustum. A common way is to test if all points are on the same side of a single frustum plane. You will get false positives in some cases, but that's usually better than the other way around. If you want perfect results, you will probably end up checking for intersection in both ways. Don't just see if the polygon points/edges intersect the frustum, but also if the frustum edges intersect the polygon.

Edit: I really need to stop taking so much time when writing answers.

##### Share on other sites
There would have to be a huge speed bonus in calculation and not much speed increase in culling (if that's what this is for) to use your first method. That's a lot of false positives In fact, wouldn't there always be a plane in the frustum with the points on the same side?

##### Share on other sites
Hidden
There would have to be a huge speed bonus in calculation and not much speed increase in culling (if that's what this is for) to use your first method. That's a lot of false positives

There would have to be a huge speed bonus in calculation and not much speed increase in culling (if that's what this is for) to use your first method. That's a lot of false positives In fact, wouldn't there always be a plane in the frustum with the points on the same side?

You're right. Replace "same side" of a plane with "outside" of a single plane, ie. all points are left/right/above/below/behind/beyond the frustum.

##### Share on other sites
Good stuff guys, thanks. I do believe that checking if all four points of the rectangle are on the outside of any of the planes then that will mean it's not colliding. Thanks!

1. 1
2. 2
3. 3
Rutin
22
4. 4
JoeJ
17
5. 5

• 14
• 30
• 13
• 11
• 11
• ### Forum Statistics

• Total Topics
631776
• Total Posts
3002299
×