Orbit

krpc_SpaceCenter_Orbit_t

Describes an orbit. For example, the orbit of a vessel, obtained by calling krpc_SpaceCenter_Vessel_Orbit(), or a celestial body, obtained by calling krpc_SpaceCenter_CelestialBody_Orbit().

krpc_error_t krpc_SpaceCenter_Orbit_Body(krpc_connection_t connection, krpc_SpaceCenter_CelestialBody_t * result)

The celestial body (e.g. planet or moon) around which the object is orbiting.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_Apoapsis(krpc_connection_t connection, double * result)

Gets the apoapsis of the orbit, in meters, from the center of mass of the body being orbited.

Game Scenes:All

Note

For the apoapsis altitude reported on the in-game map view, use krpc_SpaceCenter_Orbit_ApoapsisAltitude().

krpc_error_t krpc_SpaceCenter_Orbit_Periapsis(krpc_connection_t connection, double * result)

The periapsis of the orbit, in meters, from the center of mass of the body being orbited.

Game Scenes:All

Note

For the periapsis altitude reported on the in-game map view, use krpc_SpaceCenter_Orbit_PeriapsisAltitude().

krpc_error_t krpc_SpaceCenter_Orbit_ApoapsisAltitude(krpc_connection_t connection, double * result)

The apoapsis of the orbit, in meters, above the sea level of the body being orbited.

Game Scenes:All

Note

This is equal to krpc_SpaceCenter_Orbit_Apoapsis() minus the equatorial radius of the body.

krpc_error_t krpc_SpaceCenter_Orbit_PeriapsisAltitude(krpc_connection_t connection, double * result)

The periapsis of the orbit, in meters, above the sea level of the body being orbited.

Game Scenes:All

Note

This is equal to krpc_SpaceCenter_Orbit_Periapsis() minus the equatorial radius of the body.

krpc_error_t krpc_SpaceCenter_Orbit_SemiMajorAxis(krpc_connection_t connection, double * result)

The semi-major axis of the orbit, in meters.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_SemiMinorAxis(krpc_connection_t connection, double * result)

The semi-minor axis of the orbit, in meters.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_Radius(krpc_connection_t connection, double * result)

The current radius of the orbit, in meters. This is the distance between the center of mass of the object in orbit, and the center of mass of the body around which it is orbiting.

Game Scenes:All

Note

This value will change over time if the orbit is elliptical.

krpc_error_t krpc_SpaceCenter_Orbit_RadiusAt(krpc_connection_t connection, double * result, double ut)

The orbital radius at the given time, in meters.

Parameters:
  • ut – The universal time to measure the radius at.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_PositionAt(krpc_connection_t connection, krpc_tuple_double_double_double_t * result, double ut, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)

The position at a given time, in the specified reference frame.

Parameters:
  • ut – The universal time to measure the position at.
  • referenceFrame – The reference frame that the returned position vector is in.
Returns:

The position as a vector.

Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_Speed(krpc_connection_t connection, double * result)

The current orbital speed of the object in meters per second.

Game Scenes:All

Note

This value will change over time if the orbit is elliptical.

krpc_error_t krpc_SpaceCenter_Orbit_Period(krpc_connection_t connection, double * result)

The orbital period, in seconds.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_TimeToApoapsis(krpc_connection_t connection, double * result)

The time until the object reaches apoapsis, in seconds.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_TimeToPeriapsis(krpc_connection_t connection, double * result)

The time until the object reaches periapsis, in seconds.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_Eccentricity(krpc_connection_t connection, double * result)

The eccentricity of the orbit.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_Inclination(krpc_connection_t connection, double * result)

The inclination of the orbit, in radians.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_LongitudeOfAscendingNode(krpc_connection_t connection, double * result)

The longitude of the ascending node, in radians.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_ArgumentOfPeriapsis(krpc_connection_t connection, double * result)

The argument of periapsis, in radians.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_MeanAnomalyAtEpoch(krpc_connection_t connection, double * result)

The mean anomaly at epoch.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_Epoch(krpc_connection_t connection, double * result)

The time since the epoch (the point at which the mean anomaly at epoch was measured, in seconds.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_MeanAnomaly(krpc_connection_t connection, double * result)

The mean anomaly.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_MeanAnomalyAtUT(krpc_connection_t connection, double * result, double ut)

The mean anomaly at the given time.

Parameters:
  • ut – The universal time in seconds.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_EccentricAnomaly(krpc_connection_t connection, double * result)

The eccentric anomaly.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_EccentricAnomalyAtUT(krpc_connection_t connection, double * result, double ut)

The eccentric anomaly at the given universal time.

Parameters:
  • ut – The universal time, in seconds.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_TrueAnomaly(krpc_connection_t connection, double * result)

The true anomaly.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_TrueAnomalyAtUT(krpc_connection_t connection, double * result, double ut)

The true anomaly at the given time.

Parameters:
  • ut – The universal time in seconds.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_TrueAnomalyAtRadius(krpc_connection_t connection, double * result, double radius)

The true anomaly at the given orbital radius.

Parameters:
  • radius – The orbital radius in meters.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_UTAtTrueAnomaly(krpc_connection_t connection, double * result, double trueAnomaly)

The universal time, in seconds, corresponding to the given true anomaly.

Parameters:
  • trueAnomaly – True anomaly.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_RadiusAtTrueAnomaly(krpc_connection_t connection, double * result, double trueAnomaly)

The orbital radius at the point in the orbit given by the true anomaly.

Parameters:
  • trueAnomaly – The true anomaly.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_TrueAnomalyAtAN(krpc_connection_t connection, double * result, krpc_SpaceCenter_Orbit_t target)

The true anomaly of the ascending node with the given target orbit.

Parameters:
  • target – Target orbit.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_TrueAnomalyAtDN(krpc_connection_t connection, double * result, krpc_SpaceCenter_Orbit_t target)

The true anomaly of the descending node with the given target orbit.

Parameters:
  • target – Target orbit.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_OrbitalSpeed(krpc_connection_t connection, double * result)

The current orbital speed in meters per second.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_OrbitalSpeedAt(krpc_connection_t connection, double * result, double time)

The orbital speed at the given time, in meters per second.

Parameters:
  • time – Time from now, in seconds.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_ReferencePlaneNormal(krpc_connection_t connection, krpc_tuple_double_double_double_t * result, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)

The direction that is normal to the orbits reference plane, in the given reference frame. The reference plane is the plane from which the orbits inclination is measured.

Parameters:
  • referenceFrame – The reference frame that the returned direction is in.
Returns:

The direction as a unit vector.

Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_ReferencePlaneDirection(krpc_connection_t connection, krpc_tuple_double_double_double_t * result, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)

The direction from which the orbits longitude of ascending node is measured, in the given reference frame.

Parameters:
  • referenceFrame – The reference frame that the returned direction is in.
Returns:

The direction as a unit vector.

Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_RelativeInclination(krpc_connection_t connection, double * result, krpc_SpaceCenter_Orbit_t target)

Relative inclination of this orbit and the target orbit, in radians.

Parameters:
  • target – Target orbit.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_TimeToSOIChange(krpc_connection_t connection, double * result)

The time until the object changes sphere of influence, in seconds. Returns NaN if the object is not going to change sphere of influence.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_NextOrbit(krpc_connection_t connection, krpc_SpaceCenter_Orbit_t * result)

If the object is going to change sphere of influence in the future, returns the new orbit after the change. Otherwise returns nullptr.

Game Scenes:All
krpc_error_t krpc_SpaceCenter_Orbit_TimeOfClosestApproach(krpc_connection_t connection, double * result, krpc_SpaceCenter_Orbit_t target)

Estimates and returns the time at closest approach to a target orbit.

Parameters:
  • target – Target orbit.
Returns:

The universal time at closest approach, in seconds.

Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_DistanceAtClosestApproach(krpc_connection_t connection, double * result, krpc_SpaceCenter_Orbit_t target)

Estimates and returns the distance at closest approach to a target orbit, in meters.

Parameters:
  • target – Target orbit.
Game Scenes:

All

krpc_error_t krpc_SpaceCenter_Orbit_ListClosestApproaches(krpc_connection_t connection, krpc_list_list_double_t * result, krpc_SpaceCenter_Orbit_t target, int32_t orbits)

Returns the times at closest approach and corresponding distances, to a target orbit.

Parameters:
  • target – Target orbit.
  • orbits – The number of future orbits to search.
Returns:

A list of two lists. The first is a list of times at closest approach, as universal times in seconds. The second is a list of corresponding distances at closest approach, in meters.

Game Scenes:

All