Jump to content
  • Advertisement
Sign in to follow this  

Bounding Box

This topic is 3719 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

I need some help with this whole ray box intersection thing. It says a box can be considered to be a set of 3 orthogonal planes. How do I generate these planes if I have the boxes minimum and maximum points?

Share this post

Link to post
Share on other sites
realatively straight forward.

box [min, max]

plane minX : normal = Vector(-1, 0, 0), d = -min.x
plane maxX : normal = Vector( 1, 0, 0), d = max.x
plane minY : normal = Vector( 0,-1, 0), d = -min.y
plane maxY : normal = Vector( 0, 1, 0), d = max.y
plane minZ : normal = Vector( 0, 0,-1), d = -min.z
plane maxZ : normal = Vector( 0, 0, 1), d = max.z

intersection :

t_intersect = (d - rayStart.dotProduct(normal)) / (rayDir.dotProduct(normal));


t_minx = (min.x - rayStart.x) / (rayDir.x);
t_maxx = (max.x - rayStart.x) / (rayDir.x);
t_miny = (min.y - rayStart.y) / (rayDir.y);
t_maxy = (max.y - rayStart.y) / (rayDir.y);
t_minz = (min.z - rayStart.z) / (rayDir.z);
t_maxz = (max.z - rayStart.z) / (rayDir.z);

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!