Finding a point on a 3d line

6.6k Views Asked by At

I have two points in 3D which will create a single ray. I am trying to find a point on that ray which intersects a plane who's y coordinate is 0. So how do I find a point on a 3D line when I know the Y value already?

enter image description here

2

There are 2 best solutions below

0
On BEST ANSWER

A generic point on the line can be written as $a+t(b-a)$, where $t$ is a real variable.

If you know a $y$ value (and $a,b$ have different $y$ values), you can find the point by determining the appropriate value of $t$.

In this case, you want to solve $a_y + t(b_y-a_y) = y_\text{given}$ for $t$. This gives $t = \frac{y_\text{given}-a_y}{b_y-a_y}$, and then the point is given by $a+ t(b-a)$.

To find the point where the line intersects the $x-z$ plane, set $y_\text{given} = 0$.

0
On

Let $\vec a=\begin{pmatrix}a_x\\a_y\\a_z\end{pmatrix}$, $\vec b=\begin{pmatrix}b_x\\b_y\\b_z\end{pmatrix}$. Then we can express your line segment as $\ell:=\{(\vec b-\vec a)\lambda+\vec a\mid\lambda\in[0,1]\}$. Then you're looking for $\ell\cap \left\{\begin{pmatrix}x\\0\\z\end{pmatrix}\mid x,z\in\mathbb{R}\right\}$.

So we need $(b_y-a_y)\lambda+a_y=0\Rightarrow \lambda=-\frac{a_y}{b_y-a_y}$. So the point you're looking for is $-\frac{a_y}{b_y-a_y}(\vec b-\vec a)+\vec a=\begin{pmatrix}a_y-\frac{a_y(b_x-a_x)}{b_y-a_y}\\0\\a_y-\frac{a_y(b_z-a_z)}{b_y-a_y}\end{pmatrix}$