Frustum AABB intersection
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
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement