[Math] Get Rotation in degrees (0-360) from a rotated angle

geometryrotations

I have a rectangle that is facing up. ($0^\circ$)

I'm getting a number bettween $-1000$ to $1000$ or even more, and this number is the angle that is rotating the rectangle.

How can I know the degrees it is facing now?

Best Answer

This question was answered in a comment:

Rotating by $360^{\circ}$ is equivalent to not rotating at all, so just keep adding or subtracting multiples of it until you get something in $[0,360]$. (More specifically, $x\mapsto x−360⌊x/360⌋$, where $⌊\cdot⌋$ is the floor function.) – anon Aug 28 '11 at 9:05