CelestialBody#
- class SpaceCenter.CelestialBody#
Represents a celestial body (such as a planet or moon). See
SpaceCenter.bodies.-
name:
string# The name of the body.
- Attribute:
Read-only, cannot be set
-
satellites:
List# A list of celestial bodies that are in orbit around this celestial body.
- Attribute:
Read-only, cannot be set
-
orbit:
SpaceCenter.Orbit|nil# The orbit of the body.
- Attribute:
Read-only, cannot be set
-
mass:
number# The mass of the body, in kilograms.
- Attribute:
Read-only, cannot be set
-
gravitational_parameter:
number# The standard gravitational parameter of the body in \(\mathrm{m^{3} \cdot s^{-2}}\). This is \(GM\), where \(G\) is the gravitational constant and \(M\) the mass of the body.
- Attribute:
Read-only, cannot be set
-
surface_gravity:
number# The acceleration due to gravity at sea level (mean altitude) on the body, in \(\mathrm{m/s^{2}}\).
- Attribute:
Read-only, cannot be set
-
rotational_period:
number# The sidereal rotational period of the body, in seconds.
- Attribute:
Read-only, cannot be set
-
rotational_speed:
number# The rotational speed of the body, in \(\mathrm{rad/s}\).
- Attribute:
Read-only, cannot be set
-
rotation_angle:
number# The current rotation angle of the body, in radians. A value between 0 and \(2\pi\).
- Attribute:
Read-only, cannot be set
-
initial_rotation:
number# The initial rotation angle of the body (at UT 0), in radians. A value between 0 and \(2\pi\).
- Attribute:
Read-only, cannot be set
-
equatorial_radius:
number# The equatorial radius of the body, in meters.
- Attribute:
Read-only, cannot be set
-
surface_height(latitude:
number, longitude:number):number# 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.
-
bedrock_height(latitude:
number, longitude:number):number# 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.
-
msl_position(
latitude:number,
longitude:number,
reference_frame:SpaceCenter.ReferenceFrame
):Tuple# 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.
reference_frame – Reference frame for the returned position vector.
- Returns:
Position as a vector.
-
surface_position(
latitude:number,
longitude:number,
reference_frame:SpaceCenter.ReferenceFrame
):Tuple# 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.
reference_frame – Reference frame for the returned position vector.
- Returns:
Position as a vector.
-
bedrock_position(
latitude:number,
longitude:number,
reference_frame:SpaceCenter.ReferenceFrame
):Tuple# 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.
reference_frame – Reference frame for the returned position vector.
- Returns:
Position as a vector.
-
position_at_altitude(
latitude:number,
longitude:number,
altitude:number,
reference_frame:SpaceCenter.ReferenceFrame
):Tuple# 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.
reference_frame – Reference frame for the returned position vector.
- Returns:
Position as a vector.
-
surface_reference_frame(
latitude:number,
longitude:number,
altitude?:number
):SpaceCenter.ReferenceFrame# 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. Defaults to
0.0.
Note
Each call returns a new frame, as for
SpaceCenter.ReferenceFrame.create_relative().
-
msl_normal(
latitude:number,
longitude:number,
reference_frame:SpaceCenter.ReferenceFrame
):Tuple# 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.
reference_frame – Reference frame for the returned normal vector.
- Returns:
The normal as a unit vector.
-
surface_normal(
latitude:number,
longitude:number,
reference_frame:SpaceCenter.ReferenceFrame
):Tuple# 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.
reference_frame – Reference frame for the returned normal vector.
- Returns:
The normal as a unit vector.
-
bedrock_normal(
latitude:number,
longitude:number,
reference_frame:SpaceCenter.ReferenceFrame
):Tuple# 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.
reference_frame – Reference frame for the returned normal vector.
- Returns:
The normal as a unit vector.
-
altitude_at_position(
position:Tuple,
reference_frame:SpaceCenter.ReferenceFrame
):number# The altitude, in meters, of the given position in the given reference frame.
- Parameters:
position – Position as a vector.
reference_frame – Reference frame for the position vector.
-
latitude_at_position(
position:Tuple,
reference_frame:SpaceCenter.ReferenceFrame
):number# The latitude of the given position, in the given reference frame.
- Parameters:
position – Position as a vector.
reference_frame – Reference frame for the position vector.
-
longitude_at_position(
position:Tuple,
reference_frame:SpaceCenter.ReferenceFrame
):number# The longitude of the given position, in the given reference frame.
- Parameters:
position – Position as a vector.
reference_frame – Reference frame for the position vector.
-
sphere_of_influence:
number# The radius of the sphere of influence of the body, in meters.
- Attribute:
Read-only, cannot be set
-
is_star:
boolean# Whether or not the body is a star.
- Attribute:
Read-only, cannot be set
-
has_solid_surface:
boolean# Whether or not the body has a solid surface.
- Attribute:
Read-only, cannot be set
-
has_atmosphere:
boolean# Trueif the body has an atmosphere.- Attribute:
Read-only, cannot be set
-
atmosphere_depth:
number# The depth of the atmosphere, in meters.
- Attribute:
Read-only, cannot be set
-
has_ocean:
boolean# Trueif the body has an ocean.- Attribute:
Read-only, cannot be set
-
ocean_density:
number# The density of the body’s ocean, in \(\mathrm{kg/m^{3}}\). Returns zero if the body has no ocean.
- Attribute:
Read-only, cannot be set
-
atmospheric_density_at_position(
position:Tuple,
reference_frame:SpaceCenter.ReferenceFrame
):number# The atmospheric density at the given position, in \(\mathrm{kg/m^{3}}\), in the given reference frame.
- Parameters:
position – The position vector at which to measure the density.
reference_frame – Reference frame that the position vector is in.
-
has_atmospheric_oxygen:
boolean# Trueif there is oxygen in the atmosphere, required for air-breathing engines.- Attribute:
Read-only, cannot be set
-
temperature_at(
position:Tuple,
reference_frame:SpaceCenter.ReferenceFrame
):number# The temperature on the body at the given position, in the given reference frame.
- Parameters:
position – Position as a vector.
reference_frame – The reference frame that the position is in.
Note
The atmospheric ephemeris is evaluated at the current universal time.
-
density_at(altitude:
number):number# Gets the air density, in \(\mathrm{kg/m^{3}}\), for the specified altitude above sea level, in meters.
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.
-
pressure_at(altitude:
number):number# Gets the static pressure, in Pascals, for the specified altitude above sea level, in meters.
Note
Below sea level on a body with an ocean, this includes the pressure of the water.
-
biomes:
Set# The biomes present on this body.
- Attribute:
Read-only, cannot be set
-
biome_at(latitude:
number, longitude:number):string# The biome at the given latitude and longitude, in degrees.
-
flying_high_altitude_threshold:
number# The altitude, in meters, above which a vessel is considered to be flying “high” when doing science.
- Attribute:
Read-only, cannot be set
-
space_high_altitude_threshold:
number# The altitude, in meters, above which a vessel is considered to be in “high” space when doing science.
- Attribute:
Read-only, cannot be set
-
reference_frame:
SpaceCenter.ReferenceFrame# 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.
- Attribute:
Read-only, cannot be set
Celestial body reference frame origin and axes. The equator is shown in blue, and the prime meridian in red.#
-
non_rotating_reference_frame:
SpaceCenter.ReferenceFrame# 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.
- Attribute:
Read-only, cannot be set
-
orbital_reference_frame:
SpaceCenter.ReferenceFrame# 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.
- Attribute:
Read-only, cannot be set
-
position(reference_frame:
SpaceCenter.ReferenceFrame):Tuple# The position of the center of the body, in the specified reference frame.
- Parameters:
reference_frame – The reference frame that the returned position vector is in.
- Returns:
The position as a vector.
-
velocity(reference_frame:
SpaceCenter.ReferenceFrame):Tuple# The linear velocity of the body, in the specified reference frame.
- Parameters:
reference_frame – 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 \(\mathrm{m/s}\).
-
rotation(reference_frame:
SpaceCenter.ReferenceFrame):Tuple# The rotation of the body, in the specified reference frame.
- Parameters:
reference_frame – The reference frame that the returned rotation is in.
- Returns:
The rotation as a quaternion of the form
(x, y, z, w).
-
direction(reference_frame:
SpaceCenter.ReferenceFrame):Tuple# The direction in which the north pole of the celestial body is pointing, in the specified reference frame.
- Parameters:
reference_frame – The reference frame that the returned direction is in.
- Returns:
The direction as a unit vector.
-
angular_velocity(reference_frame:
SpaceCenter.ReferenceFrame):Tuple# The angular velocity of the body in the specified reference frame.
- Parameters:
reference_frame – 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 \(\mathrm{rad/s}\). The direction of the vector indicates the axis of rotation, using the right-hand rule.
-
name: