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