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.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Functions
orbit.cpp File Reference
#include "common/components/orbit.h"
#include <algorithm>
#include <cassert>
#include <iostream>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/projection.hpp>
#include <glm/gtx/vector_angle.hpp>

Namespaces

namespace  cqsp
 When adding assets, it is extremely crucial that you read cqsp::asset::AssetLoader::LoadResources to find out how to add a resource to the game.
 
namespace  cqsp::common
 
namespace  cqsp::common::components
 
namespace  cqsp::common::components::types
 

Functions

double cqsp::common::components::types::GetOrbitingRadius (const double &e, const radian &a, const radian &v)
 
glm::dvec3 cqsp::common::components::types::MatrixConvertOrbParams (const double LAN, const double i, const double w, const glm::dvec3 &vec)
 
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 More...
 
glm::dvec3 cqsp::common::components::types::ConvertToOrbitalVector (const double LAN, const double i, const double w, const double v, const glm::dvec3 &vec)
 
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 More...
 
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. More...
 
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. More...
 
double cqsp::common::components::types::OrbitVelocity (const double v, const double e, const double a, const double GM)
 
double cqsp::common::components::types::AvgOrbitalVelocity (const Orbit &orb)
 
glm::dvec3 cqsp::common::components::types::OrbitVelocityToVec3 (const Orbit &orb, double v)
 
glm::dvec3 cqsp::common::components::types::OrbitVelocityToVec3 (const Orbit &orb)
 
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 More...
 
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 More...
 
double cqsp::common::components::types::EccentricAnomalyToTrueAnomaly (const double &ecc, const double &E)
 Calculates true anomaly from eccentricity and eccentric anomaly More...
 
double cqsp::common::components::types::HyperbolicAnomalyToTrueAnomaly (const double &ecc, const double &H)
 
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 More...
 
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 More...
 
radian cqsp::common::components::types::TrueAnomalyElliptic (const Orbit &orbit, const second &time)
 
radian cqsp::common::components::types::TrueAnomalyElliptic (const Orbit &orbit, const second &time, double &E_out)
 
double cqsp::common::components::types::GetCircularOrbitingVelocity (const double &GM, const double &radius)
 Get the circular orbiting velocity for the radius. More...
 
radian cqsp::common::components::types::TrueAnomalyHyperbolic (const Orbit &orbit, const second &time)
 
radian cqsp::common::components::types::EccentricAnomaly (double v, double e)
 Calculates Eccentric anomaly More...
 
radian cqsp::common::components::types::HyperbolicAnomaly (double v, double e)
 
void cqsp::common::components::types::UpdateOrbit (Orbit &orb, const second &time)
 Updates the orbit's true anomaly. More...
 
double cqsp::common::components::types::GetTrueAnomaly (const Orbit &orb, const second &epoch)
 Get anomaly at epoch More...
 
glm::dvec3 cqsp::common::components::types::CalculateVelocity (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::CalculateVelocityElliptic (const double &E, const kilometer &r, const double &GM, const kilometer &a, const double &e)
 
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. More...
 
double cqsp::common::components::types::OrbitVelocityAtR (const double GM, const double a, const double r)
 
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)
 
double cqsp::common::components::types::CalculateTransferTime (const Orbit &orb1, const Orbit &orb2)
 
double cqsp::common::components::types::CalculateTransferAngle (const Orbit &start_orbit, const Orbit &end_orbit)
 
double cqsp::common::components::types::CalculatePhaseAngle (const Orbit &start_orbit, const Orbit &end_orbit, double epoch)
 
double cqsp::common::components::types::GetHyperbolicAsymptopeAnomaly (double eccentricity)
 
double cqsp::common::components::types::FlightPathAngle (double eccentricity, double v)
 
glm::dvec3 cqsp::common::components::types::GetOrbitNormal (const Orbit &orbit)
 
double cqsp::common::components::types::TrueAnomalyFromVector (const Orbit &orbit, const glm::dvec3 &vec)
 
double cqsp::common::components::types::AscendingTrueAnomaly (const Orbit &start, const Orbit &dest)