Ok, I agree, my math is rusty and it stinks and my brain is completely empty right now.
I have a function that delivers me angles in the range of 0 to 360 degrees (or 0 to 2PI if you prefer). When I use this function with the gyroscope data, I see that when it says the device is 270 degrees, it is in fact zero degrees. So, if I rotate it from 270 to 360, I need the angles to be varying from 0 to 90.
How do I convert this?
If I simply subtract 270 degrees from the values coming, I will end with negative angles and I don’t want that. What I need is to shift the values so:
270 degrees... will become zero,
360 (=0)... will become 90,
90 will be 180 and
180 will be 270.
How do I shift that mathematically speaking.
thanks.
Or in one step: