1. ## Vector Length

I'm trying to find a forumla to determine where on a 2D coordinate system I will land. For example, say I'm at position (0,0) and am trying to head towards position (3,3), but can only move a length of 2 units, is there a way to determine the (x,y) coordinated i would land on by heading towards (3,3) and moving 2 units?

2. Originally Posted by Rkennedy9064
I'm trying to find a forumla to determine where on a 2D coordinate system I will land. For example, say I'm at position (0,0) and am trying to head towards position (3,3), but can only move a length of 2 units, is there a way to determine the (x,y) coordinated i would land on by heading towards (3,3) and moving 2 units?
In that particular case, you can use Pythagoras' Theorem.
The distance from (0,0) to (3,3) is

$\displaystyle \sqrt{(3-0)^2+(3-0)^2}=\sqrt{18}$

Then multiply 3 by the ratio of 2 to $\displaystyle \sqrt{18}$ to discover the x and y co-ordinates of that point.

Alternatively,
since you are heading to (3,3) at an angle of 45 degrees..

$\displaystyle x=2cos45^o$

$\displaystyle y=2sin45^o$

3. Originally Posted by Rkennedy9064
I'm trying to find a forumla to determine where on a 2D coordinate system I will land. For example, say I'm at position (0,0) and am trying to head towards position (3,3), but can only move a length of 2 units, is there a way to determine the (x,y) coordinated i would land on by heading towards (3,3) and moving 2 units?
Suppose that we start at the point $\displaystyle (p,q)$ and we move off towards the point $\displaystyle (a,b)$.
That is a distance of $\displaystyle d=\sqrt{(p-a)^2+(q-b)^2}$.

Now write the equation of the line as a function of $\displaystyle t$,
$\displaystyle l(t) = \left( {p + \dfrac{t}{d}(a - p),q + \dfrac{t}{d}(b - q)} \right)$.

Note that $\displaystyle l(0)=(p,q)~\&~l(d)=(a,b)$.
In other words, $\displaystyle l(d)$ gives a point $\displaystyle d$ units from $\displaystyle (p,q)$.

So $\displaystyle l(2)$ gives a point $\displaystyle 2$ units from $\displaystyle (p,q)$.

In the example you gave: $\displaystyle p=0,q=0~\&~a=3,b=3$.

4. I'm going to be using this in a computer program so I think the first response might be easier to implement. The only question I have is what do you mean by Then multiply 3 by the ratio of 2 to to discover the x and y co-ordinates of that point.

5. Originally Posted by Rkennedy9064
I'm going to be using this in a computer program so I think the first response might be easier to implement. The only question I have is what do you mean by Then multiply 3 by the ratio of 2 to to discover the x and y co-ordinates of that point.
Plato's response covers the situation "in general".

Mine only covers the specifics of the case given.

The length of the line from (0,0) to (3,3) is obtained using Pythagoras' Theorem.
At the point along that line that is length 2 units from the origin,
if you drop a perpendicular to the x-axis, then that's the x co-ordinate of the point in question.
If you draw a horizontal line to the y-axis, you have it's y co-ordinate.

The point's distance from the origin is $\displaystyle \frac{2}{\sqrt{18}}$ of the distance from (0,0) to (3,3) which is 2 of course.

The x co-ordinate of the point is that fraction of the distance from (0,0) to (3,0)
and the y co-ordinate is that same fraction of the distance from (0,0) to (0,3).

If you draw a sketch, it will be clear.
If we go halfway along (0,0) to (3,3) that will be (1.5, 1.5).
If we go one third of the way, the point will be (1,1).
If we go two-thirds of the way, the point will be (2,2).

If we go $\displaystyle \frac{2}{\sqrt{18}}$ of the way, the point will be

$\displaystyle \left(3\frac{2}{\sqrt{18}},3\frac{2}{\sqrt{18}}\ri ght)$