Recently, I've been trying to make a program that calculates the intersection of a line and a plane. To do so, I need a universal equation. Here's the question.

Let's say there's a plane in 3d space, with a normal vector n of $<x_1,y_1,z_1>$. The point $(x_2,y_2,z_2)$ lies on the plane as well. There is also a line that passes through points $(x_3,y_3,z_3)$ and $(x_4,y_4,z_4)$. What, in terms of those variables, are the co-ordiantes of the intersection between the line and the plane?

I've tried solving it myself, but I got the following, which doesn't seem to work at all.

$$x= x_3 + \frac{x_1x_2+y_1y_2+z_1z_2}{(x_3-x_1)(y_3-y_1)(z_3-z_1)(z_1)(x_1)(y_1)}(x_3-x_1)$$

$$y= y_3 + \frac{x_1x_2+y_1y_2+z_1z_2}{(x_3-x_1)(y_3-y_1)(z_3-z_1)(z_1)(x_1)(y_1)}(y_3-y_1)$$

$$z= z_3 + \frac{x_1x_2+y_1y_2+z_1z_2}{(x_3-x_1)(y_3-y_1)(z_3-z_1)(z_1)(x_1)(y_1)}(z_3-z_1)$$


Simplify notation a bit by calling the point on the plane $P,$ the first point on the line $Q,$ and the difference between the second point and first point on the line $v$ (so $v$ is the vector from the first point to the second point).

The equation of the plane is $n\cdot x + d = 0.$ Since $P$ is on the plane, $d$ must equal $-n\cdot P.$

The equation of the line is $Q + tv$, where $t$ is any real number. The value of $t$ where the line and plane intersect must satisfy $$ n\cdot (Q + tv) + d = 0. $$

Solving this equation for $t$ yields $$ t = \frac{-d - n\cdot Q}{n\cdot v}. $$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.