HI All,
How can I calculate direction vector of a line segment, defined by start point (x1, y1) and end point (x2, y2)?
Cheers.
(x2 - x1, y2 - y1)
If you want the unit direction vector, divide each component by sqrt((x2 - x1)² + (y2 - y1)²).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With