You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.6 KiB
57 lines
1.6 KiB
#ifndef BODIES_H |
|
#define BODIES_H |
|
|
|
#include "orbital_objects.h" |
|
#include "maneuver.h" |
|
|
|
// Forward declarations |
|
struct SimulationState; |
|
struct Maneuver; |
|
|
|
// Simulation state |
|
struct SimulationState { |
|
CelestialBody* bodies; |
|
int body_count; |
|
int max_bodies; |
|
|
|
Spacecraft* spacecraft; |
|
int craft_count; |
|
int max_craft; |
|
|
|
Maneuver* maneuvers; |
|
int maneuver_count; |
|
int max_maneuvers; |
|
|
|
double time; |
|
double dt; |
|
char config_name[256]; |
|
}; |
|
|
|
// Simulation management functions |
|
SimulationState* create_simulation(int max_bodies, int max_craft, int max_maneuvers, double time_step); |
|
void destroy_simulation(SimulationState* sim); |
|
|
|
// Dynamic body management |
|
int add_body_to_simulation(SimulationState* sim, CelestialBody* body); |
|
int add_spacecraft(SimulationState* sim, Spacecraft* craft); |
|
|
|
// SOI and simulation update functions |
|
int find_dominant_body(SimulationState* sim, int body_index); |
|
void update_soi(CelestialBody* body, CelestialBody* parent, double semi_major_axis); |
|
void update_simulation(SimulationState* sim); |
|
double calculate_soi_radius(CelestialBody* body, CelestialBody* parent); |
|
|
|
void compute_global_coordinates(SimulationState* sim); |
|
|
|
// FIXME: don't need to be interface functions |
|
// Simulation update helper functions |
|
void update_bodies_physics(SimulationState* sim); |
|
void update_spacecraft_physics(SimulationState* sim); |
|
void execute_pending_maneuvers(SimulationState* sim); |
|
void compute_spacecraft_globals(SimulationState* sim); |
|
|
|
// Initialize orbital objects from orbital elements |
|
// Converts orbital elements to local position/velocity and computes global coordinates |
|
void initialize_orbital_objects(SimulationState* sim); |
|
|
|
#endif
|
|
|