#### Archived

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

# ray box intersection math

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

## Recommended Posts

hihi i was wondering why does Andrew Woo need to do a "divide by ray direction" in this portion of his code (Graphics Gems 1)
/* Calculate T distances to candidate planes */
for (i = 0; i < NUMDIM; i++)
if (quadrant[i] != MIDDLE && dir[i] !=0.)
maxT[i] = (candidatePlane[i]-origin[i]) / dir[i];
else
maxT[i] = -1.;

link: Article</html> thx! Edwinz

##### Share on other sites
it''s to find the parameter of intersection with the plane.

in plane equation terms, you would have

ray : P = O + D.t
plane : P.N = d

=> O.N + t * (D.N) = d
=> t = (d - O.N) / (D.N)

e.g. i = 0 => N = Vector(1, 0, 0), d = candidateplane[0]

t = (candidateplane[0] - O[0]) / D[0];

##### Share on other sites
hi there!

thx!
Edwinz

[edited by - edwinnie on May 31, 2004 9:30:22 PM]

np

1. 1
Rutin
67
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633420
• Total Posts
3011793
• ### Who's Online (See full list)

There are no registered users currently online

×