Skip to content

Commit 44a3acd

Browse files
authored
Argument of perigee only valid if both inclination and eccentricity are non-zero (#981)
1 parent f92eca7 commit 44a3acd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/models/FGPropagate.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,15 +512,18 @@ void FGPropagate::ComputeOrbitalParameters(void)
512512
else {
513513
RightAscension = 0.0;
514514
N = {1., 0., 0.};
515+
PerigeeArgument = 0.0;
515516
}
516517
R.Normalize();
517518
double vr = DotProduct(R, VState.vInertialVelocity);
518519
FGColumnVector3 eVector = (VState.vInertialVelocity*angularMomentum/in.GM - R);
519520
Eccentricity = eVector.Magnitude();
520521
if (Eccentricity > 1E-8) {
521522
eVector /= Eccentricity;
522-
PerigeeArgument = acos(DotProduct(N, eVector))*radtodeg;
523-
if (eVector(eZ) < 0) PerigeeArgument = 360. - PerigeeArgument;
523+
if (abs(Inclination) > 1E-8) {
524+
PerigeeArgument = acos(DotProduct(N, eVector)) * radtodeg;
525+
if (eVector(eZ) < 0) PerigeeArgument = 360. - PerigeeArgument;
526+
}
524527
}
525528
else
526529
{

0 commit comments

Comments
 (0)