mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
Ref T111, normalize utility functions
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4e45496431
commit
9445bd56a3
@@ -126,5 +126,18 @@ namespace BlackMisc
|
||||
{
|
||||
return std::tan(this->value(CAngleUnit::rad()));
|
||||
}
|
||||
|
||||
double CAngle::normalizeDegrees180(double degrees, int roundDigits)
|
||||
{
|
||||
double d = CMathUtils::normalizeDegrees360(degrees + 180.0) - 180.0;
|
||||
if (d <= -180.0) { d = 180.0; } // -180 -> 180
|
||||
return roundDigits < 0 ? d : CMathUtils::round(d, roundDigits);
|
||||
}
|
||||
|
||||
double CAngle::normalizeDegrees360(double degrees, int roundDigits)
|
||||
{
|
||||
const double d = CMathUtils::normalizeDegrees360(degrees);
|
||||
return roundDigits < 0 ? d : CMathUtils::round(d, roundDigits);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user