21#include <entt/entt.hpp>
152glm::dvec3
ConvertOrbParams(
const double LAN,
const double i,
const double w,
const glm::dvec3& vec);
155 const glm::dvec3& vec);
157glm::dvec3
MatrixConvertOrbParams(
const double LAN,
const double i,
const double w,
const glm::dvec3& vec);
209Orbit Vec3ToOrbit(
const glm::dvec3& position,
const glm::dvec3& velocity,
const double& GM,
const double& time);
224double OrbitVelocity(
const double v,
const double e,
const double a,
const double GM);
239double SolveKeplerElliptic(
const double& mean_anomaly,
const double& ecc,
const int steps = 200);
267double GetMtElliptic(
const double& M0,
const double& nu,
const double& time,
const double& epoch);
276double GetMtHyperbolic(
const double& M0,
const double& nu,
const double& time,
const double& epoch);
316Orbit
ApplyImpulse(
const Orbit& orbit,
const glm::dvec3& impulse,
double time);
Definition: coordinates.cpp:22
double TrueAnomalyFromVector(const Orbit &orbit, const glm::dvec3 &vec)
Definition: orbit.cpp:365
double GetTrueAnomalyToAsymptope(const Orbit &orbit)
Calculates v_inf, the true anomaly for the asymtope for a hyperbolic orbit The orbit is bouded within...
Definition: orbit.cpp:135
double CalculateTransferAngle(const Orbit &start_orbit, const Orbit &end_orbit)
Definition: orbit.cpp:338
glm::dvec3 CalculateVelocityHyperbolic(const double &E, const double &r, const double &GM, const double &a, const double &e)
Definition: orbit.cpp:291
glm::dvec3 OrbitTimeToVec3(const Orbit &orb, const second &time)
Definition: orbit.cpp:318
radian HyperbolicAnomaly(double v, double e)
Definition: orbit.cpp:262
glm::dvec3 ConvertOrbParams(const double LAN, const double i, const double w, const glm::dvec3 &vec)
Transforms a vector to the orbital plane vector
Definition: orbit.cpp:44
double GetOrbitingRadius(const double &e, const double &a, const double &v)
Definition: orbit.cpp:28
glm::dvec3 ConvertToOrbitalVector(const double LAN, const double i, const double w, const double v, const glm::dvec3 &vec)
Definition: orbit.cpp:49
glm::dvec3 GetOrbitNormal(const Orbit &orbit)
Definition: orbit.cpp:360
double GetHyperbolicAsymptopeAnomaly(double eccentricity)
Definition: orbit.cpp:354
glm::dvec3 CalculateVelocityElliptic(const double &E, const double &r, const double &GM, const double &a, const double &e)
Definition: orbit.cpp:296
double second
Definition: units.h:42
double GetMtHyperbolic(const double &M0, const double &nu, const double &time, const double &epoch)
Calculate mean anomaly from time for a hyperbolic object
Definition: orbit.cpp:229
Orbit ApplyImpulse(const Orbit &orbit, const glm::dvec3 &impulse, double time)
Applies impulse based on the vector impulse For some reason y is prograde, I'm not sure what the othe...
Definition: orbit.cpp:301
glm::vec3 toVec3(const SurfaceCoordinate &coord, const float &radius)
Converts surface coordinate to vector3 in space so that we can get the surface coordinate to render i...
Definition: coordinates.cpp:33
glm::dvec3 OrbitToVec3(const double &a, const double &e, const radian &i, const radian &LAN, const radian &w, const radian &v)
Converts an orbit to a vec3.
Definition: orbit.cpp:138
constexpr double KmInAu
Definition: units.h:49
double AscendingTrueAnomaly(const Orbit &start, const Orbit &dest)
Definition: orbit.cpp:382
constexpr double SunMu
Definition: units.h:57
double GetMtElliptic(const double &M0, const double &nu, const double &time, const double &epoch)
Gets the Mean anomaly from the time
Definition: orbit.cpp:223
double kilometer
Definition: units.h:34
glm::dvec3 MatrixConvertOrbParams(const double LAN, const double i, const double w, const glm::dvec3 &vec)
Definition: orbit.cpp:36
double radian
Definition: units.h:37
double SolveKeplerHyperbolic(const double &mean_anomaly, const double &ecc, const int steps)
Computes eccentric anomaly for a hyperbolic or parabolic orbit (e > 1) in radians given mean anomaly ...
Definition: orbit.cpp:193
radian EccentricAnomaly(double v, double e)
Calculates Eccentric anomaly
Definition: orbit.cpp:260
double OrbitVelocity(const double v, const double e, const double a, const double GM)
Definition: orbit.cpp:151
constexpr radian normalize_radian(const radian &radian)
Normalizes a radian to [0, PI*2)
Definition: units.h:70
double SolveKeplerElliptic(const double &mean_anomaly, const double &ecc, const int steps)
Computes eccentric anomaly for a elliptic or circular orbit (e < 1) in radians given mean anomaly and...
Definition: orbit.cpp:173
glm::dvec3 CalculateVelocity(const double &E, const double &r, const double &GM, const double &a, const double &e)
Definition: orbit.cpp:283
double GetTrueAnomaly(const Orbit &orb, const second &epoch)
Get anomaly at epoch
Definition: orbit.cpp:273
constexpr double PI
Definition: units.h:45
double CalculateTransferTime(const Orbit &orb1, const Orbit &orb2)
Definition: orbit.cpp:329
radian TrueAnomalyHyperbolic(const Orbit &orbit, const second &time)
Definition: orbit.cpp:249
void UpdateOrbit(Orbit &orb, const second &time)
Updates the orbit's true anomaly.
Definition: orbit.cpp:264
double GetCircularOrbitingVelocity(const double &GM, const double &radius)
Get the circular orbiting velocity for the radius.
Definition: orbit.cpp:247
double HyperbolicAnomalyToTrueAnomaly(const double &ecc, const double &H)
Definition: orbit.cpp:217
Orbit Vec3ToOrbit(const glm::dvec3 &position, const glm::dvec3 &velocity, const double &GM, const double &time)
Converts position and velocity to orbit. Note: you will have to set the reference body after the orbi...
Definition: orbit.cpp:56
double AvgOrbitalVelocity(const Orbit &orb)
Definition: orbit.cpp:158
double FlightPathAngle(double eccentricity, double v)
Definition: orbit.cpp:356
glm::dvec3 Vec3AU
A vector3 where the units are astronomical units
Definition: orbit.h:32
double CalculatePhaseAngle(const Orbit &start_orbit, const Orbit &end_orbit, double epoch)
Definition: orbit.cpp:347
Vec3AU toVec3AU(const Orbit &orb, radian theta)
Convert orbit to AU coordinates
Definition: orbit.h:301
radian TrueAnomalyElliptic(const Orbit &orbit, const second &time)
Definition: orbit.cpp:234
double EccentricAnomalyToTrueAnomaly(const double &ecc, const double &E)
Calculates true anomaly from eccentricity and eccentric anomaly
Definition: orbit.cpp:213
glm::dvec3 OrbitVelocityToVec3(const Orbit &orb, double v)
Definition: orbit.cpp:160
void UpdatePos(Kinematics &kin, const Orbit &orb)
Updates the position of an orbit, in AU.
Definition: orbit.h:343
double OrbitVelocityAtR(const double GM, const double a, const double r)
Definition: orbit.cpp:316
Relative position from the parent orbiting object.
Definition: coordinates.h:32
glm::dvec3 position
Definition: coordinates.h:33
double eccentricity
Definition: orbit.h:45
double GetOrbitingRadius(const double &v) const
Definition: orbit.h:123
radian M0
Definition: orbit.h:80
double GM
Gravitational constant of the reference body this is orbiting Graviational constant * mass of orbitin...
Definition: orbit.h:100
radian LAN
Definition: orbit.h:66
kilometer semi_major_axis
Definition: orbit.h:52
Orbit(kilometer semi_major_axis, double eccentricity, radian inclination, radian LAN, radian w, radian M0)
Definition: orbit.h:109
double GetOrbitingRadius() const
Definition: orbit.h:121
double nu() const
Definition: orbit.h:131
double GetApoapsis() const
Definition: orbit.h:133
radian inclination
Definition: orbit.h:59
entt::entity reference_body
Definition: orbit.h:103
double GetPeriapsis() const
Definition: orbit.h:135
double epoch
Definition: orbit.h:82
double GetMtElliptic(double time) const
Definition: orbit.h:119
radian v
True anomaly v Radians
Definition: orbit.h:91
double T() const
Definition: orbit.h:128
radian w
Definition: orbit.h:73
double TimeToTrueAnomaly(double v2) const
Definition: orbit.cpp:387
double true_anomaly
Definition: orbit.h:141