CelestialBody#

type krpc_SpaceCenter_CelestialBody_t#

Represents a celestial body (such as a planet or moon). See krpc_SpaceCenter_Bodies().

krpc_error_t krpc_SpaceCenter_CelestialBody_Name(krpc_connection_t connection, char **returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The name of the body.

krpc_error_t krpc_SpaceCenter_CelestialBody_Satellites(krpc_connection_t connection, krpc_list_object_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

A list of celestial bodies that are in orbit around this celestial body.

krpc_error_t krpc_SpaceCenter_CelestialBody_Orbit(krpc_connection_t connection, krpc_SpaceCenter_Orbit_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The orbit of the body.

krpc_error_t krpc_SpaceCenter_CelestialBody_Mass(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The mass of the body, in kilograms.

krpc_error_t krpc_SpaceCenter_CelestialBody_GravitationalParameter(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The standard gravitational parameter of the body in \(m^3s^{-2}\).

krpc_error_t krpc_SpaceCenter_CelestialBody_SurfaceGravity(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The acceleration due to gravity at sea level (mean altitude) on the body, in \(m/s^2\).

krpc_error_t krpc_SpaceCenter_CelestialBody_RotationalPeriod(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The sidereal rotational period of the body, in seconds.

krpc_error_t krpc_SpaceCenter_CelestialBody_RotationalSpeed(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The rotational speed of the body, in radians per second.

krpc_error_t krpc_SpaceCenter_CelestialBody_RotationAngle(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The current rotation angle of the body, in radians. A value between 0 and 2 pi.

krpc_error_t krpc_SpaceCenter_CelestialBody_InitialRotation(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The initial rotation angle of the body (at UT 0), in radians. A value between 0 and 2 pi.

krpc_error_t krpc_SpaceCenter_CelestialBody_EquatorialRadius(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The equatorial radius of the body, in meters.

krpc_error_t krpc_SpaceCenter_CelestialBody_SurfaceHeight(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude)#

The height of the surface relative to mean sea level, in meters, at the given position. When over water this is equal to 0.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

krpc_error_t krpc_SpaceCenter_CelestialBody_BedrockHeight(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude)#

The height of the surface relative to mean sea level, in meters, at the given position. When over water, this is the height of the sea-bed and is therefore negative value.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

krpc_error_t krpc_SpaceCenter_CelestialBody_MSLPosition(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The position at mean sea level at the given latitude and longitude, in the given reference frame.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • referenceFrame – Reference frame for the returned position vector.

Returns:

Position as a vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_SurfacePosition(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The position of the surface at the given latitude and longitude, in the given reference frame. When over water, this is the position of the surface of the water.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • referenceFrame – Reference frame for the returned position vector.

Returns:

Position as a vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_BedrockPosition(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The position of the surface at the given latitude and longitude, in the given reference frame. When over water, this is the position at the bottom of the sea-bed.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • referenceFrame – Reference frame for the returned position vector.

Returns:

Position as a vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_PositionAtAltitude(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude, double altitude, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The position at the given latitude, longitude and altitude, in the given reference frame.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • altitude – Altitude in meters above sea level.

  • referenceFrame – Reference frame for the returned position vector.

Returns:

Position as a vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_SurfaceReferenceFrame(krpc_connection_t connection, krpc_SpaceCenter_ReferenceFrame_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude, double altitude)#

Create a reference frame fixed to the surface at the given latitude and longitude.

  • The origin is the given altitude above the surface, at the given latitude and longitude.

  • The axes rotate with the body.

  • The x-axis points out from the center of the body.

  • The y-axis points north.

  • The z-axis points east.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • altitude – Altitude of the origin above the surface, in meters.

Note

Each call returns a new frame, as for krpc_SpaceCenter_ReferenceFrame_CreateRelative().

krpc_error_t krpc_SpaceCenter_CelestialBody_MSLNormal(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The normal to the sphere at mean sea level, at the given latitude and longitude, in the given reference frame. This points straight up, away from the center of the body, and takes no account of the shape of the terrain.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • referenceFrame – Reference frame for the returned normal vector.

Returns:

The normal as a unit vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_SurfaceNormal(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The normal to the surface at the given latitude and longitude, in the given reference frame. This describes the slope of the terrain, and is the normal of the surface of the water when over water.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • referenceFrame – Reference frame for the returned normal vector.

Returns:

The normal as a unit vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_BedrockNormal(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The normal to the surface at the given latitude and longitude, in the given reference frame. This describes the slope of the terrain, and is the normal of the sea-bed when over water.

Parameters:
  • latitude – Latitude in degrees.

  • longitude – Longitude in degrees.

  • referenceFrame – Reference frame for the returned normal vector.

Returns:

The normal as a unit vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_AltitudeAtPosition(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The altitude, in meters, of the given position in the given reference frame.

Parameters:
  • position – Position as a vector.

  • referenceFrame – Reference frame for the position vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_LatitudeAtPosition(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The latitude of the given position, in the given reference frame.

Parameters:
  • position – Position as a vector.

  • referenceFrame – Reference frame for the position vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_LongitudeAtPosition(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The longitude of the given position, in the given reference frame.

Parameters:
  • position – Position as a vector.

  • referenceFrame – Reference frame for the position vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_SphereOfInfluence(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The radius of the sphere of influence of the body, in meters.

krpc_error_t krpc_SpaceCenter_CelestialBody_IsStar(krpc_connection_t connection, bool *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

Whether or not the body is a star.

krpc_error_t krpc_SpaceCenter_CelestialBody_HasSolidSurface(krpc_connection_t connection, bool *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

Whether or not the body has a solid surface.

krpc_error_t krpc_SpaceCenter_CelestialBody_HasAtmosphere(krpc_connection_t connection, bool *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

true if the body has an atmosphere.

krpc_error_t krpc_SpaceCenter_CelestialBody_AtmosphereDepth(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The depth of the atmosphere, in meters.

krpc_error_t krpc_SpaceCenter_CelestialBody_HasOcean(krpc_connection_t connection, bool *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

true if the body has an ocean.

krpc_error_t krpc_SpaceCenter_CelestialBody_OceanDensity(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The density of the body’s ocean, in \(kg/m^3\). Returns zero if the body has no ocean.

krpc_error_t krpc_SpaceCenter_CelestialBody_AtmosphericDensityAtPosition(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The atmospheric density at the given position, in \(kg/m^3\), in the given reference frame.

Parameters:
  • position – The position vector at which to measure the density.

  • referenceFrame – Reference frame that the position vector is in.

krpc_error_t krpc_SpaceCenter_CelestialBody_HasAtmosphericOxygen(krpc_connection_t connection, bool *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

true if there is oxygen in the atmosphere, required for air-breathing engines.

krpc_error_t krpc_SpaceCenter_CelestialBody_TemperatureAt(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The temperature on the body at the given position, in the given reference frame.

Parameters:
  • position – Position as a vector.

  • referenceFrame – The reference frame that the position is in.

Note

The atmospheric ephemeris is evaluated at the current universal time.

krpc_error_t krpc_SpaceCenter_CelestialBody_DensityAt(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double altitude)#

Gets the air density, in \(kg/m^3\), for the specified altitude above sea level, in meters.

Parameters:

Note

This is an approximation, because actual calculations, taking sun exposure into account to compute air temperature, require us to know the exact point on the body where the density is to be computed (knowing the altitude is not enough). However, the difference is small for high altitudes, so it makes very little difference for trajectory prediction.

krpc_error_t krpc_SpaceCenter_CelestialBody_PressureAt(krpc_connection_t connection, double *returnValue, krpc_SpaceCenter_CelestialBody_t instance, double altitude)#

Gets the static pressure, in Pascals, for the specified altitude above sea level, in meters.

Parameters:

Note

Below sea level on a body with an ocean, this includes the pressure of the water.

krpc_error_t krpc_SpaceCenter_CelestialBody_Biomes(krpc_connection_t connection, krpc_set_string_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The biomes present on this body.

krpc_error_t krpc_SpaceCenter_CelestialBody_BiomeAt(krpc_connection_t connection, char **returnValue, krpc_SpaceCenter_CelestialBody_t instance, double latitude, double longitude)#

The biome at the given latitude and longitude, in degrees.

Parameters:

krpc_error_t krpc_SpaceCenter_CelestialBody_FlyingHighAltitudeThreshold(krpc_connection_t connection, float *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The altitude, in meters, above which a vessel is considered to be flying “high” when doing science.

krpc_error_t krpc_SpaceCenter_CelestialBody_SpaceHighAltitudeThreshold(krpc_connection_t connection, float *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The altitude, in meters, above which a vessel is considered to be in “high” space when doing science.

krpc_error_t krpc_SpaceCenter_CelestialBody_ReferenceFrame(krpc_connection_t connection, krpc_SpaceCenter_ReferenceFrame_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The reference frame that is fixed relative to the celestial body.

  • The origin is at the center of the body.

  • The axes rotate with the body.

  • The x-axis points from the center of the body towards the intersection of the prime meridian and equator (the position at 0° longitude, 0° latitude).

  • The y-axis points from the center of the body towards the north pole.

  • The z-axis points from the center of the body towards the equator at 90°E longitude.

../../../_images/celestial-body.png

Celestial body reference frame origin and axes. The equator is shown in blue, and the prime meridian in red.#

krpc_error_t krpc_SpaceCenter_CelestialBody_NonRotatingReferenceFrame(krpc_connection_t connection, krpc_SpaceCenter_ReferenceFrame_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The reference frame that is fixed relative to this celestial body, and orientated in a fixed direction (it does not rotate with the body).

  • The origin is at the center of the body.

  • The axes do not rotate.

  • The x-axis points in an arbitrary direction through the equator.

  • The y-axis points from the center of the body towards the north pole.

  • The z-axis points in an arbitrary direction through the equator.

krpc_error_t krpc_SpaceCenter_CelestialBody_OrbitalReferenceFrame(krpc_connection_t connection, krpc_SpaceCenter_ReferenceFrame_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance)#

The reference frame that is fixed relative to this celestial body, but orientated with the body’s orbital prograde/normal/radial directions.

  • The origin is at the center of the body.

  • The axes rotate with the orbital prograde/normal/radial directions.

  • The x-axis points in the orbital anti-radial direction.

  • The y-axis points in the orbital prograde direction.

  • The z-axis points in the orbital normal direction.

krpc_error_t krpc_SpaceCenter_CelestialBody_Position(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The position of the center of the body, in the specified reference frame.

Parameters:
  • referenceFrame – The reference frame that the returned position vector is in.

Returns:

The position as a vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_Velocity(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The linear velocity of the body, in the specified reference frame.

Parameters:
  • referenceFrame – The reference frame that the returned velocity vector is in.

Returns:

The velocity as a vector. The vector points in the direction of travel, and its magnitude is the speed of the body in meters per second.

krpc_error_t krpc_SpaceCenter_CelestialBody_Rotation(krpc_connection_t connection, krpc_tuple_double_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The rotation of the body, in the specified reference frame.

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

Returns:

The rotation as a quaternion of the form \((x, y, z, w)\).

krpc_error_t krpc_SpaceCenter_CelestialBody_Direction(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The direction in which the north pole of the celestial body is pointing, in the specified reference frame.

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

Returns:

The direction as a unit vector.

krpc_error_t krpc_SpaceCenter_CelestialBody_AngularVelocity(krpc_connection_t connection, krpc_tuple_double_double_double_t *returnValue, krpc_SpaceCenter_CelestialBody_t instance, krpc_SpaceCenter_ReferenceFrame_t referenceFrame)#

The angular velocity of the body in the specified reference frame.

Parameters:
  • referenceFrame – The reference frame the returned angular velocity is in.

Returns:

The angular velocity as a vector. The magnitude of the vector is the rotational speed of the body, in radians per second. The direction of the vector indicates the axis of rotation, using the right-hand rule.