[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
**Subject**: **Atan2 and angle between vectors**
**From**: Rena <hyperhacker@...>
**Date**: Mon, 2 Apr 2012 22:26:36 -0600

Hi,
I just discovered that math.atan2 doesn't handle the case of y=0
properly, at least in Lua 5.1:
> a, b = {-1, 0}, {1, 0}
> =math.deg(math.atan2(b[2] - a[2], b[1] - a[1]))
0
Surely the result should be 180, since these two vectors point in
opposite directions? But atan2 doesn't handle this correctly, and the
manual doesn't mention this. Is it a known issue?
--
Sent from my toaster.