#ifndef _PLANET_H_ #define _PLANET_H_ #include "../vec2/vec2.h" #include "../gfx/gfx.h" typedef struct _planet { double mass; vec2 pos; // x(t) vec2 prec_pos; // x(t - dt) double e; double DG; double peri; } planet_t; typedef struct _system { planet_t star; // ex. The sun int nb_planets; // The number of orbiting planets planet_t *planets; // An array of orbiting planets } system_t; // Those function are not mandatory to implement, // it's rather a hint of what you should have. planet_t create_planet(double mass, vec2 pos, vec2 prec_pos, double e, double DG, double peri); system_t create_system(); void show_system(struct gfx_context_t *ctxt, system_t *system); void update_system(system_t *system, double delta_t); void free_system(system_t *system); vec2 gravite(planet_t a, planet_t b); vec2 somme_force(system_t system, planet_t P); vec2 accel(system_t system, planet_t p); vec2 vitesse_i(planet_t p); bool is_equal(planet_t a, planet_t b); vec2 pos_init(system_t system, planet_t p, double delta_t); vec2 pos_u(system_t system, planet_t p, double delta_t); #endif