WIP - RESET THIS
This commit is contained in:
parent
8c1bb4dadf
commit
f84449d4e6
|
@ -0,0 +1,4 @@
|
|||
public static class IMassiveExtensions
|
||||
{
|
||||
public static double U(this IMassive m) => Kepler.U(m.Mass);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
using Vim.Math3d;
|
||||
|
||||
public interface IOrbit
|
||||
{
|
||||
Ellipse Ellipse { get; }
|
||||
DVector3 GetPosition(float t);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -2,7 +2,7 @@ using Godot;
|
|||
using System;
|
||||
using Vim.Math3d;
|
||||
|
||||
public class Orbit
|
||||
public class Orbit : IOrbit
|
||||
{
|
||||
// The position of the primary body relative to the ellipse - the
|
||||
// orbit itself is presented as being centred on the primary, but
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue