[SciPy-User] difference of angles - to be between -180 and + 180
Wed Nov 18 10:00:19 CST 2009
Does anyone have a function that calculates delta-angles taking the
wrap-around at 180 degrees into account ?
I'm thinking of a function like:
>>> diffAngle(190, -10)
My current version looks like this:
handle wrap-around for -180 and +180
d = a1-a0
if d < -180:
if d> 180:
But I'm not sure if this is handling all cases correctly ;-(
Especially I have problems regarding the correct sign - in cases like this:
diffAngle(20, -170) where I was expecting -170 , but I get 170.
More information about the SciPy-User