Is there an easy way to convert an angle (in degrees) to be between -179 and 180? I\'m sure I could use mod (%) and some if statements, but it gets ugly:
/
Here is an integer-only solution:
int normalize(int angle) { angle %= 360; int fix = angle / 180; // Integer division!! return (fix) ? angle - (360 * (fix)) : angle; }
Sometimes being clever is just more fun, Platinum Azure.