int nbody_get_count(const NBodySim *sim)
Returns the number of active bodies.
void nbody_init_preset(NBodySim *sim)
Initializes the simulation with a preset solar system configuration.
float nbody_energy_drift_signed(const NBodySim *sim)
Signed energy drift.
void nbody_step(NBodySim *sim, float delta_time)
Advances the simulation by the given wall-clock delta time.
float nbody_total_energy(const NBodySim *sim)
Computes the total energy (kinetic + gravitational potential).
float nbody_energy_drift(const NBodySim *sim)
Returns the relative energy drift |E(t) - E₀| / |E₀|.
void nbody_write_instances(const NBodySim *sim, SphereInstance *out)
Writes current body positions and materials into a SphereInstance array.
void nbody_update_time_scale(NBodySim *sim, float delta_time)
Smoothly transitions time_scale toward target_time_scale.
float nbody_kinetic_energy(const NBodySim *sim)
Computes kinetic energy only: Σ ½ m v².
State container for the N-body simulation.
Definition nbody_types.h:68