Jump to content
  • Advertisement
Sign in to follow this  
Guoshima

Frustum AABB intersection

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I have a little math problem. Can someone help me with a method which scales down an AABB so it fits inside a given frustum. My AABB is basically defined as: D3DXVECTOR3 minPt; D3DXVECTOR3 maxPt; While the frustum has: D3DXVECTOR3 pntList[8]; D3DXPLANE camPlanes[6]; int nVertexLUT[6]; thx, Kenzo

Share this post


Link to post
Share on other sites
Advertisement
Find the center point of the AABB, find the distance to all 6 planes, then find the closest distance.

Now do a ratio scalling where the AABB Point furtherest from the center is scaled to equal this now distance


float distance;
vector Center = (minPt+MaxPt)/2;
for (int f=0;f < 6;f++)
if (GetPlaneDistance(plane,center)) distance = GetPlaneDistance(plane,center);

Resize the AABB to fit into the Sphere Center with Radius = Distance

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!