Monday, December 6, 2010

Intersection between Line and the Plane




A and B are the 2 known points on the line and t is the parameter which will allow us to find a point P on the line.
lets assume that P is the point of intersection between a line and a plane
in order to find point P we will need to find value of the parameter t.
to find t, we plug equation of line into the equation of plane, where we have everything we need to calculate t.
once we have t, we plug into our equation of line back to find P.

The equation of a line is:
P = A + t(B – A)                 ------------------------------------------------------------------  (1)

- P  is any arbitrary point on the line.  In this case, P is the point of intersection of the ray and the plane
- A is the starting point of the line
- B is the end point of our line segment
- t is the parameter.  Values between 0 and 1 represent points on our line.
- Po and Co are position vector for P and C.
- Po-Co will lie completely in the plane. hence dot product of this to planes normal will be zero.


The equation of a plane is:
N dot (P – C) = 0                ------------------------------------------------------------------  (2)
- N is the normal of the plane
- P and C are known points on the plane.  In this case, P will represent the point of intersection. If our plane was represented by a triangle, C could be one of the vertices.

Plug the equation of the ray from ---(1) into our intersection pt of the equation of the plane ---(2).

N dot ( (A + tV) – C) = 0
Solve for t:
(N dot (A + tV)) – (N dot C) = 0
(N dot (A + tV)) = (N dot C)
(N dot A) + (N dot tV) = (N dot C)
N dot tV = (N dot C) - (N dot A)
t = N dot (C – A) /N dot V       ------------------------------------------------------------------  (3)

so we calculated the value of t. we can use this value in the line equation to find the co-ordinates  of the intersection point
we have all the information on the right side of equal sign mean we can find P.
puting t in equation of line
P = A + t(B – A)                 ------------------------------------------------------------------  (4)

If:
t > 0 and t < 1  : The intersection occurs between the two points
t = 0            : The intersection falls on the first point
t = 1            : Intersection falls on the second  point
t > 1            : Intersection occurs beyond second Point
t < 0            : Intersection happens before 1st point.

1 comment:

TheFrenchLeaf said...

Hello,
I'm a PhD Student working in 3D.
I want project a 3D point on an ImagePlane linked to a camera in Maya. And I cannot manage to do it.
Can you help me ?
Regards

Integration/Tracking Demo Reel 2018 on Youtube