14 // #include "simple_window.h"
16 // #include "retina.h"
17 // #include "manipulator.h"
19 int main(int argc, char **argv) {
23 scalar_t xs[] = { -28, 28, 28, -28 };
24 scalar_t ys[] = { -28, -28, 28, 28 };
25 Universe universe(1000);
28 for(int x = 0; x < w; x++) for(int y = 0; y < h; y++) {
29 p = new Polygon(1.0, 1.0, 1.0, 0.0, xs, ys, 4);
30 p->set_position(30 + 60 * x, 30 + 60 * y, 0);
31 p->set_speed(0, 0, 0);
32 universe.add_polygon(p);
35 const int nb_projectiles = 15;
36 Polygon *projectiles[nb_projectiles];
38 for(int b = 0; b < nb_projectiles; b++) {
41 projectiles[b] = new Polygon(1.0, 0.0, 0.25, 1.0, 0, 0, ne);
42 for(int e = 0; e < ne; e++) {
43 scalar_t alpha = 2 * M_PI * scalar_t(e) / scalar_t(ne);
44 projectiles[b]->set_vertex(e, 200 + 20 * cos(alpha), 200 + 20 * sin(alpha));
46 projectiles[b]->set_position(67 + 60 * b, -60, 0);
48 // scalar_t xs[] = { -10, 10, 10, -10 };
49 // scalar_t ys[] = { -80, -80, 80, 80 };
50 // projectiles[b] = new Polygon(1.0, 0.0, 0.25, 1.0, xs, ys, 4);
51 // projectiles[b]->set_position(67 + 60 * 6, -60, 0);
53 projectiles[b]->set_speed(0, 0, 0);
54 universe.add_polygon(projectiles[b]);
57 for(int n = 0; n < 20000; n++) {
58 if(n%100 == 0) cout << n << endl;
59 for(int b = 0; b < nb_projectiles; b++)
60 projectiles[b]->apply_force(0.01, p->_center_x, p->_center_y, 1, 5);
61 // projectiles[b]->apply_force(0.01, p->_center_x, p->_center_y, 1, 10);
62 universe.update(0.01);
65 for(int n = 0; n < 10000; n++) universe.update(0.01);
67 ofstream os("/tmp/universe.fig");
68 universe.print_fig(os);