Archived

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

ray box intersection math

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

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 this post


Link to post
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 this post


Link to post
Share on other sites