#### Archived

This topic is now archived and is closed to further replies.

# Finding where a plane and a line intersect

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

## Recommended Posts

How do I find the point where a line and a plane intersect. Assume that ax+by+cz+d=0 (the standard form for a plane) And I have two points (e,f,g) and (h,i,j). Is there a formula to figure out the point of intersection? For those who are wondering, I''m trying to build my own 3D engine at the moment, so this is basically a major part of it. Thanks.

##### Share on other sites
Pretty easy,

equation of a plane : ax+by+cz+d=0 or N.(P-P0) = 0
equation of a line : P(t) = Q + tV

sub eq of a line into the eq for a plane

N.(Q + tV -P0) = 0

solve for t

t = (N.P0 - N.Q)/N.V

sub t back into the equation of a line, and you have the point of intersection.

Hope that helps

##### Share on other sites
I''m not that far up the math ladder, so help me out a little here. I''m assuming in the line equation, Q and V are two points and t is the slope?

But I''m sorta confused on the plane equation. What does N.(P-PO) mean?

And example would be great if you could do one.

##### Share on other sites
Q is the ''origin'' of the line (e,f,g)
V is the direction of the line (h,i,j) - (e,f,g)
t is a number ranging from 0 to 1 (you can think of it as time)

so at t = 1
P(1) = (e,f,g) + (h,i,j) - (e,f,g) = (h,i,j)

at t = 0
P(0) = (e,f,g)

The values inbetween are points on the line connecting (e,f,g) and (h,i,j)

N.(P-PO) = 0 is another way of writing ax+by+cz+d=0
N.P - N.P0 = 0 or Nx*Px + Ny*Py + Nz*Pz - N.P0 = 0
which can be written as x*a + y*b + z*c + d = 0

##### Share on other sites
Terminology: That was the parametric equation of a line.

##### Share on other sites
Ok, im understanding how to do it in general. But I''m not really understanding the N.(P-P0) = 0 part. Or really just what the . (dot) means and the N, P, and P0.

So if possible, could you expand both the

t = (N.P0 - N.Q)/N.V

formula and

N.(P-P0) = 0

formula. What I''m really confused about it the P0 part. Is that the origin of the line at P(0) or something completely different?

Thanks again.

##### Share on other sites
I''m not sure this is it, but:

t = (A*x1+B*y1+C*z1+D) / (A*(x1-x2)+B*(y1-y2)+C*(z1-z2))

Is this it?

##### Share on other sites
N.(P-P0) = 0

the . means the dot product. P0 and P are two points that lie on the plane, and N is the normal vector of the plane. To understand the equation you really need to understand the dot product (im sure google can help you with that).

The most important thing to know is that the dot product of two perpendicular vectors is 0. Since P and P0 are two points on the plane, P-P0 is a vector that is perpendicular to the planes normal vector N. And since the dot product of 2 perpendicular vectors is 0, we can write

N.(P-P0) = 0

The dot product can also be written in terms of the components of the vector as

A.B = Ax*Bx + Ay*By + Az*Bz

And so you can evaluate N.(P-P0) = 0
to be Nx*Px + Ny*Py + Nz*Pz - N.P0 = 0
-N.P0 is a constant(P0 is always going to be a point on the plane and the normal vector is always going to be the same), and so it is sometimes just written as the letter D.

So Nx*Px + Ny*Py + Nz*Pz - N.P0 = 0
becomes Nx*Px + Ny*Py + Nz*Pz + D = 0 with D = -N.P0

Now, applying that to t = (N.P0 - N.Q)/N.V we get

t = -1* (Nx*e + Ny*f + Nz*g + D)/(Nx*(h-e) + Ny*(i-f) + Nz*(j-g))

(here i took a minus one out of (N.P0 - N.Q) to make it -(N.Q -N.P0), or -(N.Q + D), and then evaluated the dot product N.Q)

if you then multiply the denominator by the -1, you get

t = (Nx*e + Ny*f + Nz*g + D)/(Nx*(e-h) + Ny*(f-i) + Nz*(g-j))

Hope that clears it up

##### Share on other sites
Yup, thanks a lot.

1. 1
2. 2
3. 3
Rutin
13
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633698
• Total Posts
3013412
×