19 const Float Omega = this->ascendingNode();
23 return 2._f *
PI - omega;
30 return a * (1._f - e);
34 return a *
sqrt(1._f - e * e);
64 for (
Size iter = 0; iter < iterCnt; ++iter) {
73 return atan2(sinv, cosv);
79 return atan2(sinu, cosu);
#define SPH_ASSERT(x,...)
Definitions of physical constaints (in SI units).
uint32_t Size
Integral type used to index arrays (by default).
double Float
Precision used withing the code. Use Float instead of float or double where precision is important.
constexpr INLINE T sqr(const T &f) noexcept
Return a squared value.
INLINE T sqrt(const T f)
Return a squared root of a value.
constexpr INLINE Float pow< 3 >(const Float v)
INLINE T atan2(const T y, const T x)
constexpr Float PI
Mathematical constants.
#define NAMESPACE_SPH_END
const NothingType NOTHING
INLINE Float getLength(const Vector &v)
Returns the length of the vector. Enabled only for vectors of floating-point precision.
INLINE Float getSqrLength(const Vector &v)
INLINE BasicVector< float > cross(const BasicVector< float > &v1, const BasicVector< float > &v2)
Cross product between two vectors.
BasicVector< Float > Vector
INLINE float dot(const BasicVector< float > &v1, const BasicVector< float > &v2)
Make sure the vector is trivially constructible and destructible, needed for fast initialization of a...
INLINE Vector getNormalized(const Vector &v)
Wrapper of type value of which may or may not be present.
constexpr Float gravity
Gravitational constant (CODATA 2014)
Optional< Elements > computeOrbitalElements(const Float M, const Float mu, const Vector &r, const Vector &v)
Computes the orbital elements, given position and velocity of a body.
Float trueAnomalyToEccentricAnomaly(const Float v, const Float e)
Computes the eccentric anomaly from the true anomaly and the eccentricity.
Float eccentricAnomalyToTrueAnomaly(const Float u, const Float e)
Computes the true anomaly from the eccentric anomaly and the eccentricity.
Float solveKeplersEquation(const Float M, const Float e, const Size iterCnt=10)
Computes the eccentric anomaly by solving the Kepler's equation.
Float meanMotion(const Float a, const Float m_total)
Computes the mean motion from the Kepler's 3rd law.
Vector position(const Float a, const Float e, const Float u)
Computes the position on the elliptic trajectory.
Vector velocity(const Float a, const Float e, const Float u, const Float n)
Computes the velocity vector on the elliptic trajectory.
Object holding Keplerian orbital elements of a body.
Float periapsisArgument() const
Computes the argument of periapsis of the orbit. In the singular case e=0, returns 0.
Vector K
Laplace vector, integral of motion with direction towards pericenter.
Float pericenterDist() const
Computes the distance of the pericenter.
Float ascendingNode() const
Computes the longitude of the ascending node. In the singular case i=0, reutrns 0.
Float i
Inclination with respect to the z=0 plane.
Float semiminorAxis() const
Computes the semi-minor axis.
Vector L
Angular momentum, perpendicular to the orbital plane.