Rays on a plane

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

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 on other sites
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 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 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 on other sites
Oh, Zipster's method is better than mine.

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 11
• 13
• 9
• 11
• Forum Statistics

• Total Topics
634092
• Total Posts
3015438
×