2 // Written and (C) by Francois Fleuret
3 // Contact <francois.fleuret@idiap.ch> for comments & bug reports
18 #include "simple_window.h"
22 scalar_t _xmax, _ymax;
24 int _nb_max_polygons, _nb_polygons;
27 Universe(int nb_max_polygons, scalar_t xmax, scalar_t ymax);
28 // The destructor deletes all the added polygons
31 void initialize(Polygon *p);
33 void add_polygon(Polygon *p);
34 bool collide(Polygon *p);
36 // Compute collisions between projections of the polygons on a few
37 // axis to speed up the computation
38 void compute_pseudo_collisions(int nb_axis, int *nb_colliding_axis);
39 void apply_collision_forces(scalar_t dt);
40 bool update(scalar_t dt);
42 Polygon *pick_polygon(scalar_t x, scalar_t y);
44 void print_xfig(XFigTracer *tracer);
45 void draw(SimpleWindow *window);
48 void draw(cairo_t *context_resource);