0
$\begingroup$

I have a coordinates where vector starts, and where it ends(2D, so only x and y), and I need to extend/lengthen it, but I need to know the extended vector's end coordinates. The start ones doesn't change. I tried to multiply it or add some value there, but of course, as you can guess, vector hasn't been going in the right direction, because I'm adding the same value to the both coordinates. I've been thinking that I need to get some coefficients for the both coordinates, but I have no idea how to calculate it right, since I don't have certain numbers, only the min/max(it's about [-7072;7072]) of both coords. Since vector can start on positive and end on negative coords it's makes the task a bit harder. May you give me advice where I should look into? I was thinking about doing stuff with angles between vector and axes, but still ain't certain.

$\endgroup$

1 Answer 1

1
$\begingroup$

If a vector $\vec{v}=(v_x,v_y)$ is between the starting point $A=(A_x,A_y)$ and the ending point $B=(B_x,B_y)$, then $$v_x = B_x - A_x$$ and $$v_y = B_y - A_y$$

Let $\vec{w}$ be a vector that is $k$ times larger than $\vec{v}$, so $\vec{w} = k \vec{v}$.

If this vector starts at $A$, then it will end at point $C$ with the coordinates $$C_x = A_x + k v_x = k B_x + (1 - k) A_x$$ and $$C_y = A_y + k v_y = k B_y + (1 - k) A_y$$

$\endgroup$
1
  • $\begingroup$ Thank you a lot, didn't think the solution is easy as that. $\endgroup$
    – MrJunior
    Apr 28, 2019 at 20:32

You must log in to answer this question.

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