|
Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
|
Classes | |
| struct | FuturePosition |
| struct | GalacticCoordinate |
| Way to position star systems on the universe. More... | |
| struct | Impulse |
| struct | Kinematics |
| Relative position from the parent orbiting object. More... | |
| struct | MoveTarget |
| struct | Orbit |
| struct | OrbitDirty |
| struct | PolarCoordinate_tp |
| struct | SetTrueAnomaly |
| struct | SurfaceCoordinate |
| Longitude and lattitude. Planet coordinates. More... | |
Typedefs | |
| typedef PolarCoordinate_tp< types::astronomical_unit > | PolarCoordinate |
| typedef glm::dvec3 | Vec3AU |
| A vector3 where the units are astronomical units More... | |
| typedef double | astronomical_unit |
| typedef double | light_year |
| typedef double | kilometer |
| typedef double | solar_mass |
| typedef double | degree |
| typedef double | radian |
| typedef double | meter_cube |
| typedef double | kilogram |
| typedef double | earth_masses |
| typedef double | joule |
| typedef double | second |
Enumerations | |
| enum | UnitType { Distance , Angle , Mass , Volume , Time } |
| enum | Distance { LightYear , AstronomicalUnit , Kilometer , Meter , Centimeter , Millimeter } |
Functions | |
| double | GreatCircleDistance (SurfaceCoordinate &coord1, SurfaceCoordinate &coord2) |
| Calculates the angle between the two coordinates. Just multiply by the planet's diameter for fun and engagement. More... | |
| glm::vec3 | toVec3 (const SurfaceCoordinate &coord, const float &radius=1) |
| Converts surface coordinate to vector3 in space so that we can get the surface coordinate to render in space More... | |
| double | GetLaunchAzimuth (double latitude, double inclination) |
| Calculates the azimuth of the orbit based on the latitude and inclination More... | |
| double | GetLaunchInclination (double latitude, double azimuth) |
| Calculates the inclination of the orbit based on the latitude and azimuth More... | |
| SurfaceCoordinate | ToSurfaceCoordinate (const glm::vec3 &vec) |
| glm::vec3 | toVec3 (const PolarCoordinate &coordinate) |
| 2D polar coordinate to opengl 3d coordinate More... | |
| double | GetOrbitingRadius (const double e, const kilometer a, const radian v) |
| glm::dvec3 | MatrixConvertOrbParams (const double LAN, const double i, const double w, const glm::dvec3 &vec) |
| glm::dvec3 | ConvertOrbParams (const double LAN, const double i, const double w, const glm::dvec3 &vec) |
| Transforms a vector to the orbital plane vector More... | |
| glm::dvec3 | ConvertToOrbitalVector (const double LAN, const double i, const double w, const double v, const glm::dvec3 &vec) |
| glm::dvec3 | GetEccentricityVector (const glm::dvec3 &h, const glm::dvec3 &r, const glm::dvec3 &v, const double GM) |
| glm::dvec3 | GetEccentricityVector (const glm::dvec3 &r, const glm::dvec3 &v, const double GM) |
| 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 orbit is returned More... | |
| double | GetTrueAnomalyToAsymptope (const Orbit &orbit) |
| Calculates v_inf, the true anomaly for the asymtope for a hyperbolic orbit The orbit is bouded within -v_inf < v < v_inf https://orbital-mechanics.space/the-orbit-equation/hyperbolic-trajectories.html#hyperbolic-trajectories-e-1. More... | |
| 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. More... | |
| double | OrbitVelocity (const double v, const double e, const double a, const double GM) |
| double | AvgOrbitalVelocity (const Orbit &orb) |
| glm::dvec3 | OrbitVelocityToVec3 (const Orbit &orb, double v) |
| glm::dvec3 | OrbitVelocityToVec3 (const Orbit &orb) |
| double | SolveKeplerElliptic (const double &mean_anomaly, const double &ecc, const int steps=200) |
| Computes eccentric anomaly for a elliptic or circular orbit (e < 1) in radians given mean anomaly and eccentricity More... | |
| double | SolveKeplerHyperbolic (const double &mean_anomaly, const double &ecc, const int steps=200) |
| Computes eccentric anomaly for a hyperbolic or parabolic orbit (e > 1) in radians given mean anomaly and eccentricity More... | |
| double | EccentricAnomalyToTrueAnomaly (const double &ecc, const double &E) |
| Calculates true anomaly from eccentricity and eccentric anomaly More... | |
| double | HyperbolicAnomalyToTrueAnomaly (const double &ecc, const double &H) |
| double | GetMtElliptic (const double &M0, const double &nu, const double &time, const double &epoch) |
| Gets the Mean anomaly from the time More... | |
| double | GetMtHyperbolic (const double &M0, const double &nu, const double &time, const double &epoch) |
| Calculate mean anomaly from time for a hyperbolic object More... | |
| radian | TrueAnomalyElliptic (const Orbit &orbit, const second &time) |
| radian | TrueAnomalyElliptic (const Orbit &orbit, const second &time, double &E_out) |
| double | GetCircularOrbitingVelocity (const double &GM, const double &radius) |
| Get the circular orbiting velocity for the radius. More... | |
| radian | TrueAnomalyHyperbolic (const Orbit &orbit, const second &time) |
| radian | EccentricAnomaly (double v, double e) |
| Calculates Eccentric anomaly More... | |
| radian | HyperbolicAnomaly (double v, double e) |
| void | UpdateOrbit (Orbit &orb, const second &time) |
| Updates the orbit's true anomaly. More... | |
| double | GetTrueAnomaly (const Orbit &orb, const second &epoch) |
| Get anomaly at epoch More... | |
| glm::dvec3 | CalculateVelocity (const double &E, const kilometer &r, const double &GM, const kilometer &a, const double &e) |
| glm::dvec3 | CalculateVelocityHyperbolic (const double &E, const double &r, const double &GM, const double &a, const double &e) |
| glm::dvec3 | CalculateVelocityElliptic (const double &E, const kilometer &r, const double &GM, const kilometer &a, const double &e) |
| 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 others are. TODO(EhWhoAmI): Determine the axis of thrust for each vector I think x is radial, and z is normal. More... | |
| double | OrbitVelocityAtR (const double GM, const double a, const double r) |
| glm::dvec3 | OrbitTimeToVec3 (const Orbit &orb, const second time) |
| glm::dvec3 | OrbitTimeToVelocityVec3 (const Orbit &orb, const second time) |
| double | CalculateTransferTime (const Orbit &orb1, const Orbit &orb2) |
| double | CalculateTransferAngle (const Orbit &start_orbit, const Orbit &end_orbit) |
| double | CalculatePhaseAngle (const Orbit &start_orbit, const Orbit &end_orbit, double epoch) |
| double | GetHyperbolicAsymptopeAnomaly (double eccentricity) |
| double | FlightPathAngle (double eccentricity, double v) |
| glm::dvec3 | GetOrbitNormal (const Orbit &orbit) |
| double | TrueAnomalyFromVector (const Orbit &orbit, const glm::dvec3 &vec) |
| double | AscendingTrueAnomaly (const Orbit &start, const Orbit &dest) |
| double | GetEccentricity (double apoapsis, double periapsis) |
| glm::dvec3 | GetRadialVector (const Orbit &orbit) |
| glm::dvec3 | GetRadialVector (const Orbit &orbit, double true_anomaly) |
| glm::dvec3 | InvertOrbitalVector (const double LAN, const double i, const double w, const double v, const glm::dvec3 &vec) |
| double | AngleWith (const Orbit &orbit, const Orbit &second_orbit) |
| std::ostream & | operator<< (std::ostream &outs, const Orbit &orb) |
| Vec3AU | toVec3AU (const Orbit &orb, radian theta) |
| Convert orbit to AU coordinates More... | |
| glm::dvec3 | toVec3 (const Orbit &orb, radian theta) |
| Converts orbit to theta More... | |
| glm::dvec3 | toVec3 (const Orbit &orb) |
| Vec3AU | toVec3AU (const Orbit &orb) |
| Converts orbit to AU coorrdinates. More... | |
| void | UpdatePos (Kinematics &kin, const Orbit &orb) |
| Updates the position of an orbit, in AU. More... | |
| constexpr double | floatmod (double x, double y) |
| constexpr radian | normalize_radian (const radian &radian) |
| Normalizes a radian to [0, PI*2) More... | |
| constexpr double | normalize_radian_coord (const radian &radian) |
| constexpr degree | normalize_degree (const degree &radian) |
| constexpr astronomical_unit | toAU (kilometer km) |
| constexpr light_year | toLightYear (astronomical_unit au) |
| constexpr astronomical_unit | LtyrtoAU (light_year ltyr) |
| constexpr kilometer | toKm (astronomical_unit au) |
| constexpr radian | toRadian (degree theta) |
| constexpr degree | toDegree (radian theta) |
| constexpr double | operator""_deg (const long double deg) |
| constexpr double | operator""_au (const long double au) |
Variables | |
| constexpr double | apoapsis = PI |
| constexpr double | periapsis = 0 |
| constexpr double | PI = 3.14159265358979323846 |
| constexpr double | TWOPI = PI * 2 |
| constexpr double | HALFPI = PI / 2 |
| constexpr double | KmInAu = 149597870.700 |
| constexpr double | G = 6.6743015e-11 |
| constexpr double | G_km = 6.6743015e-20 |
| constexpr double | SunMu = 1.32712400188e11 |
| typedef double cqsp::common::components::types::astronomical_unit |
| typedef double cqsp::common::components::types::degree |
| typedef double cqsp::common::components::types::earth_masses |
| typedef double cqsp::common::components::types::joule |
| typedef double cqsp::common::components::types::kilogram |
| typedef double cqsp::common::components::types::kilometer |
| typedef double cqsp::common::components::types::light_year |
| typedef double cqsp::common::components::types::meter_cube |
| typedef PolarCoordinate_tp<types::astronomical_unit> cqsp::common::components::types::PolarCoordinate |
| typedef double cqsp::common::components::types::radian |
| typedef double cqsp::common::components::types::second |
| typedef double cqsp::common::components::types::solar_mass |
| typedef glm::dvec3 cqsp::common::components::types::Vec3AU |
A vector3 where the units are astronomical units
| double cqsp::common::components::types::AngleWith | ( | const Orbit & | orbit, |
| const Orbit & | second_orbit | ||
| ) |
| Orbit cqsp::common::components::types::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 others are. TODO(EhWhoAmI): Determine the axis of thrust for each vector I think x is radial, and z is normal.
| orbit | |
| impulse | |
| time |
| double cqsp::common::components::types::AscendingTrueAnomaly | ( | const Orbit & | start, |
| const Orbit & | dest | ||
| ) |
| double cqsp::common::components::types::AvgOrbitalVelocity | ( | const Orbit & | orb | ) |
| double cqsp::common::components::types::CalculatePhaseAngle | ( | const Orbit & | start_orbit, |
| const Orbit & | end_orbit, | ||
| double | epoch | ||
| ) |
| double cqsp::common::components::types::CalculateTransferAngle | ( | const Orbit & | start_orbit, |
| const Orbit & | end_orbit | ||
| ) |
| double cqsp::common::components::types::CalculateTransferTime | ( | const Orbit & | orb1, |
| const Orbit & | orb2 | ||
| ) |
| glm::dvec3 cqsp::common::components::types::CalculateVelocity | ( | const double & | E, |
| const kilometer & | r, | ||
| const double & | GM, | ||
| const kilometer & | a, | ||
| const double & | e | ||
| ) |
Calculates the vector velocity of the orbit
| [in] | E | Eccentric anomaly |
| [in] | r | Orbiting radius |
| [in] | GM | G*M of orbiting body |
| [in] | a | Semi major axis |
| [in] | e | eccentricity |
| glm::dvec3 cqsp::common::components::types::CalculateVelocityElliptic | ( | const double & | E, |
| const kilometer & | r, | ||
| const double & | GM, | ||
| const kilometer & | a, | ||
| const double & | e | ||
| ) |
| glm::dvec3 cqsp::common::components::types::CalculateVelocityHyperbolic | ( | const double & | E, |
| const double & | r, | ||
| const double & | GM, | ||
| const double & | a, | ||
| const double & | e | ||
| ) |
| glm::dvec3 cqsp::common::components::types::ConvertOrbParams | ( | const double | LAN, |
| const double | i, | ||
| const double | w, | ||
| const glm::dvec3 & | vec | ||
| ) |
Transforms a vector to the orbital plane vector
All units are in radians
| LAN | Longitude of the ascending node |
| i | Inclination |
| w | Argument of periapsis |
| vec | Vector to convert |
| glm::dvec3 cqsp::common::components::types::ConvertToOrbitalVector | ( | const double | LAN, |
| const double | i, | ||
| const double | w, | ||
| const double | v, | ||
| const glm::dvec3 & | vec | ||
| ) |
| radian cqsp::common::components::types::EccentricAnomaly | ( | double | v, |
| double | e | ||
| ) |
Calculates Eccentric anomaly
| v | True anomaly |
| e | Eccentricicy |
| double cqsp::common::components::types::EccentricAnomalyToTrueAnomaly | ( | const double & | ecc, |
| const double & | E | ||
| ) |
Calculates true anomaly from eccentricity and eccentric anomaly
| [in] | ecc | The eccentricity of the orbit |
| [in] | E | The eccentric anomaly of the orbit |
| double cqsp::common::components::types::FlightPathAngle | ( | double | eccentricity, |
| double | v | ||
| ) |
|
inlineconstexpr |
| double cqsp::common::components::types::GetCircularOrbitingVelocity | ( | const double & | GM, |
| const double & | radius | ||
| ) |
Get the circular orbiting velocity for the radius.
| double cqsp::common::components::types::GetEccentricity | ( | double | apoapsis, |
| double | periapsis | ||
| ) |
Computes the eccentricity from the apoapsis and periapsis.
| glm::dvec3 cqsp::common::components::types::GetEccentricityVector | ( | const glm::dvec3 & | h, |
| const glm::dvec3 & | r, | ||
| const glm::dvec3 & | v, | ||
| const double | GM | ||
| ) |
Calculates eccentricity vector
| h | Angular momentum vector |
| r | Position vector |
| v | Velocity Vector |
| GM | Mu: gravitional constant * mass of orbiting body |
| glm::dvec3 cqsp::common::components::types::GetEccentricityVector | ( | const glm::dvec3 & | r, |
| const glm::dvec3 & | v, | ||
| const double | GM | ||
| ) |
Calculates eccentricity vector
| r | Position vector |
| v | Velocity Vector |
| GM | Mu: gravitional constant * mass of orbiting body |
| double cqsp::common::components::types::GetHyperbolicAsymptopeAnomaly | ( | double | eccentricity | ) |
| double cqsp::common::components::types::GetLaunchAzimuth | ( | double | latitude, |
| double | inclination | ||
| ) |
Calculates the azimuth of the orbit based on the latitude and inclination
| latitude | Latitude in radians |
| inclination | Launch inclination in radians |
| double cqsp::common::components::types::GetLaunchInclination | ( | double | latitude, |
| double | azimuth | ||
| ) |
Calculates the inclination of the orbit based on the latitude and azimuth
| latitude | Latitude in radians |
| azimuth | Launch azimuth in radians |
| double cqsp::common::components::types::GetMtElliptic | ( | const double & | M0, |
| const double & | nu, | ||
| const double & | time, | ||
| const double & | epoch | ||
| ) |
Gets the Mean anomaly from the time
| M0 | Mean anomaly at t=0 |
| nu | G*M of orbiting body |
| time | Current time |
| double cqsp::common::components::types::GetMtHyperbolic | ( | const double & | M0, |
| const double & | nu, | ||
| const double & | time, | ||
| const double & | epoch | ||
| ) |
Calculate mean anomaly from time for a hyperbolic object
| Mu | G*M of orbiting body |
| a | Semi-major axis |
| d+t | Time from periapsis |
| double cqsp::common::components::types::GetOrbitingRadius | ( | const double | e, |
| const kilometer | a, | ||
| const radian | v | ||
| ) |
| glm::dvec3 cqsp::common::components::types::GetOrbitNormal | ( | const Orbit & | orbit | ) |
| glm::dvec3 cqsp::common::components::types::GetRadialVector | ( | const Orbit & | orbit | ) |
| glm::dvec3 cqsp::common::components::types::GetRadialVector | ( | const Orbit & | orbit, |
| double | true_anomaly | ||
| ) |
Get anomaly at epoch
| orb | |
| epoch |
| double cqsp::common::components::types::GetTrueAnomalyToAsymptope | ( | const Orbit & | orbit | ) |
Calculates v_inf, the true anomaly for the asymtope for a hyperbolic orbit The orbit is bouded within -v_inf < v < v_inf https://orbital-mechanics.space/the-orbit-equation/hyperbolic-trajectories.html#hyperbolic-trajectories-e-1.
| orbit |
| double cqsp::common::components::types::GreatCircleDistance | ( | SurfaceCoordinate & | coord1, |
| SurfaceCoordinate & | coord2 | ||
| ) |
Calculates the angle between the two coordinates. Just multiply by the planet's diameter for fun and engagement.
| coord1 | |
| coord2 |
| radian cqsp::common::components::types::HyperbolicAnomaly | ( | double | v, |
| double | e | ||
| ) |
| double cqsp::common::components::types::HyperbolicAnomalyToTrueAnomaly | ( | const double & | ecc, |
| const double & | H | ||
| ) |
| glm::dvec3 cqsp::common::components::types::InvertOrbitalVector | ( | const double | LAN, |
| const double | i, | ||
| const double | w, | ||
| const double | v, | ||
| const glm::dvec3 & | vec | ||
| ) |
|
inlineconstexpr |
| glm::dvec3 cqsp::common::components::types::MatrixConvertOrbParams | ( | const double | LAN, |
| const double | i, | ||
| const double | w, | ||
| const glm::dvec3 & | vec | ||
| ) |
|
inlineconstexpr |
|
inlineconstexpr |
Normalizes a radian to [0, PI*2)
| [in] | Radian | to normalizes |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inline |
| glm::dvec3 cqsp::common::components::types::OrbitTimeToVec3 | ( | const Orbit & | orb, |
| const second | time | ||
| ) |
| glm::dvec3 cqsp::common::components::types::OrbitTimeToVelocityVec3 | ( | const Orbit & | orb, |
| const second | time | ||
| ) |
| glm::dvec3 cqsp::common::components::types::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.
| a | Semi major axis (unit doesn't matter) |
| e | Eccentricity (Dimensionless) |
| i | Inclinations (radians) |
| LAN | Longitude of ascending node (radians) |
| w | Argument of periapsis (radians) |
| v | True anomaly (radians) |
| double cqsp::common::components::types::OrbitVelocity | ( | const double | v, |
| const double | e, | ||
| const double | a, | ||
| const double | GM | ||
| ) |
| double cqsp::common::components::types::OrbitVelocityAtR | ( | const double | GM, |
| const double | a, | ||
| const double | r | ||
| ) |
| glm::dvec3 cqsp::common::components::types::OrbitVelocityToVec3 | ( | const Orbit & | orb | ) |
| glm::dvec3 cqsp::common::components::types::OrbitVelocityToVec3 | ( | const Orbit & | orb, |
| double | v | ||
| ) |
| double cqsp::common::components::types::SolveKeplerElliptic | ( | const double & | mean_anomaly, |
| const double & | ecc, | ||
| const int | steps = 200 |
||
| ) |
Computes eccentric anomaly for a elliptic or circular orbit (e < 1) in radians given mean anomaly and eccentricity
| mean_anomaly | |
| ecc | |
| steps | Number of steps for the Newton-Raphson. More steps means more precision but less speed |
| double cqsp::common::components::types::SolveKeplerHyperbolic | ( | const double & | mean_anomaly, |
| const double & | ecc, | ||
| const int | steps = 200 |
||
| ) |
Computes eccentric anomaly for a hyperbolic or parabolic orbit (e > 1) in radians given mean anomaly and eccentricity
| mean_anomaly | |
| ecc | |
| steps | Number of steps for the Newton-Raphson. More steps means more precision but less speed |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
| SurfaceCoordinate cqsp::common::components::types::ToSurfaceCoordinate | ( | const glm::vec3 & | vec | ) |
|
inline |
Converts orbit to theta
| orb | |
| theta | True anomaly (radians) |
|
inline |
2D polar coordinate to opengl 3d coordinate
| coordinate |
| glm::vec3 cqsp::common::components::types::toVec3 | ( | const SurfaceCoordinate & | coord, |
| const float & | radius | ||
| ) |
Converts surface coordinate to vector3 in space so that we can get the surface coordinate to render in space
Converts orbit to AU coorrdinates.
| orb | [in] orbit of the object to convert |
Convert orbit to AU coordinates
| orb | Orbit |
| theta | Theta to compute |
| radian cqsp::common::components::types::TrueAnomalyElliptic | ( | const Orbit & | orbit, |
| const second & | time | ||
| ) |
| orbit | [in] Orbit to compute |
| time | [in] Current time (seconds) |
| E_put | [out] Eccentric anomaly |
| radian cqsp::common::components::types::TrueAnomalyElliptic | ( | const Orbit & | orbit, |
| const second & | time, | ||
| double & | E_out | ||
| ) |
| double cqsp::common::components::types::TrueAnomalyFromVector | ( | const Orbit & | orbit, |
| const glm::dvec3 & | vec | ||
| ) |
| radian cqsp::common::components::types::TrueAnomalyHyperbolic | ( | const Orbit & | orbit, |
| const second & | time | ||
| ) |
Updates the orbit's true anomaly.
Updates orbit's true anomaly
You need to call it before calculating anything to do with the orbit
| orb | |
| time |
|
inline |
Updates the position of an orbit, in AU.
| kin | [out] the kinematics of the orbit |
| orb | [in] the orbit of the orbit |
| Orbit cqsp::common::components::types::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 orbit is returned
| position | Position of the body |
| velocity | Velocity of the body |
| GM | G*M of the orbiting body |
|
constexpr |
True anomaly of the apoapsis
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
True anomaly of the periapsis
|
constexpr |
|
constexpr |
|
constexpr |