#ifndef PHYSICS_H #define PHYSICS_H // Forward declaration struct CelestialBody; // 3D Vector struct Vec3 { double x, y, z; }; // Gravitational constant (m^3 kg^-1 s^-2) const double G = 6.67430e-11; // Vector math functions Vec3 vec3_add(Vec3 a, Vec3 b); Vec3 vec3_sub(Vec3 a, Vec3 b); Vec3 vec3_cross(Vec3 a, Vec3 b); Vec3 vec3_scale(Vec3 v, double s); double vec3_magnitude(Vec3 v); double vec3_distance(Vec3 a, Vec3 b); Vec3 vec3_normalize(Vec3 v); // Physics functions Vec3 calculate_acceleration(Vec3 force, double mass); // Forward declaration for RK4 context struct SimulationState; struct AccelerationContext { SimulationState* sim; CelestialBody* current_body; int body_index; }; void rk4_step(CelestialBody* body, AccelerationContext* ctx, double dt); #endif