[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Ray-Plane Collision

Posted on 2006-05-10
13
Medium Priority
?
1,101 Views
Last Modified: 2011-04-14
I've got a Light source L (a vector) and a vertex V (a vector also). I then have a ray originating at the light source, and passing through the vertex.

Therefore, my ray is defined as:

   r = L + t (V - L)

(Where (V-L) is normalised).

I now need to find at what point this ray hits a plane...

However, I'm not sure how to do this. My first problem is how I should define the plane, and then secondly, is how to actually locate the point of collision..

Any suggestions?

Thanks.
0
Comment
Question by:InteractiveMind
  • 6
  • 5
  • 2
13 Comments
 
LVL 53

Assisted Solution

by:Infinity08
Infinity08 earned 1000 total points
ID: 16648800
A plane can be defined by two vectors if you like (both in the plane, and eg. perpendicular to one another), or by one vector (perpendicular to the plane), or by three points (in the plane, and not on one line), or ...

your ray is defined by (in 3D) :

    r = L + t (V - L)

and your plane as :

    p = P0 + u(P1 - P0) + v(P2 - P0)

with P0, P1 and P2 the three points that define the plane (not on one line !).

To find where the ray "cuts" the plane :

    L + t (V - L) = P0 + u(P1 - P0) + v(P2 - P0)

This can be easily solved for unknowns t, u and v ...
0
 
LVL 25

Author Comment

by:InteractiveMind
ID: 16648863
3 unkowns, and 1 equation?
0
 
LVL 27

Expert Comment

by:d-glitch
ID: 16648901
This is a vector equation, so there are seperate eqations for the x, y, and z-components.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 25

Author Comment

by:InteractiveMind
ID: 16648908
Oh yeah. Cheers.

I'll have a go at solving it.

:)
0
 
LVL 25

Author Comment

by:InteractiveMind
ID: 16648939
Uh oh..
is there gonna be any easier way of doing this, than Gaussian Elimination?
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 16648977
Not in general, unless the points defining the plane and vector are well chosen. Strive to get 0's in the equations, so you can eliminate terms.

Choose the reference axes well !!
0
 
LVL 27

Accepted Solution

by:
d-glitch earned 1000 total points
ID: 16648992
Yes:    http://astronomy.swin.edu.au/~pbourke/geometry/planeline/

Look up line-plane intersections.  There are one-step projection methods for all of the alternate expressions of a plane.
0
 
LVL 53

Assisted Solution

by:Infinity08
Infinity08 earned 1000 total points
ID: 16649028
And btw, since you only want to find the point of intersection, you just need to find t :

    R = L + t (V - L)

So :

    Lx + t (Vx - Lx) = P0x + u(P1x - P0x) + v(P2x - P0x)                         (1)
    Ly + t (Vy - Ly) = P0y + u(P1y - P0y) + v(P2y - P0y)                         (2)
    Lz + t (Vz - Lz) = P0z + u(P1z - P0z) + v(P2z - P0z)                         (3)

express u an v as a function of t using (2) and (3), and replace those in (1), to get something of the form :

    t = ...

which you easily use in :

    R = L + t (V - L)

to get the point of intersection.

If you want to use it in software, this is easier than performing Gauss elimination each time. Just construct a general formula for R using the above method, and fill in the correct values to get R from then on.
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 16649116
>> Yes:    http://astronomy.swin.edu.au/~pbourke/geometry/planeline/
Nice page ... solution 2 on that page is similar to the one I presented in my last post ... so you might want to just copy that :)
0
 
LVL 25

Author Comment

by:InteractiveMind
ID: 16649591
Okay, cool.


For this definition of a plane:

  A x + B y + C z + D = 0

How could I find the values of A, B, C, and D, given two adjacement lines that lie on the plane?
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 16649789
   A x + B y + C z + D = 0

is actually :

    N * (R - p) = 0

with N the normal vector (perpendicular to the plane), R is (x,y,z), and p a point in the plane.

So, all you have to do is take one point of one of the lines defining the plane and use it as p. Next calculate the normal vector to the plane (see further), and substitute in the above equation.


How to calculate the normal vector ? take three points (P1, P2 and P3) that are in the plane (not on one line), and then this is the normal :

    N = (P1 - P2) x (P3 - P2)


Note that x is the cross product between two vectors, defined like this :

    A x B = <Ay*Bz - Az*By, Az*Bx - Ax*Bz, Ax*By - Ay*Bx>
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 16649811
In case you don't know, the cross product of two vectors will return a vector perpendicular to both of the two vectors.
0
 
LVL 25

Author Comment

by:InteractiveMind
ID: 16727759
Thanks guys; that's all working nicely now :)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
Lithium-ion batteries area cornerstone of today's portable electronic devices, and even though they are relied upon heavily, their chemistry and origin are not of common knowledge. This article is about a device on which every smartphone, laptop, an…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question