Gravity Engine 12.0
Unity Asset for Gravity
Loading...
Searching...
No Matches
OrbitData Class Reference

Orbit data. Hold the traditional orbit parameters for an elliptic/hyperbolic orbit. More...

Public Member Functions

 OrbitData (float a, float e, float i, float omega_uc, float omega_lc, float phase)
 
 OrbitData (OrbitData od)
 
 OrbitData (OrbitEllipse orbitEllipse)
 Construct an orbit data routine from an existing orbit ellipse by copying the orbital elements.
 
 OrbitData (OrbitUniversal orbitU)
 Construct an orbit data set using the OrbitUniversal attached to the OrbitPredictor on the body.
 
void SetOrbitForVelocity (NBody forNbody, NBody aroundNBody, Vector3 velocity)
 Computes the orbit parameters for a specified velocity with respect to a central body. This method assumes the orbit is not a Kepler-mode orbit ellipse. If it is (or not sure) then use SetOrbit() below.
 
void SetOrbitForVelocity (NBody forNbody, NBody aroundNBody)
 Computes the orbit parameters for a specified velocity (from NBody) with respect to a central body. This method assumes the orbit is not a Kepler-mode orbit ellipse. If it is (or not sure) then use SetOrbit() below.
 
void SetOrbit (NBody forNbody, NBody aroundNBody)
 SetOrbit Determine orbit params from an attached orbit component (if Kepler) otherwise use the velocity to determine the orbit.
 
bool IsCircular ()
 
Vector3d GetAxis ()
 Compute the axis of the orbit by taking r x v at a specific phase and normalizing.
 
double GetOmegaAngular ()
 Get the angular velocity in rad/time.
 
float GetCircPhase ()
 Convenience method to get the phase assuming the orbit is circular. Useful for e.g. HohmannGeneral algorithms that assume the orbit is a perfect circle.
 
void CalcTau (Vector3 r, Vector3 v)
 Determine the time to periapsis in physics time.
 
string LogString ()
 
Vector3 GetPhysicsPositionforEllipse (float phaseDeg)
 Get the absolute physics position for a specified phase for the ellipse defined by this OrbitData.
 
Vector3 GetPhysicsPositionforEllipseRelative (float phaseDeg)
 Get position in the ellipse relative to the center body.
 
float GetPhaseDegForRadius (double radius)
 Get the phase for the specified radius/altitude.
 
Vector3 GetPhysicsVelocityForEllipse (float phaseDeg)
 Determine velocity in physics units at the indicated phase angle (in degrees)
 
Vector3 GetPhysicsVelocity (float phaseDeg)
 Determine velocity in physics units at the indicated phase angle (in degrees)
 

Public Attributes

float ecc
 eccentricity (0..1, 0=circle, 1=linear)
 
Vector3d ecc_vec
 eccentricity vector (direction to point of closest approach when e != 0)
 
float a = 10f
 semi-major axis - based on paramBy user can specify a OR p. a = p/(1-ecc)
 
float perihelion
 perihelion
 
float omega_uc
 "longitude of ascending node" - angle from x-axis to line from focus to pericenter
 
float omega_lc
 "argument of perienter" - angle from ascending node to pericenter
 
float inclination
 inclination (degrees!)
 
float phase
 initial TRUE anomoly (angle wrt line from focus to closest approach)
 
float period
 period of orbit in game time (uses GravityScalar.GameSecToWorldTime for world units)
 
float tau
 time to periapsis (point of closest approach) in game seconds (use GravityScalar.GameSecToWorldTime for world units)
 
float r_initial = 10f
 Hyperbola - initial distance from focus.
 
NBody centralMass
 
NBody nbody
 
float mu
 Scaled mass of central body.
 

Static Public Attributes

const float OD_ZERO_LIMIT = 0.001f
 

Detailed Description

Orbit data. Hold the traditional orbit parameters for an elliptic/hyperbolic orbit.

Provide utility methods to derive the orbit parameters from the position, velocity and centerBody of an NBody object pair. This orbit prediction is based only on the two bodies (and assumes the central body mass dominates) - the influence of other bodies in the scene may result in an actual path that is different from the predicted path.

Constructor & Destructor Documentation

◆ OrbitData() [1/2]

OrbitData.OrbitData ( OrbitEllipse  orbitEllipse)

Construct an orbit data routine from an existing orbit ellipse by copying the orbital elements.

Parameters
orbitEllipse

◆ OrbitData() [2/2]

OrbitData.OrbitData ( OrbitUniversal  orbitU)

Construct an orbit data set using the OrbitUniversal attached to the OrbitPredictor on the body.

This is not used with the OrbitUniversal attached to the NBody, that only provides the initial orbit info, not the live orbit info.

Parameters
orbitU

Member Function Documentation

◆ CalcTau()

void OrbitData.CalcTau ( Vector3  r,
Vector3  v 
)

Determine the time to periapsis in physics time.

Parameters
r
v

◆ GetAxis()

Vector3d OrbitData.GetAxis ( )

Compute the axis of the orbit by taking r x v at a specific phase and normalizing.

Returns

◆ GetCircPhase()

float OrbitData.GetCircPhase ( )

Convenience method to get the phase assuming the orbit is circular. Useful for e.g. HohmannGeneral algorithms that assume the orbit is a perfect circle.

Returns

◆ GetOmegaAngular()

double OrbitData.GetOmegaAngular ( )

Get the angular velocity in rad/time.

Returns

◆ GetPhaseDegForRadius()

float OrbitData.GetPhaseDegForRadius ( double  radius)

Get the phase for the specified radius/altitude.

In the case of an ellipse if the altitute larger/smaller than those allowed just return the max. An ellipse will have two values that match the altitude. To get the alternative one use (360 - phase).

A circular orbit will return a phase of zero for any altitude.

Parameters
radius
Returns

◆ GetPhysicsPositionforEllipse()

Vector3 OrbitData.GetPhysicsPositionforEllipse ( float  phaseDeg)

Get the absolute physics position for a specified phase for the ellipse defined by this OrbitData.

Parameters
phaseDeg
Returns

◆ GetPhysicsPositionforEllipseRelative()

Vector3 OrbitData.GetPhysicsPositionforEllipseRelative ( float  phaseDeg)

Get position in the ellipse relative to the center body.

Parameters
phaseDeg
Returns

◆ GetPhysicsVelocity()

Vector3 OrbitData.GetPhysicsVelocity ( float  phaseDeg)

Determine velocity in physics units at the indicated phase angle (in degrees)

Parameters
phaseDeg
Returns

Uses Vallado, Algorithm 10 for (x,y) plane and then rotates into place

◆ GetPhysicsVelocityForEllipse()

Vector3 OrbitData.GetPhysicsVelocityForEllipse ( float  phaseDeg)

Determine velocity in physics units at the indicated phase angle (in degrees)

Parameters
phaseDeg
Returns

◆ SetOrbit()

void OrbitData.SetOrbit ( NBody  forNbody,
NBody  aroundNBody 
)

SetOrbit Determine orbit params from an attached orbit component (if Kepler) otherwise use the velocity to determine the orbit.

Parameters
forNbody
aroundNBody

◆ SetOrbitForVelocity() [1/2]

void OrbitData.SetOrbitForVelocity ( NBody  forNbody,
NBody  aroundNBody 
)

Computes the orbit parameters for a specified velocity (from NBody) with respect to a central body. This method assumes the orbit is not a Kepler-mode orbit ellipse. If it is (or not sure) then use SetOrbit() below.

Parameters
forNbody
aroundNBody

◆ SetOrbitForVelocity() [2/2]

void OrbitData.SetOrbitForVelocity ( NBody  forNbody,
NBody  aroundNBody,
Vector3  velocity 
)

Computes the orbit parameters for a specified velocity with respect to a central body. This method assumes the orbit is not a Kepler-mode orbit ellipse. If it is (or not sure) then use SetOrbit() below.

Parameters
forNbody
aroundNBody
velocity

The documentation for this class was generated from the following file: