|
Gravity Engine 12.0
Unity Asset for Gravity
|
Public Member Functions | |
| LeapfrogIntegrator (IForceDelegate force) | |
| Initializes a new instance of the LeapfrogIntegrator class. An optional force delegate can be provided if non-Newtonian gravity is desired. | |
| void | Setup (int maxBodies, double timeStep) |
| Setup the specified maxBodies and timeStep. | |
| void | Clear () |
| Clear internal information so no bodies are evolved. | |
| INBodyIntegrator | DeepClone () |
| Clone this instance, replicating internal arrays. Copy across any internal state required for continued evolution. | |
| void | AddNBody (int bodyNum, NBody nbody, GravityState.NbodyState[] nbodyStates) |
| Adds the N body. Implementation may support the case where the initial number of bodies in Setup() is exceeded, creating space, or may ignore additions that exceed this limit (e.g. AZTTriple). | |
| void | RemoveBodyAtIndex (int atIndex) |
| Removes NBody at index i. | |
| void | GrowArrays (int growBy) |
| Grows the arrays. Called by GravityEngine when it changes internal data sizes. | |
| Vector3d | GetAccelerationForIndex (int i) |
| string | GetExternalAccelForIndex (int i) |
| void | PreEvolveForAdd (GravityState.NbodyState[] nbodyStates, int n) |
| void | PreEvolve (GravityState gravityState) |
| Call ONCE after all game objects have been added to allow integrator to pre-calc starting quantities required for integration. | |
| float | GetEnergy (GravityState gravityState) |
| Gets the energy of the system. | |
| float | GetInitialEnergy (GravityState gravityState) |
| Gets the initial energy. | |
| double | Evolve (double time, GravityState gs, bool exactTime) |
| Evolve the specified time, m, r and info. | |
| double | EvolveForceDelegate (double time, GravityState gs) |
| Evolves using the force delegate. Internals differ slightly and for effeciency do not want a conditional on forceDelegate in the inner loop. | |
| void | Setup (int maxBodies, double timeStep) |
| Setup the specified maxBodies and timeStep. Must be called prior to PreEvolve/Evolve. | |
| void | Clear () |
| Clear internal information so no bodies are evolved. | |
| INBodyIntegrator | DeepClone () |
| Clone this instance, replicating internal arrays. Copy across any internal state required for continued evolution. | |
| void | AddNBody (int bodyNum, NBody nbody, GravityState.NbodyState[] nbodyState) |
| Adds the N body. Implementation may support the case where the initial number of bodies in Setup() is exceeded, creating space, or may ignore additions that exceed this limit (e.g. AZTTriple). | |
| void | RemoveBodyAtIndex (int atIndex) |
| Removes NBody at index i. | |
| void | GrowArrays (int growBy) |
| Grows the arrays. Called by GravityEngine when it changes internal data sizes. | |
| Vector3d | GetAccelerationForIndex (int i) |
| string | GetExternalAccelForIndex (int i) |
| void | PreEvolve (GravityState gravityState) |
| Call ONCE after all game objects have been added to allow integrator to pre-calc starting quantities required for integration. | |
| double | Evolve (double time, GravityState gravityState, bool exactTime=false) |
| Evolve the specified time, m, r and info. | |
| float | GetEnergy (GravityState gs) |
| Gets the energy of the system. | |
| float | GetInitialEnergy (GravityState gs) |
| Gets the initial energy. | |
| LeapfrogIntegrator.LeapfrogIntegrator | ( | IForceDelegate | force | ) |
Initializes a new instance of the LeapfrogIntegrator class. An optional force delegate can be provided if non-Newtonian gravity is desired.
| force | Force. |
| void LeapfrogIntegrator.AddNBody | ( | int | bodyNum, |
| NBody | nbody, | ||
| GravityState.NbodyState[] | nbodyState | ||
| ) |
Adds the N body. Implementation may support the case where the initial number of bodies in Setup() is exceeded, creating space, or may ignore additions that exceed this limit (e.g. AZTTriple).
| nbody | NBody component |
Implements INBodyIntegrator.
| void LeapfrogIntegrator.Clear | ( | ) |
Clear internal information so no bodies are evolved.
Implements INBodyIntegrator.
| INBodyIntegrator LeapfrogIntegrator.DeepClone | ( | ) |
Clone this instance, replicating internal arrays. Copy across any internal state required for continued evolution.
Implements INBodyIntegrator.
| double LeapfrogIntegrator.Evolve | ( | double | time, |
| GravityState | gravityState, | ||
| bool | exactTime | ||
| ) |
Evolve the specified time, m, r and info.
Integrators will evolve for at least as long as the specified time, but can overshoot. The GravityEngine will correct on the next cycle.
| time | Time. |
| m | M. |
| r | The red component. |
| info | Info. |
Implements INBodyIntegrator.
| double LeapfrogIntegrator.EvolveForceDelegate | ( | double | time, |
| GravityState | gs | ||
| ) |
Evolves using the force delegate. Internals differ slightly and for effeciency do not want a conditional on forceDelegate in the inner loop.
| time | Time. |
| m | M. |
| r | The red component. |
| info | Info. |
| Vector3d LeapfrogIntegrator.GetAccelerationForIndex | ( | int | i | ) |
Implements INBodyIntegrator.
| float LeapfrogIntegrator.GetEnergy | ( | GravityState | gs | ) |
Gets the energy of the system.
| mass | Mass. |
| pos | Position. |
Implements INBodyIntegrator.
| string LeapfrogIntegrator.GetExternalAccelForIndex | ( | int | i | ) |
Implements INBodyIntegrator.
| float LeapfrogIntegrator.GetInitialEnergy | ( | GravityState | gs | ) |
Gets the initial energy.
| mass | Mass. |
| pos | Position. |
Implements INBodyIntegrator.
| void LeapfrogIntegrator.GrowArrays | ( | int | growBy | ) |
Grows the arrays. Called by GravityEngine when it changes internal data sizes.
| growBy | Grow by. |
Implements INBodyIntegrator.
| void LeapfrogIntegrator.PreEvolve | ( | GravityState | gravityState | ) |
Call ONCE after all game objects have been added to allow integrator to pre-calc starting quantities required for integration.
To avoid copies of mass and position arrays in integrators provide a reference to these for Evolve and PreEvolve
Some implementations (e.g. AZTriple) may make their own copies and then copy the result back into these arrays ///
| m | M. |
| r | The red component. |
| info | Info. |
Implements INBodyIntegrator.
| void LeapfrogIntegrator.RemoveBodyAtIndex | ( | int | atIndex | ) |
| void LeapfrogIntegrator.Setup | ( | int | maxBodies, |
| double | timeStep | ||
| ) |
Setup the specified maxBodies and timeStep.
| maxBodies | Max bodies. |
| timeStep | Time step. |
Implements INBodyIntegrator.