1 // -*- compile-command:"g++ -lX11 -Wall -g -O3 -o art misc.o simple_window.o universe.o polygon.o map.o task.o retina.o manipulator.o approximer.o intelligence.o art.cc -L/usr/X11R6/lib/"; -*-
16 // #include "simple_window.h"
18 // #include "retina.h"
19 // #include "manipulator.h"
21 int main(int argc, char **argv) {
25 scalar_t xs[] = { -28, 28, 28, -28 };
26 scalar_t ys[] = { -28, -28, 28, 28 };
28 Universe universe(w * h * 10, w * 60, h * 60);
30 for(int x = 0; x < w; x++) for(int y = 0; y < h; y++) {
31 p = new Polygon(1.0, 1.0, 1.0, 0.0, xs, ys, 4);
32 p->set_position(30 + 60 * x, 30 + 60 * y, 0);
33 p->set_speed(0, 0, 0);
34 universe.initialize(p);
35 universe.add_polygon(p);
38 const int nb_projectiles = 1;
39 Polygon *projectiles[nb_projectiles];
41 for(int b = 0; b < nb_projectiles; b++) {
44 projectiles[b] = new Polygon(1.0, 0.0, 0.25, 1.0, 0, 0, ne);
45 for(int e = 0; e < ne; e++) {
46 scalar_t alpha = 2 * M_PI * scalar_t(e) / scalar_t(ne);
47 projectiles[b]->set_vertex(e, 200 + 20 * cos(alpha), 200 + 20 * sin(alpha));
49 projectiles[b]->set_position(67 + 60 * b, -60, 0);
51 // scalar_t xs[] = { -10, 10, 10, -10 };
52 // scalar_t ys[] = { -80, -80, 80, 80 };
53 // projectiles[b] = new Polygon(1.0, 0.0, 0.25, 1.0, xs, ys, 4);
54 // projectiles[b]->set_position(67 + 60 * 6, -60, 0);
56 projectiles[b]->set_speed(0, 0, 0);
57 universe.initialize(projectiles[b]);
58 universe.add_polygon(projectiles[b]);
63 for(int n = 0; n < 1000; n++) {
64 if(n%100 == 0) cout << n << endl;
65 for(int b = 0; b < nb_projectiles; b++) {
66 projectiles[b]->apply_force(dt, p->_center_x, p->_center_y, 1, 5);
71 for(int n = 0; n < 10000; n++) universe.update(dt);
73 ofstream os("/tmp/universe.fig");
74 universe.print_fig(os);