a % b == b when a is a very small negative number

Ype Kingma ykingma at accessforall.nl
Sun Nov 24 13:59:04 EST 2002


Lee,

It may be overkill, but you might take a look at quaternions

http://mail.python.org/pipermail/python-list/2001-October/067434.html

and/or represent the angle using both the sine and cosine.
Both ways allow to avoid the modulo operator.

Regards,
Ype


Lee Harr schreef:

> 
> I have some code which is storing the direction an object
> is moving, and I want to keep that value: 0 <= direction < 2*PI



More information about the Python-list mailing list