python - Get angles in the range -180 to +180 -


Before I start thanking everyone.

Through my application, I am in angles when I run the Python script, the value is typically collected in the variable.

Suppose that the range is -180 to 180.

And I got an angle in the form of -180. According to the requirement this should be a +/- 1 degree window; i.e; Between 179 and -179

How will I check if falling in that border?

  Angle = -180 tolerance = 1 (in degrees) If (180-1) & lt; = -180 & lt; = (-180 + 1): # statement angle -1 = -179 tolerance = 1 if (-170-1) & lt; = -179 & lt; = (-179 + 1): # statement angle 2 = 179 tolerance = 1 if (17 9-1) & lt; = 179 & lt; = (17 9 + 1): # statement  

Will this work for all angle combinations? What do you think?

  if -180 & lt; X & lt; 180: # Something  

This category covers -179 and 179, but not -180 and 180.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -