lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Apr 3, 2012 at 09:40, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> To calculate the angle beteween the two vectors, you sould do:
>>
>> math.atan2(b[2],b[1]) - math.atan2(a[2],a[1])
>>
>>
>
> Not that simple.  That could give anything between ± 2 pi, whereas angle should
> be between ± pi.

By adding/subtracting 2pi accordingly one can make result to be in (-pi,+pi].

--Leo--