Fix normalization of heading-mag-deg
This commit is contained in:
parent
1f07a8eba8
commit
b69055ffca
1 changed files with 5 additions and 2 deletions
|
@ -463,8 +463,11 @@ FGProperties::update (double dt)
|
||||||
_rwday->setIntValue(r->tm_wday);
|
_rwday->setIntValue(r->tm_wday);
|
||||||
|
|
||||||
const double magvar = _magVar->getDoubleValue();
|
const double magvar = _magVar->getDoubleValue();
|
||||||
_headingMagnetic->setDoubleValue(_trueHeading->getDoubleValue() - magvar);
|
const auto hdgMag = SGMiscd::normalizePeriodic(0, 360.0, _trueHeading->getDoubleValue() - magvar);
|
||||||
_trackMagnetic->setDoubleValue(_trueTrack->getDoubleValue() - magvar);
|
_headingMagnetic->setDoubleValue(hdgMag);
|
||||||
|
|
||||||
|
const auto trackMag = SGMiscd::normalizePeriodic(0, 360.0, _trueTrack->getDoubleValue() - magvar);
|
||||||
|
_trackMagnetic->setDoubleValue(trackMag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue