//astronomy/io.github.cosinekitty.astronomy/GravitySimulator
class GravitySimulator
A simulation of zero or more small bodies moving through the Solar System.
This class calculates the movement of arbitrary small bodies, such as asteroids or comets, that move through the Solar System. It does so by calculating the gravitational forces on the bodies from the Sun and planets. The user of this class supplies a list of initial positions and velocities for the small bodies. Then the class can update the positions and velocities over small time steps. The gravity simulator also provides access to the positions and velocities of the Sun and planets used in the simulation.
GravitySimulator fun GravitySimulator(originBody: Body, time: Time, bodyStates: List<StateVector>) Creates a gravity simulation object. |
Name | Summary |
---|---|
solarSystemBodyState fun solarSystemBodyState(body: Body): StateVector Get the position and velocity of a Solar System body included in the simulation. |
|
swap fun swap() Exchange the current time step with the previous time step. |
|
time fun time(): Time Returns the time of the current simulation step. |
|
update fun update(time: Time): Array<StateVector> Advances the gravity simulation by a small time step. |
Name | Summary |
---|---|
originBody val originBody: Body The origin of the reference frame. See constructor for more info. |