[Math] How to find a point which lies at distance d on 3D line, given a position vector and direction vector

3dvectors

I have a position vector $(p_x, p_y, p_z)$ and direction vector $(v_x, v_y, v_z)$. I need to find a point on along the direction vector which is at distance $d$ from $(p_x, p_y, p_z)$.

Best Answer

There are two points on the line at distance $d$ from $\mathbf{p}$. They are $\mathbf{p}\pm d \hat{\mathbf{v}}$ where $\hat{\mathbf{v}}$ is a unit vector parallel to $\mathbf{v}$. In coordinates, that's $$(p_x,p_y,p_z)\pm\dfrac{d}{\sqrt{v_x^2+v_y^2+v_z^2}}(v_x,v_y,v_z)$$

Related Question