Quote:
Originally Posted by Gray Adams
Why not just...
Code:
public static double boundAngle0to360Degrees(double angle)
{
return((angle+360)%360);
}
|
Yeah! I like that one a lot...
For the c++ wind river people out there who look at this... you cannot use the modulo operator on doubles but you can use the fmod() offered in math.h
Code:
return (fmod ((angle+360.0) , 360.0)); //c++
//That function reminded me of this one:
//Here is another cool function I pulled from our NewTek code that is
//slightly similar and cute...
int Rotation_ = (((Info->Orientation_Rotation + 45) / 90) % 4) * 90;
//Can you see what this does?