Calculate direction vector
c++, math, vector
Solution
(x2 - x1, y2 - y1)
If you want the unit direction vector, divide each component by sqrt((x2 - x1)² + (y2 - y1)²).
Problem
HI All, How can I calculate direction vector of a line segment, defined by start point (x1, y1) and end point (x2, y2)? Cheers.