mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
Ref T429, functions for angle, heading and situation
* normalize angle -180/+180 when set on situation * clamp vector function
This commit is contained in:
@@ -109,6 +109,21 @@ namespace BlackMisc
|
||||
return std::tan(this->value(CAngleUnit::rad()));
|
||||
}
|
||||
|
||||
void CAngle::normalizeToPlusMinus180Degrees()
|
||||
{
|
||||
const double v = normalizeDegrees180(this->value(CAngleUnit::deg()));
|
||||
const CAngleUnit u = this->getUnit();
|
||||
*this = CAngle(v, CAngleUnit::deg());
|
||||
this->switchUnit(u);
|
||||
}
|
||||
|
||||
CAngle CAngle::normalizedToPlusMinus180Degrees() const
|
||||
{
|
||||
CAngle copy(*this);
|
||||
copy.normalizeToPlusMinus180Degrees();
|
||||
return copy;
|
||||
}
|
||||
|
||||
double CAngle::normalizeDegrees180(double degrees, int roundDigits)
|
||||
{
|
||||
double d = CMathUtils::normalizeDegrees360(degrees + 180.0) - 180.0;
|
||||
|
||||
Reference in New Issue
Block a user