How to map atan2() to degrees 0-360

Solution using Modulo A simple solution that catches all cases. degrees = (degrees + 360) % 360; // +360 for implementations where mod returns negative numbers Explanation Positive: 1 to 180 If you mod any positive number between 1 and 180 by 360, you will get the exact same number you put in. Mod here … Read more