Jump to content
  • Advertisement


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


Quadratic intersections

This topic is 5280 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 should probably put this in my sig - I''m not a math whiz so my question may seem awkwardly stupid for the less challenged ones in algebra. My question is this: after following this procedure... 1) intersect ray A with sphere S, getting two real intersection points In and If (n and f stand for near and far) 2) intersect ray B with S, the end point being In, getting another pair real intersection points Jn and Jf ... how do I determine whether In == Jn or In == Jf? Since I''m not a complete monkeyape, I tried the obvious: I compared VecDistance(B, Jn) to VecDistance(B, In), but the results were not what I expected (it would seem I''m a monkeyape after all). Anyway - when I intersect ray B from point P1 to In, which is a point on the sphere, am I supposed to get one intersection point or two? I tried it either way and the result is never what I would expect. Can someone point out what I''m doing wrong here? I guess the question is a bit vague, but it''s probably best if someone smarter asked the questions and I tried to explain what I''m doing...

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
What do you mean by far and near intersection points ?

If your question is about knowing the order of three points on a line, you only have to do a dot product. Imagine points A, B and C on a line. If (AB.BC > 0) than the order is A B C, if (AB.BC < 0) then the order is B A C (if the dot product is nul then two at least share the same coordinates). In your case, you might have a point or a vector giving you the direction of the ray (if you have a vector V than test V.BC to know wether the order is BC or CB instead).

For the question about the number of intersection points you have when intersecting ray B from P1 to In it depends on the relative position of In on the sphere from the point of view of P1. If P1In is tangent to the sphere you obviously have one intersection point. The dot product is your friend again : let C be the center of the sphere. If (InP.PC >= 0) then you have one intersection point else you have two.

Hope this helps (but I am not shure to undesrstand what you mean ...).

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!