Skip to content

Commit

Permalink
Flattened orbits on loading from Json.
Browse files Browse the repository at this point in the history
  • Loading branch information
se5a committed Apr 21, 2024
1 parent c241077 commit 68e4685
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ public static Entity Create(Game game, StarSystem system, Entity sun, DateTime e
(double?)orbit["eclipticInclination"] * Math.PI/180 ??
0;

//flatten the inclination, we're only using inclination to define prograde vs retrograde orbits.
//if we go to 3d orbits this section will need to be removed.
//this is currently also flattened in OrbitEllipseBaseClass for drawing.
eclipticInclination = Angle.NormaliseRadiansPositive(eclipticInclination);
if (eclipticInclination > 0.5 * Math.PI && eclipticInclination < 1.5 * Math.PI)
eclipticInclination = Math.PI;
else
eclipticInclination = 0;


double loAN = (double?)orbit["LoAN_r"] ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ public OrbitIconBase(EntityState entityState, List<List<UserOrbitSettings>> sett
_eccentricity = (float)_orbitDB.Eccentricity;
_linearEccentricity = (float)(_eccentricity * _orbitDB.SemiMajorAxis); //linear ecentricity


if (_orbitDB.Inclination > 1/2 * Math.PI && _orbitDB.Inclination < 3/2 * Math.PI * 2)
var inclination = Angle.NormaliseRadiansPositive(_orbitDB.Inclination);
if (inclination > 0.5 * Math.PI && inclination < 1.5 * Math.PI)
{
IsRetrogradeOrbit = true;
//_loP_Degrees = (float)(_orbitDB.LongitudeOfAscendingNode - _orbitDB.ArgumentOfPeriapsis);
Expand Down

0 comments on commit 68e4685

Please sign in to comment.