2 ////////////////////////////////////////////////////////////////////////////////
3 // This program is free software; you can redistribute it and/or //
4 // modify it under the terms of the GNU General Public License //
5 // version 2 as published by the Free Software Foundation. //
7 // This program is distributed in the hope that it will be useful, but //
8 // WITHOUT ANY WARRANTY; without even the implied warranty of //
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
10 // General Public License for more details. //
12 // Written and (C) by François Fleuret //
13 // Contact <francois.fleuret@epfl.ch> for comments & bug reports //
14 ////////////////////////////////////////////////////////////////////////////////
25 #include "simple_window.h"
29 scalar_t _xmax, _ymax;
31 int _nb_max_polygons, _nb_polygons;
33 Universe(int nb_max_polygons, scalar_t xmax, scalar_t ymax);
34 // The destructor deletes all the added polygons
36 void initialize(Polygon *p);
38 void add_polygon(Polygon *p);
39 bool collide(Polygon *p);
40 // Compute collisions between projections of the polygons on a few
41 // axis to speed up the computation
42 void compute_pseudo_collisions(int nb_axis, int *nb_colliding_axis);
43 void apply_collision_forces(scalar_t dt);
44 bool update(scalar_t dt);
45 Polygon *pick_polygon(scalar_t x, scalar_t y);
46 void print_fig(ostream &os);
47 void draw(SimpleWindow *window);