47 return (absAngle - 360);
57 return (relAngle + 360);
67 int val = (absAngleA + angle) % 360;
68 if (val < 0) val += 360;
78 int val = (absAngleA - angle) % 360;
79 if (val < 0) val += 360;
89 int val = relAngleA + angle;
91 if (val > 180) val -= 360;
92 if (val < -180) val += 360;
102 int val = relAngleA - angle;
104 if (val > 180) val -= 360;
105 if (val < -180) val += 360;
133 TEST((
AngleAbsAdd(270, -100) == 170),
"AbsAdd -100");
139 TEST((
AngleAbsSub(270, 100) == 170),
"AbsSub 100");
140 TEST((
AngleAbsSub(270, -100) == 10),
"AbsSub -100");
146 TEST((
AngleRelAdd(170, 100) == -90),
"RelAdd 100");
147 TEST((
AngleRelAdd(10, -100) == -90),
"RelAdd -100");
151 TEST((
AngleRelAdd(10, -500) == -130),
"RelAdd -500");
154 TEST((
AngleRelSub(270, 100) == 170),
"RelSub 100");
155 TEST((
AngleRelSub(270, -100) == 10),
"RelSub -100");
158 TEST((
AngleRelSub(10, 500) == -130),
"RelSub 500");
int AngleRelSub(int relAngleA, int angle)
Subtracts angle from a relative angle (-180 .. 180) relAngleA. Returns a relative angle properly trun...
Debugging utility macros.
int AngleAbsAdd(int absAngleA, int angle)
Adds angle to an absolute angle (0 .. 360) absAngleA. Returns an absolute angle properly truncated to...
int AngleRelAdd(int relAngleA, int angle)
Adds angle to a relative angle (-180 .. 180) relAngleA. Returns a relative angle properly truncated t...
int AngleAbsToRel(int absAngle)
Converts absolute angle (0 .. 360) to relative angle (-180 .. 180)
int AngleAbsSub(int absAngleA, int angle)
Subtracts angle from an absolute angle (0 .. 360) absAngleA. Returns an absolute angle properly trunc...
int AngleRelToAbs(int relAngle)
Converts relative angle (-180 .. 180) to absolute angle (0 .. 360)