keplerianOrbit
-
class KeplerianOrbit
- #include <keplerianOrbit.h>
Represent an elliptical orbit with a coherent set of derived outputs.
Position and velocity are computed with orbitalMotion. Constructors and element or gravitational-parameter setters immediately refresh the affected outputs. Use meters, seconds, and radians for inputs and outputs.
Note
The supported domain is a positive semi-major axis, a positive gravitational parameter, eccentricity in [0, 1), and inclination in [0, pi]. Hyperbolic, parabolic, and rectilinear orbits are outside this class’s scope. All inputs must be finite.
Note
Constructors and setters throw std::invalid_argument (ValueError in Python) for unsupported inputs or unrepresentable derived outputs. Rejected setters preserve the complete previous state.
Note
E() and M() follow the f2E() and E2M() angle conventions without additional normalization to [0, 2*pi). Negative and wrapped true anomalies are accepted; these conversions do not preserve a count of completed revolutions.
Public Functions
-
KeplerianOrbit()
This constructor initialized to an arbitrary orbit
-
KeplerianOrbit(ClassicElements oe, const double mu)
The constructor requires orbital elements and a gravitational constant value
-
KeplerianOrbit(const KeplerianOrbit &orig)
The copy constructor works with python copy
-
KeplerianOrbit &operator=(const KeplerianOrbit &other) = default
Copy the complete orbital state, including derived outputs.
- Parameters:
other – Orbit whose state is copied.
- Returns:
Reference to this orbit after assignment.
-
~KeplerianOrbit()
Generic Destructor
-
Eigen::Vector3d r_BP_P() const
body position vector relative to planet
body position vector relative to planet
-
Eigen::Vector3d v_BP_P() const
body velocity vector relative to planet
body velocity vector relative to planet
-
Eigen::Vector3d h_BP_P() const
angular momentum of body relative to planet
angular momentum of body relative to planet
-
double M() const
Mean elliptic anomaly [rad], using E2M().
-
double n() const
return mean orbit rate
-
double P() const
return mean orbit rate
return orbit period
-
double f() const
return orbital period
return true anomaly
-
double fDot() const
True anomaly rate [rad/s].
return true anomaly
-
double RAAN() const
return right ascencion of the ascending node
-
double omega() const
return argument of periapses
-
double i() const
return inclination angle
-
double e() const
return eccentricty
-
double a() const
return semi-major axis
-
double h() const
return orbital angular momentum magnitude
-
double Energy()
return orbital energy
-
double r() const
return orbit radius
-
double v() const
return velocity magnitude
-
double r_a() const
return radius at apoapses
-
double r_p() const
return radius at periapses
-
double fpa() const
Flight-path angle [rad], negative for inward motion.
-
double E() const
Eccentric anomaly [rad], using f2E().
-
double p() const
return semi-latus rectum or the parameter
-
double rDot() const
Radial velocity [m/s], negative for inward motion.
-
double c3() const
Return the characteristic orbital energy C3.
Note
C3 is negative for the elliptic orbits supported by this class.
- Returns:
Twice the specific orbital energy, C3 = -mu/a [m^2/s^2].
-
ClassicElements oe()
Return the current orbital elements and derived geometry.
- Returns:
Elements including the current radius in rmag [m], inverse semi-major axis in alpha [1/m], and apsis radii in rPeriap and rApoap [m].
-
void set_mu(const double mu)
Set the central body’s gravitational parameter and refresh all derived outputs.
- Parameters:
mu – Gravitational parameter [m^3/s^2].
-
void set_a(double a)
Set the semi-major axis and refresh all derived outputs.
- Parameters:
a – Semi-major axis [m].
-
void set_e(double e)
set eccentricity
-
void set_i(double i)
set inclination angle
-
void set_omega(double omega)
set argument of periapsis
-
void set_RAAN(double RAAN)
set right ascension of the ascending node
-
void set_f(double f)
set true anomaly angle
Private Functions
-
void change_orbit()
Recompute the derived state after changing orbital elements or gravity.
-
void change_f()
Recompute the outputs that depend on the current true anomaly.
Private Members
-
double mu = MU_EARTH * std::pow(10, 9)
-
double semi_major_axis = 1E5 * 1000
-
double eccentricity = 1E-5
-
double inclination = {}
-
double argument_of_periapsis = {}
-
double right_ascension = {}
-
double true_anomaly = {}
-
double true_anomaly_rate = {}
-
double orbital_period = {}
-
double orbital_energy = {}
-
double v_infinity = {}
Reserved legacy storage; retained to preserve the native class layout.
-
double orbit_radius = {}
-
double radial_rate = {}
-
double r_apogee = {}
-
double r_perigee = {}
-
double semi_parameter = {}
-
double flight_path_angle = {}
-
double eccentric_anomaly = {}
-
double mean_motion = {}
-
double mean_anomaly = {}
-
KeplerianOrbit()