3 * dyncnn is a deep-learning algorithm for the prediction of
4 * interacting object dynamics
6 * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/
7 * Written by Francois Fleuret <francois.fleuret@idiap.ch>
9 * This file is part of dyncnn.
11 * dyncnn is free software: you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License version 3 as
13 * published by the Free Software Foundation.
15 * dyncnn is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with dyncnn. If not, see <http://www.gnu.org/licenses/>.
38 scalar_t _width, _height;
40 int _nb_max_polygons, _nb_polygons;
43 inline scalar_t width() { return _width; }
44 inline scalar_t height() { return _height; }
46 Universe(int nb_max_polygons, scalar_t width, scalar_t height);
47 // The destructor deletes all the added polygons
50 void initialize_polygon(Polygon *p);
52 void add_polygon(Polygon *p);
53 bool collide(Polygon *p);
55 // Compute collisions between projections of the polygons on a few
56 // axis to speed up the computation
57 void compute_pseudo_collisions(int nb_axis, int *nb_colliding_axis);
58 void apply_collision_forces(scalar_t dt);
59 bool update(scalar_t dt, scalar_t padding);
61 Polygon *pick_polygon(scalar_t x, scalar_t y);
63 void draw(Canvas *canvas);