03-29-2006, 09:57 PM
Heres one that CoderJeff posted over at freebasic.net in a discussion on working out the angle between two points.
It returns a value from -180 To 180, so needs a small adjustment if you want to use 0-360, but i thought this was a great one liner.
Code:
angle = Atan2(v.x - u.x, -(v.y - u.y)) * (180 / PI)
It returns a value from -180 To 180, so needs a small adjustment if you want to use 0-360, but i thought this was a great one liner.
Code:
If angle < 0 Then angle += 360