Archived

This topic is now archived and is closed to further replies.

GekkoCube

Frustrums and dot products.

Recommended Posts

Ok. Anybody will know that I genuinely suck at math when they read this. But that is why I am asking for help! I''ve roughly implemented a quick ''n dirty frustrum culling algorithm. I know my lookat vector and my vectors created from the camera to vertices of a node (lets say they''re v1,v2,v3,v4). My question is: 1) Do I DotProduct the lookat vector and v1,v2,v3 and v4? 2) Or do I DotProduct (lookat vector - camera position) and v1,v2,v3, and v4? This is what I have so far, and it doesnt work exactly the way it should. ----------------------------------------------------------- D3DVECTOR c = camera.getPosition(); D3DVECTOR lookat = camera.getLookAt(); // Check if less < 90 degrees or > 270 degrees (viewable). if ((dotProduct(lookat-c,v1) > 0) || (dotProduct(lookat-c,v2) > 0) || (dotProduct(lookat-c,v3) > 0) || (dotProduct(lookat-c,v4) > 0)) { // one or more vertex is inside the frustrum! return TRUE; } else return FALSE; ------------------------------------------------------------ ~ I''''m a wannabe programmer ~

Share this post


Link to post
Share on other sites