This page will describe how to calculate the directional vector between two points, in a 2-D plane.
Before you start you will need the X and Y coordinates of both points. Then follow these steps:
- Apply the distance formula.
- distance = sqrt(((x2 - x1)^2) + (y2 - y1)^2))
- The X coordinate of the directional vector is calculated as follows:
- X = (x2 - x1)/distance
- The Y coordinate is about the same:
- Y = (y2 - y1)/distance
- The result is the directional vector:
- Vector[X, Y]