1 #define S_ALIVE 0x01 2 #define S_SELECTED 0x02 3 #define S_FIXED 0x04 4 #define S_TEMPFIXED 0x08 5 6 #define ALLOC_SIZE 32 7 8 typedef struct { 9 /* Current position, velocity, acceleration */ 10 double x, y; 11 double vx, vy; 12 double ax, ay; 13 14 /* Mass and radius of mass */ 15 double mass; 16 double elastic; 17 int radius; 18 19 /* Connections to springs */ 20 int *pars; 21 int num_pars; 22 23 int status; 24 25 /* RK temporary space */ 26 double cur_x, cur_y, cur_vx, cur_vy; 27 double old_x, old_y, old_vx, old_vy; 28 double test_x, test_y, test_vx, test_vy; 29 double k1x, k1y, k1vx, k1vy; 30 double k2x, k2y, k2vx, k2vy; 31 double k3x, k3y, k3vx, k3vy; 32 double k4x, k4y, k4vx, k4vy; 33 double k5x, k5y, k5vx, k5vy; 34 double k6x, k6y, k6vx, k6vy; 35 } mass; 36 37 typedef struct { 38 /* Ks, Kd and rest length of spring */ 39 double ks, kd; 40 double restlen; 41 42 /* Connected to masses m1 and m2 */ 43 int m1, m2; 44 45 int status; 46 } spring; 47 48 extern mass *masses; 49 extern spring *springs; 50 extern int num_mass, num_spring, fake_mass, fake_spring; 51 52