Skip to content

Commit

Permalink
Argument of perigee only valid if both inclination and eccentricity a…
Browse files Browse the repository at this point in the history
…re non-zero (JSBSim-Team#981)
  • Loading branch information
seanmcleod authored Nov 11, 2023
1 parent f92eca7 commit 44a3acd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/models/FGPropagate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,15 +512,18 @@ void FGPropagate::ComputeOrbitalParameters(void)
else {
RightAscension = 0.0;
N = {1., 0., 0.};
PerigeeArgument = 0.0;
}
R.Normalize();
double vr = DotProduct(R, VState.vInertialVelocity);
FGColumnVector3 eVector = (VState.vInertialVelocity*angularMomentum/in.GM - R);
Eccentricity = eVector.Magnitude();
if (Eccentricity > 1E-8) {
eVector /= Eccentricity;
PerigeeArgument = acos(DotProduct(N, eVector))*radtodeg;
if (eVector(eZ) < 0) PerigeeArgument = 360. - PerigeeArgument;
if (abs(Inclination) > 1E-8) {
PerigeeArgument = acos(DotProduct(N, eVector)) * radtodeg;
if (eVector(eZ) < 0) PerigeeArgument = 360. - PerigeeArgument;
}
}
else
{
Expand Down

0 comments on commit 44a3acd

Please sign in to comment.