I have a function that returns an angle. However, sometimes the returned value (degrees) is negative, or it is below 0, or it is greater than 360.
How do I clip the returned value so that it is always between 0 and 360, and is always positive? Do I use the modulo function for this?
Thanks.
You could, indeed, use modulo, at the only condition that your wanted range doesn't include 360°. The range would therefore be [0°, 360°[.