How to find single vector representation of a line.

52 Views Asked by At

Ok, I'm a bit over my head here, but I will give this question a go.

I have a line plotted on a grid. This represents the direction I want to travel (from point1 to point2) and the speed (length of line)

|        
|        /*x,y
|       / 
|      /
|     /
|    *x,y
|
__________________

I need to convert this into a vector $(x,y)$

A vector of $(0,10)$ would be an upward movement, $(0,50)$ would be a larger movement upwards. $(0,-50)$ obviously downwards.

But how can I translate my line into this format?

i believe something along the lines of $(50,50)$ would aim in the direction of (from bottom to top)

50
|\
| \
|  \
|   \
|    \
_________
0     50

or $(-50,50)$

     50
    /|
   / |
  /  |  
 /   |
/    |
_________
-50  0

or $(-10,10)$ being a smaller movement in the same direction as above

     10
    /|
   / |
  /  |  
 /   |
/    |
_________
-10  0

But these are vectors and I have a line which is made up of two vectors.

Am I missing something or is there a way to calculate this?

Any help is appreciated.

1

There are 1 best solutions below

0
On

If I understood your question correctly you are looking up for a representation of a line that passes throught 2 points $\vec{P_1}$ and $\vec{P_2}$.

The vector that points in the direcction of the line would be the difference between the points $\vec{P_1} - \vec{P_2}$. Multiplying that vector by any real number would draw a line throught the origin. Now, in order to make that line pass throught our points, you have to add one of them.

Your line would be defined as $\vec{X} (t)= (\vec{P_1} - \vec{P_2}) t + \vec{P_1}$.