示例#1
0
 /// <summary>
 /// Sets the eccentric anomaly and updates all other anomalies.
 /// </summary>
 /// <param name="e">The e.</param>
 public void SetEccentricAnomaly(double e)
 {
     if (!IsValidOrbit)
     {
         return;
     }
     e %= Mathd.PI_2;
     EccentricAnomaly = e;
     if (Eccentricity < 1)
     {
         if (e < 0)
         {
             e = Mathd.PI_2 + e;
         }
         EccentricAnomaly = e;
         TrueAnomaly      = CelestialBodyUtils.ConvertEccentricToTrueAnomaly(e, Eccentricity);
         MeanAnomaly      = EccentricAnomaly - Eccentricity * Math.Sin(EccentricAnomaly);
     }
     else
     {
         TrueAnomaly = CelestialBodyUtils.ConvertEccentricToTrueAnomaly(e, Eccentricity);
         MeanAnomaly = Math.Sinh(EccentricAnomaly) * Eccentricity - EccentricAnomaly;
     }
     SetPositionByCurrentAnomaly();
     SetVelocityByCurrentAnomaly();
 }
示例#2
0
 public void SetEccentricAnomaly(double e)
 {
     if (!isValidOrbit)
     {
         return;
     }
     e %= Mathd.PI_2;
     eccentricAnomaly = e;
     if (eccentricity < 1)
     {
         if (e < 0)
         {
             e = Mathd.PI_2 + e;
         }
         eccentricAnomaly = e;
         trueAnomaly      = CelestialBodyUtils.ConvertEccentricToTrueAnomaly(e, eccentricity);
         meanAnomaly      = eccentricAnomaly - eccentricity * System.Math.Sin(eccentricAnomaly);
     }
     else
     {
         trueAnomaly = CelestialBodyUtils.ConvertEccentricToTrueAnomaly(e, eccentricity);
         meanAnomaly = System.Math.Sinh(eccentricAnomaly) * eccentricity - eccentricAnomaly;
     }
     SetPositionByCurrentAnomaly();
     SetVelocityByCurrentAnomaly();
 }
示例#3
0
 /// <summary>
 /// Sets the mean anomaly and updates all other anomalies.
 /// </summary>
 /// <param name="m">The m.</param>
 public void SetMeanAnomaly(double m)
 {
     if (!IsValidOrbit)
     {
         return;
     }
     MeanAnomaly = m % Mathd.PI_2;
     if (Eccentricity < 1)
     {
         if (MeanAnomaly < 0)
         {
             MeanAnomaly += Mathd.PI_2;
         }
         EccentricAnomaly = CelestialBodyUtils.KeplerSolver(MeanAnomaly, Eccentricity);
         TrueAnomaly      = CelestialBodyUtils.ConvertEccentricToTrueAnomaly(EccentricAnomaly, Eccentricity);
     }
     else
     {
         EccentricAnomaly = CelestialBodyUtils.KeplerSolverHyperbolicCase(MeanAnomaly, Eccentricity);
         TrueAnomaly      = CelestialBodyUtils.ConvertEccentricToTrueAnomaly(EccentricAnomaly, Eccentricity);
     }
     SetPositionByCurrentAnomaly();
     SetVelocityByCurrentAnomaly();
 }
示例#4
0
 /// <summary>
 /// Gets the velocity vector value at eccentric anomaly.
 /// </summary>
 /// <param name="eccentricAnomaly">The eccentric anomaly.</param>
 /// <returns>Velocity vector.</returns>
 public Vector3d GetVelocityAtEccentricAnomaly(double eccentricAnomaly)
 {
     return(GetVelocityAtTrueAnomaly(CelestialBodyUtils.ConvertEccentricToTrueAnomaly(eccentricAnomaly, Eccentricity)));
 }