SPH
Classes | Functions
Kepler Namespace Reference

Classes

struct  Elements
 Object holding Keplerian orbital elements of a body. More...
 

Functions

Optional< ElementscomputeOrbitalElements (const Float M, const Float mu, const Vector &r, const Vector &v)
 Computes the orbital elements, given position and velocity of a body. More...
 
Float solveKeplersEquation (const Float M, const Float e, const Size iterCnt=10)
 Computes the eccentric anomaly by solving the Kepler's equation. More...
 
Float eccentricAnomalyToTrueAnomaly (const Float u, const Float e)
 Computes the true anomaly from the eccentric anomaly and the eccentricity. More...
 
Float trueAnomalyToEccentricAnomaly (const Float v, const Float e)
 Computes the eccentric anomaly from the true anomaly and the eccentricity. More...
 
Vector position (const Float a, const Float e, const Float u)
 Computes the position on the elliptic trajectory. More...
 
Vector velocity (const Float a, const Float e, const Float u, const Float n)
 Computes the velocity vector on the elliptic trajectory. More...
 
Float meanMotion (const Float a, const Float m_total)
 Computes the mean motion from the Kepler's 3rd law. More...
 

Function Documentation

◆ computeOrbitalElements()

Optional< Kepler::Elements > Kepler::computeOrbitalElements ( const Float  M,
const Float  mu,
const Vector r,
const Vector v 
)

Computes the orbital elements, given position and velocity of a body.

If the body trajectory is not closed (hyperbolic motion), returns NOTHING.

Parameters
MMass characterizing the gravitational field, or sum of body masses for two-body problem
muMass of the orbiting body, or reduced mass for two-body problem
rPosition of the orbiting body
vVelocity of the orbiting body

Definition at line 37 of file TwoBody.cpp.

◆ eccentricAnomalyToTrueAnomaly()

Float Kepler::eccentricAnomalyToTrueAnomaly ( const Float  u,
const Float  e 
)

Computes the true anomaly from the eccentric anomaly and the eccentricity.

Definition at line 70 of file TwoBody.cpp.

◆ meanMotion()

Float Kepler::meanMotion ( const Float  a,
const Float  m_total 
)

Computes the mean motion from the Kepler's 3rd law.

Definition at line 90 of file TwoBody.cpp.

◆ position()

Vector Kepler::position ( const Float  a,
const Float  e,
const Float  u 
)

Computes the position on the elliptic trajectory.

It assumes a planar motion in z=0 plane.

Parameters
aSemi-major axis
eEccentricity
uEccentric anomaly

Definition at line 82 of file TwoBody.cpp.

◆ solveKeplersEquation()

Float Kepler::solveKeplersEquation ( const Float  M,
const Float  e,
const Size  iterCnt = 10 
)

Computes the eccentric anomaly by solving the Kepler's equation.

Parameters
MMean anomaly
eEccentricity

Definition at line 62 of file TwoBody.cpp.

◆ trueAnomalyToEccentricAnomaly()

Float Kepler::trueAnomalyToEccentricAnomaly ( const Float  v,
const Float  e 
)

Computes the eccentric anomaly from the true anomaly and the eccentricity.

Definition at line 76 of file TwoBody.cpp.

◆ velocity()

Vector Kepler::velocity ( const Float  a,
const Float  e,
const Float  u,
const Float  n 
)

Computes the velocity vector on the elliptic trajectory.

It assumes a planar motion in z=0 plane.

Parameters
aSemi-major axis
eEccentricity
uEccentric anomaly
nMean motion

Definition at line 86 of file TwoBody.cpp.