Link to home
Start Free TrialLog in
Avatar of InteractiveMind
InteractiveMindFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Ray-Plane Collision

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.
SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of InteractiveMind

ASKER

3 unkowns, and 1 equation?
This is a vector equation, so there are seperate eqations for the x, y, and z-components.
Oh yeah. Cheers.

I'll have a go at solving it.

:)
Uh oh..
is there gonna be any easier way of doing this, than Gaussian Elimination?
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 !!
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>> 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 :)
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?
   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>
In case you don't know, the cross product of two vectors will return a vector perpendicular to both of the two vectors.
Thanks guys; that's all working nicely now :)