star-sim

Barnes-Hut gravity simulation.
git clone git://git.amin.space/star-sim.git
Log | Files | Refs | README | LICENSE

star.h (671B)


      1 #ifndef STAR_H
      2 #define STAR_H
      3 
      4 #include <stdint.h>
      5 
      6 #ifndef M_PI
      7 #define M_PI (3.14159265358979323846264338327950288)
      8 #endif
      9 
     10 #define GRAVITATION 0.1f
     11 
     12 struct Star
     13 {
     14     float angle;
     15     float speed;
     16     float mass;
     17     float size;
     18     float x;
     19     float y;
     20     uint32_t color;
     21 };
     22 
     23 struct Vec2d
     24 {
     25     float angle;
     26     float length;
     27 };
     28 
     29 struct Vec2d *vec2d_add(float angle1, float length1, float angle2, float length2);
     30 void star_accelerate(struct Star *s, float angle, float acceleration);
     31 float star_calc_size(float mass);
     32 void star_attract(struct Star *s1, struct Star *s2);
     33 void star_attract_to_mass(struct Star *star, float mass, float mass_x, float mass_y);
     34 
     35 #endif