Kerbal Space Program  1.12.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Orbit Class Reference

Classes

struct  CASolutionState
 
struct  State
 

Public Types

enum  EncounterSolutionLevel {
  EncounterSolutionLevel.NONE = 0, EncounterSolutionLevel.ESCAPE = 1, EncounterSolutionLevel.ORBIT_INTERSECT = 2, EncounterSolutionLevel.SOI_INTERSECT_2 = 3,
  EncounterSolutionLevel.SOI_INTERSECT_1 = 4
}
 
enum  ObjectType {
  ObjectType.VESSEL, ObjectType.SPACE_DEBRIS, ObjectType.CELESTIAL_BODIES, ObjectType.UNKNOWN_MISC,
  ObjectType.KERBAL
}
 Orbit.ObjectType is Deprecated. Use Vessel.vesselType or CelestialBody.bodyType instead. More...
 
enum  PatchTransitionType {
  PatchTransitionType.INITIAL, PatchTransitionType.FINAL, PatchTransitionType.ENCOUNTER, PatchTransitionType.ESCAPE,
  PatchTransitionType.MANEUVER, PatchTransitionType.IMPACT
}
 

Public Member Functions

void DrawOrbit ()
 
void DrawOrbit (Color color)
 
double EccentricAnomalyAtObT (double T)
 
double EccentricAnomalyAtUT (double UT)
 
delegate int FindClosestPointsDelegate (Orbit p, Orbit s, ref double CD, ref double CCD, ref double FFp, ref double FFs, ref double SFp, ref double SFs, double epsilon, int maxIterations, ref int iterationCount)
 Solves the closest point between two orbits starting from the given initial guess values. Both orbits need to share the same reference body. More...
 
Vector3d GetANVector ()
 Returns an updated ascending node vector (use instead of Orbit.eccVec for non-updating orbits when in a rotating ref frame) More...
 
double GetDTforTrueAnomaly (double tA, double wrapAfterSeconds)
 Get the time remaining to reach the given true anomaly on this orbit More...
 
double GetDTforTrueAnomalyAtUT (double tA, double UT)
 Determine time delta to get to the specified true anomaly at the given time. For closed trajectories, the delta is limited to +/- 1/2 period (ie, shorted time delta). If time to return to the specified point is desired, add a period. Open trajectories never return (infinity / 2 == infinity). More...
 
double GetEccentricAnomaly (double tA)
 Get the Eccentric Anomaly for the given true anomaly More...
 
Vector3d GetEccVector ()
 Returns an updated eccentricity vector (use instead of Orbit.eccVec for non-updating orbits when in a rotating ref frame) More...
 
Vector3d GetFrameVel ()
 get the current total velocity of the orbiting body (relative to the solar system inertial frame) More...
 
Vector3d GetFrameVelAtUT (double UT)
 
double GetMeanAnomaly (double E)
 Get the Mean Anomaly for the given Eccentric Anomaly More...
 
double getMeanAnomalyAtUT (double UT)
 
double GetMeanMotion (double sma)
 
double GetNextApoapsisTime (double UT)
 Get the next Apoapsis Time after UT More...
 
double GetNextPeriapsisTime (double UT)
 Get the next Periapsis Time after UT More...
 
double GetNextTimeOfRadius (double UT, double radius)
 Get Next Time that Orbit will be at Radius after UT. More...
 
double getObTAtMeanAnomaly (double M)
 
double getObtAtTrueAnomaly (double tA)
 Return orbit "time" for the given true anomaly without any time wrapping More...
 
double getObtAtUT (double UT)
 
double GetOrbitalCurvatureAtTrueAnomaly (double ta)
 
double getOrbitalSpeedAt (double time)
 Get the orbital velocity of the object at the specified time (velocity relative to parent body) More...
 
double getOrbitalSpeedAtDistance (double d)
 Get the orbital velocity of the orbiting object at the specified distance to the body it's orbiting (velocity relative to parent body) More...
 
double getOrbitalSpeedAtPos (Vector3d pos)
 Get the orbital velocity of the object at the specified global position (velocity relative to parent body) More...
 
double getOrbitalSpeedAtRelativePos (Vector3d relPos)
 Get the orbital velocity of the object at the specified relative position (velocity relative to parent body) More...
 
double GetOrbitalStateVectorsAtObT (double ObT, double UT, out Vector3d pos, out Vector3d vel)
 
double GetOrbitalStateVectorsAtObT (double ObT, out State state)
 Get "full" state vectors for specified orbit "time" (see GetOrbitalStateVectorsAtTrueAnomaly) More...
 
double GetOrbitalStateVectorsAtTrueAnomaly (double tA, double UT, out Vector3d pos, out Vector3d vel)
 
double GetOrbitalStateVectorsAtTrueAnomaly (double tA, double UT, bool worldToLocal, out Vector3d pos, out Vector3d vel)
 
double GetOrbitalStateVectorsAtTrueAnomaly (double tA, out State state)
 Get "full" state vectors for specified true anomaly More...
 
double GetOrbitalStateVectorsAtUT (double UT, out Vector3d pos, out Vector3d vel)
 
double GetOrbitalStateVectorsAtUT (double UT, out State state)
 Get "full" state vectors for specified UT (see GetOrbitalStateVectorsAtTrueAnomaly) More...
 
Vector3d getOrbitalVelocityAtObT (double ObT)
 
Vector3d getOrbitalVelocityAtTrueAnomaly (double tA)
 
Vector3d getOrbitalVelocityAtTrueAnomaly (double tA, bool worldToLocal)
 
Vector3d getOrbitalVelocityAtUT (double UT)
 
Vector3d GetOrbitNormal ()
 Returns an updated orbit normal (use instead of Orbit.h for non-updating orbits when in a rotating ref frame) More...
 
Vector3d getPositionAtT (double T)
 
Vector3d getPositionAtUT (double UT)
 Get the position of the orbiting object at the specified Universal Time (relative to the current position of the reference body); More...
 
Vector3d getPositionFromEccAnomaly (double E)
 Get a global position vector from the given eccentric anomaly angle (in radians) More...
 
Vector3d getPositionFromEccAnomalyWithSemiMinorAxis (double E, double semiMinorAxis)
 Get a global position vector from the given eccentric anomaly angle (in radians) Version that request semiMinorAxis for faster repeated call More...
 
Vector3d getPositionFromMeanAnomaly (double M)
 
Vector3d getPositionFromTrueAnomaly (double tA)
 Get a global position vector from the given true anomaly angle (in radians) More...
 
Vector3d getPositionFromTrueAnomaly (double tA, bool worldToLocal)
 Get a ref-body-relative position vector from the given true anomaly angle (in radians) More...
 
double GetRadiusAtPhaseAngle (double phaseAngle)
 Get Radius of the Orbit at a phase angle. More...
 
double GetRadiusAtUT (double time)
 Get the Radius of the Orbit at a given UT time. More...
 
double GetRelativeInclination (Orbit otherOrbit)
 Get the relative inclination between this orbit and another orbit. More...
 
Vector3d getRelativePositionAtT (double T)
 
Vector3d getRelativePositionAtUT (double UT)
 
Vector3d getRelativePositionFromEccAnomaly (double E)
 Get a ref-body-relative position vector from the given eccentric anomaly angle (in radians) More...
 
Vector3d getRelativePositionFromEccAnomalyWithSemiMinorAxis (double E, double semiMinorAxis)
 Get a ref-body-relative position vector from the given eccentric anomaly angle (in radians) Version that request semiMinorAxis for faster repeated call More...
 
Vector3d getRelativePositionFromMeanAnomaly (double M)
 
Vector3d getRelativePositionFromTrueAnomaly (double tA)
 Get a ref-body-relative position vector from the given true anomaly angle (in radians) More...
 
Vector3d GetRelativeVel ()
 get the current velocity of the orbiting body (relative to it's central body) More...
 
Vector3d GetRotFrameVel (CelestialBody refBody)
 get the velocity of the rotating reference frame, when that frame is in use More...
 
Vector3d GetRotFrameVelAtPos (CelestialBody refBody, Vector3d refPos)
 get the velocity of the rotating reference frame with respect to a given position (when that frame is in use) More...
 
double GetTimeToPeriapsis ()
 Time from StartUT to periapsis on this patch More...
 
double GetTrueAnomaly (double E)
 
double GetTrueAnomalyOfZupVector (Vector3d vector)
 
Vector3d getTruePositionAtUT (double UT)
 Get the position of the orbiting object at the specified Universal Time (relative to the actual position of the reference body at the given UT); More...
 
double getUTAtMeanAnomaly (double M, double UT)
 
double GetUTforTrueAnomaly (double tA, double wrapAfterSeconds)
 Get the Universal Time at which this orbit will reach the given true anomaly More...
 
Vector3d GetVel ()
 get the current velocity of the orbiting body (in scene space) More...
 
Vector3d GetWorldSpaceVel ()
 
Vector3d Horizontal (double UT)
 Return the Horizontal Vector for the orbit at UT. More...
 
void Init ()
 
Vector3d Normal (double UT)
 Returns the Normal Positive Vector of the orbit at UT. More...
 
 Orbit ()
 
 Orbit (double inc, double e, double sma, double lan, double argPe, double mEp, double t, CelestialBody body)
 
 Orbit (Orbit orbit)
 
double PhaseAngle (double time, double longitude)
 Get the Phase Angle of the Orbit at a given UT time and Longitude. More...
 
double PhaseAngle (double time)
 Get the Phase Angle of the Orbit at a given UT time. More...
 
Vector3d Prograde (double UT)
 Return the Prograde Vector of the orbit at UT. More...
 
Vector3d Radial (double UT)
 Returns the Radial Positive Vector of the orbit at UT. More...
 
double RadiusAtTrueAnomaly (double tA)
 
void SetOrbit (double inc, double e, double sma, double lan, double argPe, double mEp, double t, CelestialBody body)
 
delegate double SolveClosestApproachDelegate (Orbit p, Orbit s, ref double UT, double dT, double threshold, double MinUT, double MaxUT, double epsilon, int maxIterations, ref int iterationCount)
 
double solveEccentricAnomaly (double M, double ecc, double maxError=1e-7, int maxIterations=8)
 
delegate bool SolveSOI_BSPDelegate (Orbit p, Orbit s, ref double UT, double dT, double Rsoi, double MinUT, double MaxUT, double epsilon, int maxIterations, ref int iterationCount)
 
delegate bool SolveSOI_Delegate (Orbit p, Orbit s, ref double UT, double dT, double Rsoi, double MinUT, double MaxUT, double epsilon, int maxIterations, ref int iterationCount)
 Find the time of SoI crossing (entering) More...
 
double TimeOfTrueAnomaly (double tA, double UT)
 Get the UT for the true anomaly. More...
 
double TrueAnomalyAtRadius (double R)
 
double TrueAnomalyAtT (double T)
 
double TrueAnomalyAtUT (double UT)
 
double TrueAnomalyFromVector (Vector3d vec)
 Returns the true anomaly from a direction vector. The vector is the angle between the direction vector and the vector pointing to periapsis. More...
 
Vector3d Up (double UT)
 Return the Up vector of the orbit at UT. More...
 
void UpdateFromFixedVectors (Vector3d pos, Vector3d vel, CelestialBody refBody, double UT)
 Calculate orbit parameters in the fixed frame rather (ie, pos and vel are in the absolute frame, same as the AN vector) More...
 
void UpdateFromOrbitAtUT (Orbit orbit, double UT, CelestialBody toBody)
 
void UpdateFromStateVectors (Vector3d pos, Vector3d vel, CelestialBody refBody, double UT)
 
void UpdateFromUT (double UT)
 

Static Public Member Functions

static int _FindClosestPoints (Orbit p, Orbit s, ref double CD, ref double CCD, ref double FFp, ref double FFs, ref double SFp, ref double SFs, double epsilon, int maxIterations, ref int iterationCount)
 
static double _SolveClosestApproach (Orbit p, Orbit s, ref double UT, double dT, double threshold, double MinUT, double MaxUT, double epsilon, int maxIterations, ref int iterationCount)
 
static bool _SolveSOI (Orbit p, Orbit s, ref double UT, double dT, double Rsoi, double MinUT, double MaxUT, double epsilon, int maxIterations, ref int iterationCount)
 
static bool _SolveSOI_BSP (Orbit p, Orbit s, ref double UT, double dT, double Rsoi, double MinUT, double MaxUT, double epsilon, int maxIterations, ref int iterationCount)
 
static double AscendingNodeTrueAnomaly (Orbit p, Orbit s)
 Return the true anomaly in orbit p where it's ascending node crosses orbit s. More...
 
static Orbit CreateRandomOrbitAround (CelestialBody body)
 
static Orbit CreateRandomOrbitAround (CelestialBody body, double minAltitude, double maxAltitude)
 
static Orbit CreateRandomOrbitFlyBy (CelestialBody tgtBody, double daysToClosestApproach)
 
static Orbit CreateRandomOrbitFlyBy (Orbit targetOrbit, double timeToPeriapsis, double periapsis, double deltaVatPeriapsis)
 
static Orbit CreateRandomOrbitNearby (Orbit baseOrbit)
 
static double DescendingNodeTrueAnomaly (Orbit p, Orbit s)
 Return the true anomaly in orbit p where it's descending node crosses orbit s. More...
 
static void FindClosestPoints_old (Orbit p, Orbit s, ref double CD, ref double CCD, ref double FFp, ref double FFs, ref double SFp, ref double SFs, double epsilon, int maxIterations, ref int iterationCount)
 
static double NextCloseApproachTime (Orbit p, Orbit s, double UT)
 Find the UT of close approach between orbits. More...
 
static Orbit OrbitFromStateVectors (Vector3d pos, Vector3d vel, CelestialBody body, double UT)
 Creates a new Orbit from the passed in state vectors. More...
 
static bool PeApIntersects (Orbit primary, Orbit secondary, double threshold)
 Tests two orbits to see if they stand any chance of encounter based on their apoapsis and periapsis distances This is the first-stage test. If a pair fails this, it can be ruled out already as the orbits will never meet. Both orbits need to share the same reference body. More...
 
static double RelativeInclination (Orbit p, Orbit s)
 Return the relative inclination between two orbits. More...
 
static double RelativeStateAtUT (Orbit p, Orbit s, double UT, out State pstate, out State sstate, out State rstate, bool dump=false)
 Calculates the relative state vectors of the two bodies with the same parent and returns the relative radial velocity (-ve = approaching, +ve = receding) (sort of: r.v, so scaled by distance) More...
 
static double SafeAcos (double c)
 
static Vector3d Swizzle (Vector3d vec)
 Swizzles the vector to and from orbital <-> worldspace More...
 
static double SynodicPeriod (Orbit o1, Orbit o2)
 Find the synodic period for two orbits. +ve if o1.period < o2.period, -ve if o1.period > o2.period. If one orbit is open, use the close orbit's period with appropriate sign (correct for lim p->inf) If both orbits are open, returns NaN. More...
 

Public Attributes

bool activePatch
 
double altitude
 (distance from surface) More...
 
CelestialBody closestEncounterBody
 
EncounterSolutionLevel closestEncounterLevel
 
Orbit closestEncounterPatch
 
double closestTgtApprUT
 
bool debug_returnFullEllipseTrajectory
 
Vector3 debugPos
 
const double Deg2Rad = Math.PI / 180.0
 
double eccentricAnomaly
 
double EndUT
 
double FEVp
 
double fromE
 
Vector3d h
 
double mag
 
double meanAnomaly
 
double meanAnomalyAtEpoch
 
double meanMotion
 
Orbit nextPatch
 
int numClosePoints
 
ObjectType objectType = ObjectType.UNKNOWN_MISC
 secondary parameters More...
 
double ObT
 time on this orbit (since periapsis) More...
 
double ObTAtEpoch
 
double orbitalEnergy
 
double orbitalSpeed
 
Planetarium.CelestialFrame OrbitFrame
 
Vector3 OrbitFrameX
 
double orbitPercent
 orbit completion More...
 
PatchTransitionType patchEndTransition
 
PatchTransitionType patchStartTransition
 
double period
 
Vector3d pos
 
const double Rad2Deg = 180.0 / Math.PI
 
double radius
 current orbital radius (distance from focus) More...
 
CelestialBody referenceBody
 
Vector3d secondaryPosAtTransition1
 
double StartUT
 
double timeToAp
 
double timeToPe
 
double timeToTransition1
 
double trueAnomaly
 
double inclination
 keplerian parameters More...
 
double eccentricity
 
double semiMajorAxis
 
double LAN
 
double argumentOfPeriapsis
 
double epoch
 

Static Public Attributes

static FindClosestPointsDelegate FindClosestPoints = _FindClosestPoints
 
static SolveClosestApproachDelegate SolveClosestApproach = _SolveClosestApproach
 
static SolveSOI_Delegate SolveSOI = _SolveSOI
 
static SolveSOI_BSPDelegate SolveSOI_BSP = _SolveSOI_BSP
 

Properties

double ApA [get]
 
double ApR [get]
 
double PeA [get]
 
double PeR [get]
 
double semiLatusRectum [get]
 
double semiMinorAxis [get]
 

Member Enumeration Documentation

Enumerator
NONE 
ESCAPE 
ORBIT_INTERSECT 
SOI_INTERSECT_2 
SOI_INTERSECT_1 

Orbit.ObjectType is Deprecated. Use Vessel.vesselType or CelestialBody.bodyType instead.

Enumerator
VESSEL 
SPACE_DEBRIS 
CELESTIAL_BODIES 
UNKNOWN_MISC 
KERBAL 
Enumerator
INITIAL 
FINAL 
ENCOUNTER 
ESCAPE 
MANEUVER 
IMPACT 

Constructor & Destructor Documentation

Orbit.Orbit ( )
inline
Orbit.Orbit ( double  inc,
double  e,
double  sma,
double  lan,
double  argPe,
double  mEp,
double  t,
CelestialBody  body 
)
inline
Orbit.Orbit ( Orbit  orbit)
inline

Member Function Documentation

static int Orbit._FindClosestPoints ( Orbit  p,
Orbit  s,
ref double  CD,
ref double  CCD,
ref double  FFp,
ref double  FFs,
ref double  SFp,
ref double  SFs,
double  epsilon,
int  maxIterations,
ref int  iterationCount 
)
inlinestatic
static double Orbit._SolveClosestApproach ( Orbit  p,
Orbit  s,
ref double  UT,
double  dT,
double  threshold,
double  MinUT,
double  MaxUT,
double  epsilon,
int  maxIterations,
ref int  iterationCount 
)
inlinestatic
static bool Orbit._SolveSOI ( Orbit  p,
Orbit  s,
ref double  UT,
double  dT,
double  Rsoi,
double  MinUT,
double  MaxUT,
double  epsilon,
int  maxIterations,
ref int  iterationCount 
)
inlinestatic

if (!Thread.CurrentThread.IsBackground) { Debug.LogFormat ("[Orbit] _SolveSOI {0}, {1}, {2}, {3}, {4}", UT, Rsoi, rstate.pos.ToString(), rstate.vel.ToString(), dT); }

static bool Orbit._SolveSOI_BSP ( Orbit  p,
Orbit  s,
ref double  UT,
double  dT,
double  Rsoi,
double  MinUT,
double  MaxUT,
double  epsilon,
int  maxIterations,
ref int  iterationCount 
)
inlinestatic

< return true if there is a transition, false if not

static double Orbit.AscendingNodeTrueAnomaly ( Orbit  p,
Orbit  s 
)
inlinestatic

Return the true anomaly in orbit p where it's ascending node crosses orbit s.

Parameters
pfirst orbit
ssecond orbit
Returns
true anomaly in Radians
static Orbit Orbit.CreateRandomOrbitAround ( CelestialBody  body)
inlinestatic
static Orbit Orbit.CreateRandomOrbitAround ( CelestialBody  body,
double  minAltitude,
double  maxAltitude 
)
inlinestatic
static Orbit Orbit.CreateRandomOrbitFlyBy ( CelestialBody  tgtBody,
double  daysToClosestApproach 
)
inlinestatic
static Orbit Orbit.CreateRandomOrbitFlyBy ( Orbit  targetOrbit,
double  timeToPeriapsis,
double  periapsis,
double  deltaVatPeriapsis 
)
inlinestatic
static Orbit Orbit.CreateRandomOrbitNearby ( Orbit  baseOrbit)
inlinestatic
static double Orbit.DescendingNodeTrueAnomaly ( Orbit  p,
Orbit  s 
)
inlinestatic

Return the true anomaly in orbit p where it's descending node crosses orbit s.

Parameters
p
s
Returns
true anomaly in Radians
void Orbit.DrawOrbit ( )
inline
void Orbit.DrawOrbit ( Color  color)
inline

< draw orbit ellipse

< draw velocity vector

< draw ascending node

< draw periapsis

< draw orbit plane normal

double Orbit.EccentricAnomalyAtObT ( double  T)
inline
double Orbit.EccentricAnomalyAtUT ( double  UT)
inline
static void Orbit.FindClosestPoints_old ( Orbit  p,
Orbit  s,
ref double  CD,
ref double  CCD,
ref double  FFp,
ref double  FFs,
ref double  SFp,
ref double  SFs,
double  epsilon,
int  maxIterations,
ref int  iterationCount 
)
inlinestatic

< relative inclinations and relative AN vector

< angles from ascending nodes to relative ascending node

< initial guess for closest point (or solution in case of two circular orbits)

< find the second closest point, which may also be significant

delegate int Orbit.FindClosestPointsDelegate ( Orbit  p,
Orbit  s,
ref double  CD,
ref double  CCD,
ref double  FFp,
ref double  FFs,
ref double  SFp,
ref double  SFs,
double  epsilon,
int  maxIterations,
ref int  iterationCount 
)

Solves the closest point between two orbits starting from the given initial guess values. Both orbits need to share the same reference body.

Parameters
pThe primary Orbit
sThe secondary Orbit
CDThe relative distance of the first closest passage
CCDThe relative distance of the second closest passage (might be the same sometimes)
FFpThe first encounter true anomaly for the primary orbit
FFsThe first encounter true anomaly for the secondary orbit
SFpThe second encounter true anomaly for the primary orbit
SFsThe second encounter true anomaly for the secondary orbit
epsilonThe accuracy threshold to stop iterating
maxIterationsA hard limit for iterations, in case the loop jams up
Returns
The closest distance between both orbits, and the true anomalies for the points in the Fp and Fs parameters
Vector3d Orbit.GetANVector ( )
inline

Returns an updated ascending node vector (use instead of Orbit.eccVec for non-updating orbits when in a rotating ref frame)

Returns
double Orbit.GetDTforTrueAnomaly ( double  tA,
double  wrapAfterSeconds 
)
inline

Get the time remaining to reach the given true anomaly on this orbit

Parameters
tAThe true anomaly to reach
wrapAfterSecondsThe amount of seconds the time is allowed to go into the negative before wrapping around to the next orbit (doesn't apply for hyperbolics)
Returns
The time remaining for that point (will be negative if on a hyperbolic orbit and already past that point)
double Orbit.GetDTforTrueAnomalyAtUT ( double  tA,
double  UT 
)
inline

Determine time delta to get to the specified true anomaly at the given time. For closed trajectories, the delta is limited to +/- 1/2 period (ie, shorted time delta). If time to return to the specified point is desired, add a period. Open trajectories never return (infinity / 2 == infinity).

double Orbit.GetEccentricAnomaly ( double  tA)
inline

Get the Eccentric Anomaly for the given true anomaly

Vector3d Orbit.GetEccVector ( )
inline

Returns an updated eccentricity vector (use instead of Orbit.eccVec for non-updating orbits when in a rotating ref frame)

Returns
Vector3d Orbit.GetFrameVel ( )
inline

get the current total velocity of the orbiting body (relative to the solar system inertial frame)

Returns
The total velocity vector, in Z-up coords.
Vector3d Orbit.GetFrameVelAtUT ( double  UT)
inline
double Orbit.GetMeanAnomaly ( double  E)
inline

Get the Mean Anomaly for the given Eccentric Anomaly

double Orbit.getMeanAnomalyAtUT ( double  UT)
inline
double Orbit.GetMeanMotion ( double  sma)
inline
double Orbit.GetNextApoapsisTime ( double  UT)
inline

Get the next Apoapsis Time after UT

Parameters
UT
Returns
Will return input UT if orbit is hyperbolic.
double Orbit.GetNextPeriapsisTime ( double  UT)
inline

Get the next Periapsis Time after UT

Parameters
UT
Returns
double Orbit.GetNextTimeOfRadius ( double  UT,
double  radius 
)
inline

Get Next Time that Orbit will be at Radius after UT.

Parameters
UT
radius
Returns
Will return UT if radius LT Periapsis or GT Apoapsis</Periapsis>
double Orbit.getObTAtMeanAnomaly ( double  M)
inline
double Orbit.getObtAtTrueAnomaly ( double  tA)
inline

Return orbit "time" for the given true anomaly without any time wrapping

double Orbit.getObtAtUT ( double  UT)
inline
double Orbit.GetOrbitalCurvatureAtTrueAnomaly ( double  ta)
inline
double Orbit.getOrbitalSpeedAt ( double  time)
inline

Get the orbital velocity of the object at the specified time (velocity relative to parent body)

double Orbit.getOrbitalSpeedAtDistance ( double  d)
inline

Get the orbital velocity of the orbiting object at the specified distance to the body it's orbiting (velocity relative to parent body)

double Orbit.getOrbitalSpeedAtPos ( Vector3d  pos)
inline

Get the orbital velocity of the object at the specified global position (velocity relative to parent body)

double Orbit.getOrbitalSpeedAtRelativePos ( Vector3d  relPos)
inline

Get the orbital velocity of the object at the specified relative position (velocity relative to parent body)

double Orbit.GetOrbitalStateVectorsAtObT ( double  ObT,
double  UT,
out Vector3d  pos,
out Vector3d  vel 
)
inline
double Orbit.GetOrbitalStateVectorsAtObT ( double  ObT,
out State  state 
)
inline

Get "full" state vectors for specified orbit "time" (see GetOrbitalStateVectorsAtTrueAnomaly)

double Orbit.GetOrbitalStateVectorsAtTrueAnomaly ( double  tA,
double  UT,
out Vector3d  pos,
out Vector3d  vel 
)
inline
double Orbit.GetOrbitalStateVectorsAtTrueAnomaly ( double  tA,
double  UT,
bool  worldToLocal,
out Vector3d  pos,
out Vector3d  vel 
)
inline
double Orbit.GetOrbitalStateVectorsAtTrueAnomaly ( double  tA,
out State  state 
)
inline

Get "full" state vectors for specified true anomaly

Returns
The current radial distance from the central body

state is set to contain vectors for analytic radius, velocity, acceleration, and jerk (jounce: d3r/dt3). A struct is used so additional derivatives can be added as necessary without affecting every caller. Also sets the angular speed.

double Orbit.GetOrbitalStateVectorsAtUT ( double  UT,
out Vector3d  pos,
out Vector3d  vel 
)
inline
double Orbit.GetOrbitalStateVectorsAtUT ( double  UT,
out State  state 
)
inline

Get "full" state vectors for specified UT (see GetOrbitalStateVectorsAtTrueAnomaly)

Vector3d Orbit.getOrbitalVelocityAtObT ( double  ObT)
inline
Vector3d Orbit.getOrbitalVelocityAtTrueAnomaly ( double  tA)
inline
Vector3d Orbit.getOrbitalVelocityAtTrueAnomaly ( double  tA,
bool  worldToLocal 
)
inline
Vector3d Orbit.getOrbitalVelocityAtUT ( double  UT)
inline
Vector3d Orbit.GetOrbitNormal ( )
inline

Returns an updated orbit normal (use instead of Orbit.h for non-updating orbits when in a rotating ref frame)

Returns
Vector3d Orbit.getPositionAtT ( double  T)
inline
Vector3d Orbit.getPositionAtUT ( double  UT)
inline

Get the position of the orbiting object at the specified Universal Time (relative to the current position of the reference body);

Parameters
UT
Returns
Vector3d Orbit.getPositionFromEccAnomaly ( double  E)
inline

Get a global position vector from the given eccentric anomaly angle (in radians)

< y up

Vector3d Orbit.getPositionFromEccAnomalyWithSemiMinorAxis ( double  E,
double  semiMinorAxis 
)
inline

Get a global position vector from the given eccentric anomaly angle (in radians) Version that request semiMinorAxis for faster repeated call

< y up

Vector3d Orbit.getPositionFromMeanAnomaly ( double  M)
inline

< y up

Vector3d Orbit.getPositionFromTrueAnomaly ( double  tA)
inline

Get a global position vector from the given true anomaly angle (in radians)

< y up

Vector3d Orbit.getPositionFromTrueAnomaly ( double  tA,
bool  worldToLocal 
)
inline

Get a ref-body-relative position vector from the given true anomaly angle (in radians)

double Orbit.GetRadiusAtPhaseAngle ( double  phaseAngle)
inline

Get Radius of the Orbit at a phase angle.

Parameters
phaseAngleThe phase angle in Radians
Returns
double Orbit.GetRadiusAtUT ( double  time)
inline

Get the Radius of the Orbit at a given UT time.

Parameters
timeThe UT time
Returns
The radius
double Orbit.GetRelativeInclination ( Orbit  otherOrbit)
inline

Get the relative inclination between this orbit and another orbit.

Parameters
otherOrbitThe other orbit
Returns
The inclination in degrees
Vector3d Orbit.getRelativePositionAtT ( double  T)
inline
Vector3d Orbit.getRelativePositionAtUT ( double  UT)
inline
Vector3d Orbit.getRelativePositionFromEccAnomaly ( double  E)
inline

Get a ref-body-relative position vector from the given eccentric anomaly angle (in radians)

Vector3d Orbit.getRelativePositionFromEccAnomalyWithSemiMinorAxis ( double  E,
double  semiMinorAxis 
)
inline

Get a ref-body-relative position vector from the given eccentric anomaly angle (in radians) Version that request semiMinorAxis for faster repeated call

Vector3d Orbit.getRelativePositionFromMeanAnomaly ( double  M)
inline

< z up

Vector3d Orbit.getRelativePositionFromTrueAnomaly ( double  tA)
inline

Get a ref-body-relative position vector from the given true anomaly angle (in radians)

Vector3d Orbit.GetRelativeVel ( )
inline

get the current velocity of the orbiting body (relative to it's central body)

Returns
Vector3d Orbit.GetRotFrameVel ( CelestialBody  refBody)
inline

get the velocity of the rotating reference frame, when that frame is in use

Returns
Vector3d Orbit.GetRotFrameVelAtPos ( CelestialBody  refBody,
Vector3d  refPos 
)
inline

get the velocity of the rotating reference frame with respect to a given position (when that frame is in use)

Parameters
refBody
Returns
double Orbit.GetTimeToPeriapsis ( )
inline

Time from StartUT to periapsis on this patch

double Orbit.GetTrueAnomaly ( double  E)
inline
double Orbit.GetTrueAnomalyOfZupVector ( Vector3d  vector)
inline

< find the true anomaly for the mouse position

Vector3d Orbit.getTruePositionAtUT ( double  UT)
inline

Get the position of the orbiting object at the specified Universal Time (relative to the actual position of the reference body at the given UT);

Parameters
UT
Returns
double Orbit.getUTAtMeanAnomaly ( double  M,
double  UT 
)
inline
double Orbit.GetUTforTrueAnomaly ( double  tA,
double  wrapAfterSeconds 
)
inline

Get the Universal Time at which this orbit will reach the given true anomaly

Parameters
tAThe true anomaly to reach
Vector3d Orbit.GetVel ( )
inline

get the current velocity of the orbiting body (in scene space)

Vector3d Orbit.GetWorldSpaceVel ( )
inline
Vector3d Orbit.Horizontal ( double  UT)
inline

Return the Horizontal Vector for the orbit at UT.

Parameters
UT
Returns
void Orbit.Init ( )
inline
static double Orbit.NextCloseApproachTime ( Orbit  p,
Orbit  s,
double  UT 
)
inlinestatic

Find the UT of close approach between orbits.

Parameters
p
s
UT
Returns
Returns the UT after input UT of closest approach.
Vector3d Orbit.Normal ( double  UT)
inline

Returns the Normal Positive Vector of the orbit at UT.

Parameters
o
UT
Returns
static Orbit Orbit.OrbitFromStateVectors ( Vector3d  pos,
Vector3d  vel,
CelestialBody  body,
double  UT 
)
inlinestatic

Creates a new Orbit from the passed in state vectors.

Parameters
posThe position vector
velThe velocity vector
bodyThe celestial body
UTThe time
Returns
The new orbit
static bool Orbit.PeApIntersects ( Orbit  primary,
Orbit  secondary,
double  threshold 
)
inlinestatic

Tests two orbits to see if they stand any chance of encounter based on their apoapsis and periapsis distances This is the first-stage test. If a pair fails this, it can be ruled out already as the orbits will never meet. Both orbits need to share the same reference body.

Parameters
primaryThe primary orbit
secondaryThe secondary orbit
thresholdThe minimum distance to pass the test (should be higher or equal to the SOI radius or either orbit, if available)
Returns
true if the pair passes the test (and needs further verification), false if ruled out.
double Orbit.PhaseAngle ( double  time,
double  longitude 
)
inline

Get the Phase Angle of the Orbit at a given UT time and Longitude.

Parameters
timethe UT time
longitudethe Longitude position
Returns
The Phase Angle in Radians
double Orbit.PhaseAngle ( double  time)
inline

Get the Phase Angle of the Orbit at a given UT time.

Parameters
timethe UT time
Returns
The Phase Angle in Radians
Vector3d Orbit.Prograde ( double  UT)
inline

Return the Prograde Vector of the orbit at UT.

Parameters
UT
Returns
Vector3d Orbit.Radial ( double  UT)
inline

Returns the Radial Positive Vector of the orbit at UT.

Parameters
o
UT
Returns
double Orbit.RadiusAtTrueAnomaly ( double  tA)
inline
static double Orbit.RelativeInclination ( Orbit  p,
Orbit  s 
)
inlinestatic

Return the relative inclination between two orbits.

Parameters
p
s
Returns
static double Orbit.RelativeStateAtUT ( Orbit  p,
Orbit  s,
double  UT,
out State  pstate,
out State  sstate,
out State  rstate,
bool  dump = false 
)
inlinestatic

Calculates the relative state vectors of the two bodies with the same parent and returns the relative radial velocity (-ve = approaching, +ve = receding) (sort of: r.v, so scaled by distance)

static double Orbit.SafeAcos ( double  c)
inlinestatic
void Orbit.SetOrbit ( double  inc,
double  e,
double  sma,
double  lan,
double  argPe,
double  mEp,
double  t,
CelestialBody  body 
)
inline
delegate double Orbit.SolveClosestApproachDelegate ( Orbit  p,
Orbit  s,
ref double  UT,
double  dT,
double  threshold,
double  MinUT,
double  MaxUT,
double  epsilon,
int  maxIterations,
ref int  iterationCount 
)
double Orbit.solveEccentricAnomaly ( double  M,
double  ecc,
double  maxError = 1e-7,
int  maxIterations = 8 
)
inline
delegate bool Orbit.SolveSOI_BSPDelegate ( Orbit  p,
Orbit  s,
ref double  UT,
double  dT,
double  Rsoi,
double  MinUT,
double  MaxUT,
double  epsilon,
int  maxIterations,
ref int  iterationCount 
)
delegate bool Orbit.SolveSOI_Delegate ( Orbit  p,
Orbit  s,
ref double  UT,
double  dT,
double  Rsoi,
double  MinUT,
double  MaxUT,
double  epsilon,
int  maxIterations,
ref int  iterationCount 
)

Find the time of SoI crossing (entering)

dT is used only if MaxUT is not inside the target sphere of influence (bail and use old solver). MaxUT is assumed to be the time of closest approach, but slight errors should be ok so long as MaxUT is inside the SoI. MinUT must be outside (prior to) the SoI, otherwise no solution will be found. Not checked, it is used only to ensure the solver doesn't go off into the weeds.

static Vector3d Orbit.Swizzle ( Vector3d  vec)
inlinestatic

Swizzles the vector to and from orbital <-> worldspace

Parameters
vec
Returns
static double Orbit.SynodicPeriod ( Orbit  o1,
Orbit  o2 
)
inlinestatic

Find the synodic period for two orbits. +ve if o1.period < o2.period, -ve if o1.period > o2.period. If one orbit is open, use the close orbit's period with appropriate sign (correct for lim p->inf) If both orbits are open, returns NaN.

double Orbit.TimeOfTrueAnomaly ( double  tA,
double  UT 
)
inline

Get the UT for the true anomaly.

Parameters
tAtrue anomaly in radians
UTthe time offset
Returns
double Orbit.TrueAnomalyAtRadius ( double  R)
inline
double Orbit.TrueAnomalyAtT ( double  T)
inline
double Orbit.TrueAnomalyAtUT ( double  UT)
inline
double Orbit.TrueAnomalyFromVector ( Vector3d  vec)
inline

Returns the true anomaly from a direction vector. The vector is the angle between the direction vector and the vector pointing to periapsis.

Parameters
vecposition vector
Returns
True Anomaly in Radians
Vector3d Orbit.Up ( double  UT)
inline

Return the Up vector of the orbit at UT.

Parameters
UT
Returns
void Orbit.UpdateFromFixedVectors ( Vector3d  pos,
Vector3d  vel,
CelestialBody  refBody,
double  UT 
)
inline

Calculate orbit parameters in the fixed frame rather (ie, pos and vel are in the absolute frame, same as the AN vector)

void Orbit.UpdateFromOrbitAtUT ( Orbit  orbit,
double  UT,
CelestialBody  toBody 
)
inline
void Orbit.UpdateFromStateVectors ( Vector3d  pos,
Vector3d  vel,
CelestialBody  refBody,
double  UT 
)
inline
void Orbit.UpdateFromUT ( double  UT)
inline

Member Data Documentation

bool Orbit.activePatch
double Orbit.altitude

(distance from surface)

double Orbit.argumentOfPeriapsis
CelestialBody Orbit.closestEncounterBody
EncounterSolutionLevel Orbit.closestEncounterLevel
Orbit Orbit.closestEncounterPatch
double Orbit.closestTgtApprUT
bool Orbit.debug_returnFullEllipseTrajectory
Vector3 Orbit.debugPos
const double Orbit.Deg2Rad = Math.PI / 180.0
double Orbit.eccentricAnomaly
double Orbit.eccentricity
double Orbit.EndUT
double Orbit.epoch
double Orbit.FEVp
FindClosestPointsDelegate Orbit.FindClosestPoints = _FindClosestPoints
static
double Orbit.fromE
Vector3d Orbit.h
double Orbit.inclination

keplerian parameters

double Orbit.LAN
double Orbit.mag
double Orbit.meanAnomaly
double Orbit.meanAnomalyAtEpoch
double Orbit.meanMotion
Orbit Orbit.nextPatch
int Orbit.numClosePoints
ObjectType Orbit.objectType = ObjectType.UNKNOWN_MISC

secondary parameters

double Orbit.ObT

time on this orbit (since periapsis)

double Orbit.ObTAtEpoch
double Orbit.orbitalEnergy
double Orbit.orbitalSpeed
Planetarium.CelestialFrame Orbit.OrbitFrame

orbit frame in fixed space (LAN=0 points along X-axis) OrbitFrame.X is the major axis (+X points to the periapsis) OrbitFrame.Y is the minor axis (or latus rectum: they're parallel) OrbitFrame.Z is the orbit normal (h vector)

Vector3 Orbit.OrbitFrameX
double Orbit.orbitPercent

orbit completion

PatchTransitionType Orbit.patchEndTransition
PatchTransitionType Orbit.patchStartTransition
double Orbit.period
Vector3d Orbit.pos

dynamic parameters NOTE: pos and vel are in the rotating reference frame

const double Orbit.Rad2Deg = 180.0 / Math.PI
double Orbit.radius

current orbital radius (distance from focus)

CelestialBody Orbit.referenceBody
Vector3d Orbit.secondaryPosAtTransition1
double Orbit.semiMajorAxis
SolveClosestApproachDelegate Orbit.SolveClosestApproach = _SolveClosestApproach
static
SolveSOI_Delegate Orbit.SolveSOI = _SolveSOI
static
SolveSOI_BSPDelegate Orbit.SolveSOI_BSP = _SolveSOI_BSP
static
double Orbit.StartUT
double Orbit.timeToAp
double Orbit.timeToPe
double Orbit.timeToTransition1
double Orbit.trueAnomaly

Property Documentation

double Orbit.ApA
get
double Orbit.ApR
get
double Orbit.PeA
get
double Orbit.PeR
get
double Orbit.semiLatusRectum
get
double Orbit.semiMinorAxis
get

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