How to find the x,y elements of a 3D vector when origin, direction, z are known

dsoltyka
Messages
5
Reaction score
0
I believe this is the correct place to post this as I believe I'm going to need to solve this as a linear system, however I suppose it might be solvable using trig as well. However, I've been at it for a while and I'm out of ideas and I think I'm missing something silly.

Consider the following:

Origin = (-1.1258, 100.8336, 2489.9998)
Direction = (-0.1115, 0.0826, -0.9903)

I need to use that information to find a final point in 3D space at an arbitrary Z coordinate, -512. That final point must lie on a line parallel to a line drawn from the origin in the given direction

I had originally tried to treat it like a right triangle and solving for the hypotenuse length, and multiplying that by my direction to get the final location vector, however either that won't work or I did it wrong.

Any ideas?
 
Last edited:
Physics news on Phys.org
Nevermind, I was in fact over thinking the solution. It was simple to solve when I used the formula for a 3D line.
 
Let p denote the vector you call "origin", and let q denote the vector you call "direction". Let r denote your "final point" whose z-coordinate is -512. Then there's a number \lambda such that

\mathbf{p}+\lambda \mathbf{q}=\mathbf{r},

or expressed as matrices,

\begin{bmatrix}p_1\\ p_2\\ p_3\end{bmatrix}+ \lambda \begin{bmatrix}q_1\\ q_2\\ q_3\end{bmatrix} = \begin{bmatrix}r_1\\ r_2\\ r_3\end{bmatrix}.

Addition works componentwise, so we have

p_3 + \lambda q_3 = -512.

Just substitute the numerical values of the third components of p and q, and solve for \lambda.

(EDIT: Oh, I see you got there already!)
 
Rasalhague said:
Let p denote the vector you call "origin", and let q denote the vector you call "direction". Let r denote your "final point" whose z-coordinate is -512. Then there's a number \lambda such that

\mathbf{p}+\lambda \mathbf{q}=\mathbf{r},

or expressed as matrices,

\begin{bmatrix}p_1\\ p_2\\ p_3\end{bmatrix}+ \lambda \begin{bmatrix}q_1\\ q_2\\ q_3\end{bmatrix} = \begin{bmatrix}r_1\\ r_2\\ r_3\end{bmatrix}.

Addition works componentwise, so we have

p_3 + \lambda q_3 = -512.

Just substitute the numerical values of the third components of p and q, and solve for \lambda.

(EDIT: Oh, I see you got there already!)

I did, but the elegance of your explanation would have made it simpler for sure. Thank you :)
 
Back
Top