Jump to content
  • Advertisement


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.

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];
	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

  • 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!