.. default-domain:: java
.. highlight:: java
.. package:: krpc.client.services.SpaceCenter
CelestialBody
=============
.. type:: public class CelestialBody
Represents a celestial body (such as a planet or moon).
See :meth:`getBodies()`.
.. method:: String getName()
The name of the body.
:Game Scenes: All
.. method:: java.util.List getSatellites()
A list of celestial bodies that are in orbit around this celestial body.
:Game Scenes: All
.. method:: Orbit getOrbit()
The orbit of the body.
:Game Scenes: All
.. method:: float getMass()
The mass of the body, in kilograms.
:Game Scenes: All
.. method:: float getGravitationalParameter()
The `standard gravitational parameter `_ of the body in :math:`m^3s^{-2}`.
:Game Scenes: All
.. method:: float getSurfaceGravity()
The acceleration due to gravity at sea level (mean altitude) on the body,
in :math:`m/s^2`.
:Game Scenes: All
.. method:: float getRotationalPeriod()
The sidereal rotational period of the body, in seconds.
:Game Scenes: All
.. method:: float getRotationalSpeed()
The rotational speed of the body, in radians per second.
:Game Scenes: All
.. method:: double getRotationAngle()
The current rotation angle of the body, in radians.
A value between 0 and :math:`2\pi`
:Game Scenes: All
.. method:: double getInitialRotation()
The initial rotation angle of the body (at UT 0), in radians.
A value between 0 and :math:`2\pi`
:Game Scenes: All
.. method:: float getEquatorialRadius()
The equatorial radius of the body, in meters.
:Game Scenes: All
.. method:: double surfaceHeight(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.
:param double latitude: Latitude in degrees.
:param double longitude: Longitude in degrees.
:Game Scenes: All
.. method:: double bedrockHeight(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.
:param double latitude: Latitude in degrees.
:param double longitude: Longitude in degrees.
:Game Scenes: All
.. method:: org.javatuples.Triplet mSLPosition(double latitude, double longitude, ReferenceFrame referenceFrame)
The position at mean sea level at the given latitude and longitude,
in the given reference frame.
:param double latitude: Latitude in degrees.
:param double longitude: Longitude in degrees.
:param ReferenceFrame referenceFrame: Reference frame for the returned position vector.
:returns: Position as a vector.
:Game Scenes: All
.. method:: org.javatuples.Triplet surfacePosition(double latitude, double longitude, ReferenceFrame 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.
:param double latitude: Latitude in degrees.
:param double longitude: Longitude in degrees.
:param ReferenceFrame referenceFrame: Reference frame for the returned position vector.
:returns: Position as a vector.
:Game Scenes: All
.. method:: org.javatuples.Triplet bedrockPosition(double latitude, double longitude, ReferenceFrame 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.
:param double latitude: Latitude in degrees.
:param double longitude: Longitude in degrees.
:param ReferenceFrame referenceFrame: Reference frame for the returned position vector.
:returns: Position as a vector.
:Game Scenes: All
.. method:: org.javatuples.Triplet positionAtAltitude(double latitude, double longitude, double altitude, ReferenceFrame referenceFrame)
The position at the given latitude, longitude and altitude, in the given reference frame.
:param double latitude: Latitude in degrees.
:param double longitude: Longitude in degrees.
:param double altitude: Altitude in meters above sea level.
:param ReferenceFrame referenceFrame: Reference frame for the returned position vector.
:returns: Position as a vector.
:Game Scenes: All
.. method:: double altitudeAtPosition(org.javatuples.Triplet position, ReferenceFrame referenceFrame)
The altitude, in meters, of the given position in the given reference frame.
:param org.javatuples.Triplet position: Position as a vector.
:param ReferenceFrame referenceFrame: Reference frame for the position vector.
:Game Scenes: All
.. method:: double latitudeAtPosition(org.javatuples.Triplet position, ReferenceFrame referenceFrame)
The latitude of the given position, in the given reference frame.
:param org.javatuples.Triplet position: Position as a vector.
:param ReferenceFrame referenceFrame: Reference frame for the position vector.
:Game Scenes: All
.. method:: double longitudeAtPosition(org.javatuples.Triplet position, ReferenceFrame referenceFrame)
The longitude of the given position, in the given reference frame.
:param org.javatuples.Triplet position: Position as a vector.
:param ReferenceFrame referenceFrame: Reference frame for the position vector.
:Game Scenes: All
.. method:: float getSphereOfInfluence()
The radius of the sphere of influence of the body, in meters.
:Game Scenes: All
.. method:: boolean getHasAtmosphere()
``true`` if the body has an atmosphere.
:Game Scenes: All
.. method:: float getAtmosphereDepth()
The depth of the atmosphere, in meters.
:Game Scenes: All
.. method:: double atmosphericDensityAtPosition(org.javatuples.Triplet position, ReferenceFrame referenceFrame)
The atmospheric density at the given position, in :math:`kg/m^3`,
in the given reference frame.
:param org.javatuples.Triplet position: The position vector at which to measure the density.
:param ReferenceFrame referenceFrame: Reference frame that the position vector is in.
:Game Scenes: All
.. method:: boolean getHasAtmosphericOxygen()
``true`` if there is oxygen in the atmosphere, required for air-breathing engines.
:Game Scenes: All
.. method:: double temperatureAt(org.javatuples.Triplet position, ReferenceFrame referenceFrame)
The temperature on the body at the given position, in the given reference frame.
:param org.javatuples.Triplet position: Position as a vector.
:param ReferenceFrame referenceFrame: The reference frame that the position is in.
:Game Scenes: All
.. note::
This calculation is performed using the bodies current position, which means that
the value could be wrong if you want to know the temperature in the far future.
.. method:: double densityAt(double altitude)
Gets the air density, in :math:`kg/m^3`, for the specified
altitude above sea level, in meters.
:param double altitude:
:Game Scenes: All
.. 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.
.. method:: double pressureAt(double altitude)
Gets the air pressure, in Pascals, for the specified
altitude above sea level, in meters.
:param double altitude:
:Game Scenes: All
.. method:: java.util.Set getBiomes()
The biomes present on this body.
:Game Scenes: All
.. method:: String biomeAt(double latitude, double longitude)
The biome at the given latitude and longitude, in degrees.
:param double latitude:
:param double longitude:
:Game Scenes: All
.. method:: float getFlyingHighAltitudeThreshold()
The altitude, in meters, above which a vessel is considered to be
flying "high" when doing science.
:Game Scenes: All
.. method:: float getSpaceHighAltitudeThreshold()
The altitude, in meters, above which a vessel is considered to be
in "high" space when doing science.
:Game Scenes: All
.. method:: ReferenceFrame getReferenceFrame()
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.
:Game Scenes: All
.. figure:: /images/reference-frames/celestial-body.png
:align: center
Celestial body reference frame origin and axes. The equator is shown in
blue, and the prime meridian in red.
.. method:: ReferenceFrame getNonRotatingReferenceFrame()
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.
:Game Scenes: All
.. method:: ReferenceFrame getOrbitalReferenceFrame()
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.
:Game Scenes: All
.. method:: org.javatuples.Triplet position(ReferenceFrame referenceFrame)
The position of the center of the body, in the specified reference frame.
:param ReferenceFrame referenceFrame: The reference frame that the returned position vector is in.
:returns: The position as a vector.
:Game Scenes: All
.. method:: org.javatuples.Triplet velocity(ReferenceFrame referenceFrame)
The linear velocity of the body, in the specified reference frame.
:param ReferenceFrame 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.
:Game Scenes: All
.. method:: org.javatuples.Quartet rotation(ReferenceFrame referenceFrame)
The rotation of the body, in the specified reference frame.
:param ReferenceFrame referenceFrame: The reference frame that the returned rotation is in.
:returns: The rotation as a quaternion of the form :math:`(x, y, z, w)`.
:Game Scenes: All
.. method:: org.javatuples.Triplet direction(ReferenceFrame referenceFrame)
The direction in which the north pole of the celestial body is pointing,
in the specified reference frame.
:param ReferenceFrame referenceFrame: The reference frame that the returned direction is in.
:returns: The direction as a unit vector.
:Game Scenes: All
.. method:: org.javatuples.Triplet angularVelocity(ReferenceFrame referenceFrame)
The angular velocity of the body in the specified reference frame.
:param ReferenceFrame 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.
:Game Scenes: All