X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=flatland.git;a=blobdiff_plain;f=universe.h;h=85fcd5734ad27196dc6cf3a41bb80f86f52d093f;hp=11dacc719ff08b446dcea535e4c465b7e839497a;hb=HEAD;hpb=26abc735ca75a78974c7ced091035e8c27ca1c00 diff --git a/universe.h b/universe.h index 11dacc7..85fcd57 100644 --- a/universe.h +++ b/universe.h @@ -1,26 +1,26 @@ /* - * dyncnn is a deep-learning algorithm for the prediction of - * interacting object dynamics - * - * Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ - * Written by Francois Fleuret - * - * This file is part of dyncnn. - * - * dyncnn is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. - * - * dyncnn is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with dyncnn. If not, see . - * - */ + + flatland is a simple 2d physical simulator + + Copyright (c) 2016 Idiap Research Institute, http://www.idiap.ch/ + Written by Francois Fleuret + + This file is part of flatland + + flatland is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License version 3 as + published by the Free Software Foundation. + + flatland is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with flatland. If not, see . + +*/ #ifndef UNIVERSE_H #define UNIVERSE_H @@ -50,13 +50,17 @@ public: void initialize_polygon(Polygon *p); void clear(); void add_polygon(Polygon *p); + + bool collide_with_borders(Polygon *p, scalar_t padding); bool collide(Polygon *p); // Compute collisions between projections of the polygons on a few // axis to speed up the computation void compute_pseudo_collisions(int nb_axis, int *nb_colliding_axis); + + void apply_gravity(scalar_t dt, scalar_t fx, scalar_t fy); void apply_collision_forces(scalar_t dt); - bool update(scalar_t dt); + bool update(scalar_t dt, scalar_t padding); Polygon *pick_polygon(scalar_t x, scalar_t y);