WIP RESET THIS

This commit is contained in:
ktyl 2022-09-07 00:55:16 +01:00
parent 5ad70b3f9c
commit acfd70841f
2 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,13 @@
using Vim.Math3d;
using static System.Math;
public static class IOrbitalElementsExtensions
{
/// <summary>
/// Get the Cartesian position on the orbit for a given mean anomaly.
/// </summary>
/// <param name="M">Mean anomaly</param>
/// <returns>Position</returns>
public static DVector2 GetEccentricPosition2D(this OrbitalElements elements, double M) =>
Kepler.GetEccentricPosition2D(elements.e, elements.a, M);
}

View File

@ -0,0 +1,46 @@
public struct OrbitalElements
{
private Ellipse _ellipse;
/// <summary>
/// Semi-major axis in AU
/// </summary>
public double a => _ellipse.a;
/// <summary>
/// Eccentricity
/// </summary>
public double e => _ellipse.e;
/// <summary>
/// Inclination in degrees
/// </summary>
public double i { get; private set; }
/// <summary>
/// Argument of ascending node in degrees
/// </summary>
public double W { get; private set; }
/// <summary>
/// Argument of periapsis in degrees
/// </summary>
public double p { get; private set; }
/// <summary>
/// Mean anomaly at epoch
/// </summary>
public double M0 { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="a">Semi-major axis in AU</param>
/// <param name="e">eccentricity</param>
/// <param name="i">Inclination in degrees</param>
/// <param name="W">Argument of ascending node in degrees</param>
/// <param name="p">Argument of periapsis in degrees</param>
/// <param name="M0">Mean anomaly at epoch</param>
public OrbitalElements(double a, double e, double i, double W, double p, double M0)
{
_ellipse = new Ellipse(a, e);
this.i = i;
this.W = W;
this.p = p;
this.M0 = M0;
}
}