under the RS_Math segment of code there is a function called correctAngle....
the segment is as follows....
/**
* Corrects the given angle to the range of 0-2*Pi.
*/
double RS_Math::correctAngle(double a) {
return M_PI + remainder(a - M_PI, m_piX2);
}
It does not do as it suggests....output range is actually from 180 to 540 (PI to PI+2*PI)
ie
0 becomes 360.
90 becomes 450.
179 becomes 539.
180 becomes 180.
180 to 360 map through correctly to 180 to 360.
361 becomes 361.
539 becomes 539.
negative numbers....
-180 to -1 map through correctly to 180 to 359.
-181 becomes 539.
Because this angle formula is use widely throughout this application it
is hard to determine how much coding is affected by this.
At the very least the associated comment documentation should be changed to reflect
the underlying function.
Proof of this behavior is an attached excel spreadsheet below that implements the
equivalent formula in a spreadsheet. The input angle argument field is highlighted in yellow
in the spreadsheet.
correctAngle.xlsNOTE: the undocumented function directly below correctAngle
called correctAngleU actually performs as described by the original
description.
It however is only referenced once by getAngleDifferenceU
double RS_Math::correctAngleU(double a) {
return remainder(a, m_piX2);
}