2
$\begingroup$

Given a point $P = [x, y, z]$ and a vector $v = [v_x, v_y, v_z]$

I want to move the point along the vector by a fixed amount $d$

Thank you

$\endgroup$
2
  • 1
    $\begingroup$ Try $P + d\dfrac{v}{|v|}$ $\endgroup$
    – across
    Commented Dec 2, 2020 at 21:39
  • $\begingroup$ This seems to be a duplicate of Moving point along the vector $\endgroup$ Commented Sep 29, 2022 at 22:25

1 Answer 1

2
$\begingroup$

To move a point along a vector, we multiply the vector by a constant ($\epsilon$), and then add it to the point $P_{moved} = P + \epsilon v = [x + \epsilon v_x, y + \epsilon v_y, z + \epsilon v_z]$

Now, the distance moved $d = \sqrt{(P_{moved} - P)^2} = \epsilon\sqrt{v_x^2 + v_y^2 + v_z^2}$

Therefore $\epsilon = \frac{d}{\sqrt{v_x^2 + v_y^2 + v_z^2}}$

So $P_{moved} = P + \frac{d}{\sqrt{v_x^2 + v_y^2 + v_z^2}}v$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .