Simulator::cEllipticalOrbit class

Settings of the orbit of a planet or celestial body in a solar system.

These are all mathematical properties to define an elliptical orbit. mPlaneNormal describes the plane of rotation, whereas mEccentricty and mPerihelion describe the ellipse in that plane.

This class saves all its parameters except mCache. mCache is precalculated from the other parameters when the data is loaded, so if you change one of the parameters you have to calculate the cache again using Precalculate().

Public types

struct OrbitCache

Constructors, destructors, conversion operators

cEllipticalOrbit()
Creates a null orbit (mbNullOrbit equals true, all other fields are not initialized).

Public functions

auto Precalculate() -> void
Calculates all the valeus in mCache using the rest of parameters in this class.

Public variables

bool mbNullOrbit
If true, the orbit is null (so there is no orbit at all)
Math::Vector3 mPlaneNormal
Normal vector of the plane in which the planet orbits. The planet never leaves that plane.
float mEccentricity
Eccentricity of the ellipse of the orbit; 0.0 is a circular orbit.
Math::Vector3 mPerihelion
Point of the orbit in which the planet is closest to the star. Also known as periapsis.
float mPeriod
Time it takes, in real seconds, to complete one orbit (i.e. how long an astronomical year is)
OrbitCache mCache

Function documentation

void Simulator::cEllipticalOrbit::Precalculate()

Calculates all the valeus in mCache using the rest of parameters in this class.

This must be called every time a parameter is changed.