[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Atan2 and angle between vectors
- From: Leo Razoumov <slonik.az@...>
- Date: Wed, 4 Apr 2012 16:31:50 -0400
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--