Gravity Engine 2 5.1
|
Orbital utilities relating to classical orbital elements (COE) and converting between (r,v) <=> COE. More...
Classes | |
class | COE |
Classical orbit elements. More... | |
struct | COEStruct |
Light weight struct to hold COE core data for the job system and propagators. More... | |
Static Public Member Functions | |
static bool | CheckHitPlanet (double planetRadius, double planetMass, double3 r1c, double3 v1tc, double3 r2c, double3 v2tc, int nrev) |
static bool | COEEqual (COE coe1, COE coe2, bool includePhase, double sizeTol=1E-2, double angleRadTol=1E-3) |
Determine if two COEs are equal within the indicated tolerances. | |
static double3 double3 v | COEStructWithPhasetoRVRelative (COEStruct coe, double phaseRad) |
static double3 double3 v | COEtoRVatTime (COE coe, double time) |
static double3 double3 v | COEtoRVRelative (COE oe) |
static double3 double3 v | COEWithPhasetoRVRelative (COE oe, double phaseRad) |
static double | ConvertEtoMeanAnomoly (double eValue, double ecc) |
static double | ConvertEtoTrueAnomoly (double eValue, double ecc) |
Convert the eccentric anomaly (angle from center of ellipse wrt x-axis) to the true anomoly (angle from focus wrt periapsis/x-axis if e=0). | |
static double | ConvertMeanAnomolyToE (double M, double ecc) |
static double | ConvertMeanToTrueAnomoly (double M, double ecc) |
static double | ConvertTrueAnomolytoE (double nu, double ecc) |
static void | FindC2C3 (double znew, out double c2new, out double c3new) |
Taken from Vallado source code site. (Also used in LambertUniversal) Internal use only. | |
static double | FlightPathAngle (double3 r, double3 v) |
static double | GreenwichSiderealTime (double jdut1) |
static double3 | LaunchPlane (double targetInclDeg, double3 r, double latitudeDeg) |
Determine the orbit normal for a launch from an point at the given latitude into an orbit of specified inclination. | |
static double3 | OrbitAxis (COE coe) |
Determine the orbit axis (normalized) | |
static double | PhaseAngleRadiansForDirection (double3 pos, COE coe) |
Determine the phase in radians for the specified direction. This can be a point on the orbit but this is not required as only the direction of the given vector is used. | |
static double | PhaseForOrbitPoint (COE coe, OrbitPoint point, double deg=0) |
Determine the phase for a specific OrbitPoint in an orbit (e.g. APOAPSIS) | |
static double | PhaseForRadius (COE coe, double radius) |
Determine phase for a given radius. There are two valid responses, phase and -phase (or 2 Pi - phase). This return +phase. | |
static double3 | PositionForCOE (COE coe, double phaseRad) |
Given a COE and phase (radians) determine the relative position in the orbit. The length scale used will match the length scale used in the COE initialization. | |
static double3 | PositionsForR (COE coe, double r) |
static double3 | RotateToOrbitFrame (COE coe, double3 r) |
Rotate a 3D vector specified with respect to the default orbit frame (XY orbital plane) into the 3D space where the orientation is adjusted by inclination, omegaU and omegaL. | |
static void | RSWState (ref GEBodyState ship, ref GEBodyState planet, double3 orbitNormal, ref GEBodyState rswState) |
Given the state of a ship and planet determine the state info in the RSW frame in which: R is the radial vector to the planet S is along track W is cross track (see Vallado 3.3 p159 (5th ed)) | |
static double3 | RVForOrbitPoint (COE coe, OrbitPoint point, double deg=0) |
static COE | RVtoCOE (double3 r, double3 v, double mu, double small=1e-6) |
Given state information (r,v) and mu=GM determine the classical orbital elements (COE). | |
static double | TimeOfFlight (double3 r0, double3 r1, COE coe) |
Determine the time of flight in COE relevant units that it takes for the body in orbit to go from position r0 to position r1 in an orbit with given COE. | |
static double3 | VDirFromFPAandRR (double fpa, double3 r1, double3 r2) |
Given a FPA and two position vectors, return the velocity vector direction. | |
static double3 | VelocityForCircularOrbitRelative (GEBodyState body, double mu) |
Compute the 3D velocity for a circular velocity for the given 3D body state (r, v) around a mass with specified mu (=GM) | |
static double3 | VelocityForCOE (COE coe, double phaseRad) |
Determine the 3D velocity vector for a COE at the specified phase. | |
static bool | VelocityIsPrograde (double3 r, double3 v_now, double3 v_next) |
Determine if the given velocities v_now and v_next are both oriented in the same direction around the orbit. | |
static double | VelocityMagnitudeForCircular (double r, double mu) |
Determine the magnitude of a circular orbit for a given radius around a body of given mu. | |
Static Public Attributes | |
static | double3 |
Determine the two possible 3D positions in an orbit that are at the specified radius. | |
static double3 | r |
Determine the relative R and V for a specified set of classical orbital elements and a GM (mu) for the body at the center of the orbit. | |
const double | SMALL_ANGLE = 1E-3 |
const double | SMALL_E = 1E-3 |
const double | SMALL_P = 1E-6 |
const double | SMALL_SME = 1E-6 |
Orbital utilities relating to classical orbital elements (COE) and converting between (r,v) <=> COE.
A number of these algorithms originate with Vallado's excellent "Fundamentals of Astrodynamics and Applications" (Microcosm Press) and their adaptations in the original Gravity Engine asset.
There are also some other useful algorithms.
|
static |
Determine if two COEs are equal within the indicated tolerances.
Phase comparison can be excluded (Useful when getting COE for display orbit, where the phase does not matter)
coe1 | |
coe2 | |
includePhase | |
sizeTol | |
angleRadTol |
|
static |
Convert the eccentric anomaly (angle from center of ellipse wrt x-axis) to the true anomoly (angle from focus wrt periapsis/x-axis if e=0).
Equations from front cover of Vallado.
eValue | |
ecc |
|
static |
Taken from Vallado source code site. (Also used in LambertUniversal) Internal use only.
znew | |
c2new | |
c3new |
|
static |
Determine the orbit normal for a launch from an point at the given latitude into an orbit of specified inclination.
This assumes that a check that inclination > latitude has already been done.
targetInclDeg | |
r | |
latitudeDeg |
Determine the orbit axis (normalized)
coe |
Determine the phase in radians for the specified direction. This can be a point on the orbit but this is not required as only the direction of the given vector is used.
pos | direction relative to the orbit center |
coe | orbital elements for the orbit |
|
static |
Determine the phase for a specific OrbitPoint in an orbit (e.g. APOAPSIS)
coe | |
point | |
deg |
|
static |
Determine phase for a given radius. There are two valid responses, phase and -phase (or 2 Pi - phase). This return +phase.
coe | |
radius |
Given a COE and phase (radians) determine the relative position in the orbit. The length scale used will match the length scale used in the COE initialization.
coe | |
phaseRad |
Rotate a 3D vector specified with respect to the default orbit frame (XY orbital plane) into the 3D space where the orientation is adjusted by inclination, omegaU and omegaL.
coe | |
r |
|
static |
Given the state of a ship and planet determine the state info in the RSW frame in which: R is the radial vector to the planet S is along track W is cross track (see Vallado 3.3 p159 (5th ed))
The position vector defines R The orbit normal is used to define the axis for cross track. The cross of R and W defines S.
ship | |
planet | |
rswState |
|
static |
Given state information (r,v) and mu=GM determine the classical orbital elements (COE).
Classical orbital elements have inherent singularities for: circular orbits (e=0) flat orbits (i=0 or Pi radians)
In this case the sense of how small is zero is set by the optional parameter small
.
In the case of circular orbits there is no closest approach point from which to measure phase nu. For circular orbits the X-axis defines nu=0.
In the case of a flat orbit, there is no ascending node to provide a reference for omegaU. It is set to zero.
See the discussion in the Orbits section of the documentation for other information.
r | |
v | |
mu | |
small (optional) threshold for detecting circular/flat orbits |
Determine the time of flight in COE relevant units that it takes for the body in orbit to go from position r0 to position r1 in an orbit with given COE.
r0 | from position in orbit |
r1 | to position in orbit |
coe | COE struct describing the orbit |
|
static |
Given a FPA and two position vectors, return the velocity vector direction.
fpa | |
r1 | |
r2 |
|
static |
Compute the 3D velocity for a circular velocity for the given 3D body state (r, v) around a mass with specified mu (=GM)
body | struct with r, v state |
mu | center body mass |
Determine the 3D velocity vector for a COE at the specified phase.
coe | |
phaseRad |
|
static |
Determine if the given velocities v_now and v_next are both oriented in the same direction around the orbit.
This is used in Lambert transfer calculations to select the transfer option that matches the current direction in the orbit
r | position in the orbit |
v_now | current velocity |
v_next | velocity after possible maneuver |
|
static |
Determine the magnitude of a circular orbit for a given radius around a body of given mu.
r | agnitude of radius |
mu | mu of center body (GM) |
|
static |
Determine the two possible 3D positions in an orbit that are at the specified radius.
Determine the 3D position and velocity (relative to the center) for the specified type of OrbitPoint.
coe | |
r |
coe | |
point | |
deg |
|
static |
Determine the relative R and V for a specified set of classical orbital elements and a GM (mu) for the body at the center of the orbit.
Determine state from COE and a time from current phase in COE. This used a KeplerPropagator and it might be better to use this approach directly if this will be used more than once.
COEStruct version to determine relative position and velocity for a given COE and phase.
Determine the relative position and velocity for the point in an orbit specified by the COE at the given phase in radians.
oe | |
mu |
oe | |
phaseRad |
Used in job system (PKEPLER) to determine R, V
coe | |
phaseRad |
coe | |
time |