|
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
|
N-body gravitational simulation (Velocity Verlet + Plummer softening). More...
Go to the source code of this file.
Functions | |
| void | nbody_init_preset (NBodySim *sim) |
| Initializes the simulation with a preset solar system configuration. | |
| void | nbody_step (NBodySim *sim, float delta_time) |
| Advances the simulation by the given wall-clock delta time. | |
| void | nbody_update_time_scale (NBodySim *sim, float delta_time) |
| Smoothly transitions time_scale toward target_time_scale. | |
| void | nbody_write_instances (const NBodySim *sim, SphereInstance *out) |
| Writes current body positions and materials into a SphereInstance array. | |
| int | nbody_get_count (const NBodySim *sim) |
| Returns the number of active bodies. | |
| float | nbody_total_energy (const NBodySim *sim) |
| Computes the total energy (kinetic + gravitational potential). | |
| float | nbody_kinetic_energy (const NBodySim *sim) |
| Computes kinetic energy only: Σ ½ m v². | |
| float | nbody_energy_drift (const NBodySim *sim) |
| Returns the relative energy drift |E(t) - E₀| / |E₀|. | |
| float | nbody_energy_drift_signed (const NBodySim *sim) |
| Signed energy drift. | |
N-body gravitational simulation (Velocity Verlet + Plummer softening).
Manages a set of gravitational bodies with position, velocity, and mass. Uses a symplectic Velocity Verlet integrator with per-pair Plummer softening to guarantee long-term energy conservation without ad-hoc damping. Produces SphereInstance data for the instanced renderer.
| float nbody_energy_drift | ( | const NBodySim * | sim | ) |
Returns the relative energy drift |E(t) - E₀| / |E₀|.
| float nbody_energy_drift_signed | ( | const NBodySim * | sim | ) |
Signed energy drift.
| 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_kinetic_energy | ( | const NBodySim * | sim | ) |
Computes kinetic energy only: Σ ½ m v².
| 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).
| void nbody_update_time_scale | ( | NBodySim * | sim, |
| float | delta_time | ||
| ) |
Smoothly transitions time_scale toward target_time_scale.
| void nbody_write_instances | ( | const NBodySim * | sim, |
| SphereInstance * | out | ||
| ) |
Writes current body positions and materials into a SphereInstance array.