Angle, added 360deg functions + formatting

This commit is contained in:
Klaus Basan
2019-01-31 22:25:07 +01:00
committed by Mat Sutcliffe
parent a8c586e174
commit d713e8a264
2 changed files with 25 additions and 4 deletions

View File

@@ -117,6 +117,14 @@ namespace BlackMisc
this->switchUnit(u);
}
void CAngle::normalizeTo360Degrees()
{
const double v = normalizeDegrees360(this->value(CAngleUnit::deg()));
const CAngleUnit u = this->getUnit();
*this = CAngle(v, CAngleUnit::deg());
this->switchUnit(u);
}
CAngle CAngle::normalizedToPlusMinus180Degrees() const
{
CAngle copy(*this);
@@ -124,6 +132,13 @@ namespace BlackMisc
return copy;
}
CAngle CAngle::normalizedTo360Degrees() const
{
CAngle copy(*this);
copy.normalizeTo360Degrees();
return copy;
}
double CAngle::normalizeDegrees180(double degrees, int roundDigits)
{
double d = CMathUtils::normalizeDegrees360(degrees + 180.0) - 180.0;