.. default-domain:: java
.. highlight:: java
.. package:: krpc.client.services.SpaceCenter
Orbit
=====
.. type:: public class Orbit
Describes an orbit. For example, the orbit of a vessel, obtained by calling
:meth:`Vessel.getOrbit()`, or a celestial body, obtained by calling
:meth:`CelestialBody.getOrbit()`.
.. method:: CelestialBody getBody()
The celestial body (e.g. planet or moon) around which the object is orbiting.
:Game Scenes: All
.. method:: double getApoapsis()
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 :meth:`Orbit.getApoapsisAltitude()`.
.. method:: double getPeriapsis()
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 :meth:`Orbit.getPeriapsisAltitude()`.
.. method:: double getApoapsisAltitude()
The apoapsis of the orbit, in meters, above the sea level of the body being orbited.
:Game Scenes: All
.. note::
This is equal to :meth:`Orbit.getApoapsis()` minus the equatorial radius of the body.
.. method:: double getPeriapsisAltitude()
The periapsis of the orbit, in meters, above the sea level of the body being orbited.
:Game Scenes: All
.. note::
This is equal to :meth:`Orbit.getPeriapsis()` minus the equatorial radius of the body.
.. method:: double getSemiMajorAxis()
The semi-major axis of the orbit, in meters.
:Game Scenes: All
.. method:: double getSemiMinorAxis()
The semi-minor axis of the orbit, in meters.
:Game Scenes: All
.. method:: double getRadius()
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.
.. method:: double radiusAt(double ut)
The orbital radius at the given time, in meters.
:param double ut: The universal time to measure the radius at.
:Game Scenes: All
.. method:: org.javatuples.Triplet positionAt(double ut, ReferenceFrame referenceFrame)
The position at a given time, in the specified reference frame.
:param double ut: The universal time to measure the position at.
:param ReferenceFrame referenceFrame: The reference frame that the returned position vector is in.
:returns: The position as a vector.
:Game Scenes: All
.. method:: double getSpeed()
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.
.. method:: double getPeriod()
The orbital period, in seconds.
:Game Scenes: All
.. method:: double getTimeToApoapsis()
The time until the object reaches apoapsis, in seconds.
:Game Scenes: All
.. method:: double getTimeToPeriapsis()
The time until the object reaches periapsis, in seconds.
:Game Scenes: All
.. method:: double getEccentricity()
The `eccentricity `_
of the orbit.
:Game Scenes: All
.. method:: double getInclination()
The `inclination `_
of the orbit,
in radians.
:Game Scenes: All
.. method:: double getLongitudeOfAscendingNode()
The `longitude of the ascending node `_, in radians.
:Game Scenes: All
.. method:: double getArgumentOfPeriapsis()
The `argument of periapsis `_, in radians.
:Game Scenes: All
.. method:: double getMeanAnomalyAtEpoch()
The `mean anomaly at epoch `_.
:Game Scenes: All
.. method:: double getEpoch()
The time since the epoch (the point at which the
`mean anomaly at epoch `_
was measured, in seconds.
:Game Scenes: All
.. method:: double getMeanAnomaly()
The `mean anomaly `_.
:Game Scenes: All
.. method:: double meanAnomalyAtUT(double ut)
The mean anomaly at the given time.
:param double ut: The universal time in seconds.
:Game Scenes: All
.. method:: double getEccentricAnomaly()
The `eccentric anomaly `_.
:Game Scenes: All
.. method:: double eccentricAnomalyAtUT(double ut)
The eccentric anomaly at the given universal time.
:param double ut: The universal time, in seconds.
:Game Scenes: All
.. method:: double getTrueAnomaly()
The `true anomaly `_.
:Game Scenes: All
.. method:: double trueAnomalyAtUT(double ut)
The true anomaly at the given time.
:param double ut: The universal time in seconds.
:Game Scenes: All
.. method:: double trueAnomalyAtRadius(double radius)
The true anomaly at the given orbital radius.
:param double radius: The orbital radius in meters.
:Game Scenes: All
.. method:: double uTAtTrueAnomaly(double trueAnomaly)
The universal time, in seconds, corresponding to the given true anomaly.
:param double trueAnomaly: True anomaly.
:Game Scenes: All
.. method:: double radiusAtTrueAnomaly(double trueAnomaly)
The orbital radius at the point in the orbit given by the true anomaly.
:param double trueAnomaly: The true anomaly.
:Game Scenes: All
.. method:: double trueAnomalyAtAN(Orbit target)
The true anomaly of the ascending node with the given target orbit.
:param Orbit target: Target orbit.
:Game Scenes: All
.. method:: double trueAnomalyAtDN(Orbit target)
The true anomaly of the descending node with the given target orbit.
:param Orbit target: Target orbit.
:Game Scenes: All
.. method:: double getOrbitalSpeed()
The current orbital speed in meters per second.
:Game Scenes: All
.. method:: double orbitalSpeedAt(double time)
The orbital speed at the given time, in meters per second.
:param double time: Time from now, in seconds.
:Game Scenes: All
.. method:: static org.javatuples.Triplet referencePlaneNormal(Connection connection, ReferenceFrame 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.
:param ReferenceFrame referenceFrame: The reference frame that the returned direction is in.
:returns: The direction as a unit vector.
:Game Scenes: All
.. method:: static org.javatuples.Triplet referencePlaneDirection(Connection connection, ReferenceFrame referenceFrame)
The direction from which the orbits longitude of ascending node is measured,
in the given 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:: double relativeInclination(Orbit target)
Relative inclination of this orbit and the target orbit, in radians.
:param Orbit target: Target orbit.
:Game Scenes: All
.. method:: double getTimeToSOIChange()
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
.. method:: Orbit getNextOrbit()
If the object is going to change sphere of influence in the future, returns the new
orbit after the change. Otherwise returns ``null``.
:Game Scenes: All
.. method:: double timeOfClosestApproach(Orbit target)
Estimates and returns the time at closest approach to a target orbit.
:param Orbit target: Target orbit.
:returns: The universal time at closest approach, in seconds.
:Game Scenes: All
.. method:: double distanceAtClosestApproach(Orbit target)
Estimates and returns the distance at closest approach to a target orbit, in meters.
:param Orbit target: Target orbit.
:Game Scenes: All
.. method:: java.util.List> listClosestApproaches(Orbit target, int orbits)
Returns the times at closest approach and corresponding distances, to a target orbit.
:param Orbit target: Target orbit.
:param int 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