Jump to content
  • Advertisement
Sign in to follow this  
eppo

Rays on a plane

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

Say I have two arbitrary rays, both of them have their own starting position and vector. How can I determine whether the two rays share a common plane? [edit: typo] [Edited by - eppo on June 16, 2008 7:15:23 AM]

Share this post


Link to post
Share on other sites
Advertisement
If they share a common plane they will either be parallel or they will cross at some point.

So their vectors will either be linearly dependant (one of them can be expressed as the other multiplied by a scalar) or they will have at least one common point.

One way to get the intersection is to try and solve the intersection by restraining yourself to x and y coordinates ( wikipedia link ) and pluging the solution into the z coordiante to see if it matches.

Share this post


Link to post
Share on other sites
Pick two points from each ray (the starting position and the starting position plus the vector will do) and check to see if those four points lie on the same plane.

|x1 y1 z1 1|
|x2 y2 z2 1| == 0
|x3 y3 z3 1|
|x4 y4 z4 1|

Share this post


Link to post
Share on other sites
The vector between their origins should be expressible by a linear combination of the ray direction vectors (i.e. all three should lie on the same plane). EDIT: Actually, it's that at least one of those vectors can be expressible by a linear combination of the other two. For instance, if both ray directions were parallel, then clearly you wouldn't be able to combine them to form the origin difference vector if it wasn't also parallel to the directions.

Be careful when determining coplanarity in 3D, however. Floating-point imprecision could lead you to believe that all three vectors don't lie on the same plane when in reality they do, or are so close that you might as well consider them coplanar.

[Edited by - Zipster on June 16, 2008 4:38:34 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

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