mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
41 lines
1.8 KiB
C#
41 lines
1.8 KiB
C#
using NewHorizons.External.Modules;
|
|
namespace NewHorizons.Components.Orbital
|
|
{
|
|
public class NHAstroObject : AstroObject, IOrbitalParameters
|
|
{
|
|
public float Inclination { get; set; }
|
|
public float SemiMajorAxis { get; set; }
|
|
public float LongitudeOfAscendingNode { get; set; }
|
|
public float Eccentricity { get; set; }
|
|
public float ArgumentOfPeriapsis { get; set; }
|
|
public float TrueAnomaly { get; set; }
|
|
public bool HideDisplayName { get; set; }
|
|
|
|
public void SetOrbitalParametersFromConfig(OrbitModule orbit)
|
|
{
|
|
SetOrbitalParametersFromTrueAnomaly(orbit.Eccentricity, orbit.SemiMajorAxis, orbit.Inclination, orbit.ArgumentOfPeriapsis, orbit.LongitudeOfAscendingNode, orbit.TrueAnomaly);
|
|
}
|
|
|
|
public void SetOrbitalParametersFromTrueAnomaly(float ecc, float a, float i, float p, float l, float trueAnomaly)
|
|
{
|
|
Inclination = ecc;
|
|
SemiMajorAxis = a;
|
|
LongitudeOfAscendingNode = l;
|
|
Inclination = i;
|
|
Eccentricity = ecc;
|
|
ArgumentOfPeriapsis = p;
|
|
TrueAnomaly = trueAnomaly;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"ParameterizedAstroObject: Eccentricity {Eccentricity}, SemiMajorAxis {SemiMajorAxis}, Inclination {Inclination}, ArgumentOfPeriapsis {ArgumentOfPeriapsis}, LongitudeOfAscendingNode {LongitudeOfAscendingNode}, TrueAnomaly {TrueAnomaly}";
|
|
}
|
|
|
|
public OrbitalParameters GetOrbitalParameters(Gravity primaryGravity, Gravity secondaryGravity)
|
|
{
|
|
return OrbitalParameters.FromTrueAnomaly(primaryGravity, secondaryGravity, Eccentricity, SemiMajorAxis, Inclination, ArgumentOfPeriapsis, LongitudeOfAscendingNode, TrueAnomaly);
|
|
}
|
|
}
|
|
}
|