I have 3 vertices in 3D: C, P and W.
I know:
- Points C and P and therefore $\overrightarrow{CP}$ and $\overline{CP}$.
- A direction vector collinear with $\overrightarrow{CW}$
- $\overline{PW}$
I want to know W.
Basically, I want the point in the line that follow the direction vector collinear with $\overrightarrow{CW}$ which has a known distance to P.
I tried solving with the cosine rule, but I got nowhere. My background is not maths, so it is likely that I made a newbie mistake trying to apply it in 3D.
For a visual representation of the problem:
Visual Representation
Thank you in advance for your help!
Suppose that the vector $\vec u$ along $\vec{CW}$ has length $1$ (you can normalize it, if it's not). Then the angle $\theta=\angle WCP$ is given by $$\cos\theta=\frac{\vec u\cdot\vec{CP}}{|CP|}$$ Use the generalized Pythagoras' theorem: $$d_{PW}^2=d_{CP}^2+d_{CW}^2-2d_{CP}d_{CW}\cos\theta$$ to find $d_{CW}$. This is a quadratic equation. Just use the positive solution. Then $\vec W=\vec C+d_{CW}\vec u$