I want to take a floating point number (which will be between 0.0 and 360.0) and rotate that value by + 180 degrees.
So 0.0 would become 180.0
90.0 would become 270.0
180.0 would become 0.0
270 would become 90.0
I am thinking of the following algorithm, but it seems a bit crude? Is there a simpler way?:
If number < 180 then add 180 else if number > 180 then subtract 180.
Modulo operation for integers, also works for floats in some languages (Python etc). There are also special functions like C++
fmod