Describe relative angles between points (like driving directions)

Posted by aan234g on Stack Overflow See other posts from Stack Overflow or by aan234g
Published on 2010-06-16T15:04:02Z Indexed on 2010/06/16 15:22 UTC
Read the original article Hit count: 193

I have a list of points with x, y coordinates. I know how to get the distance between points with sqrt(pow($x2 - $x1, 2) + pow($y2 - $y1, 2)) and the angle between points with atan2(y1 - y2, x1 - x2).

How can I calculate the relative angle between the points (left, right, straight)? So, if I'm at point 1, what is the relative direction to point 2, then 2 to 3, 3 to 4, etc...

Thanks for any help!

© Stack Overflow or respective owner

Related posts about php

Related posts about driving-directions