# 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.

## 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 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 on other sites
Hey thanks man!!! I feel like a moron now! lol

No problemo :)

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

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

• Total Topics
631776
• Total Posts
3002304
×