Added the images for test.
[pom.git] / room.h
1
2 //////////////////////////////////////////////////////////////////////////////////
3 // This program is free software: you can redistribute it and/or modify         //
4 // it under the terms of the version 3 of the GNU General Public License        //
5 // as published by the Free Software Foundation.                                //
6 //                                                                              //
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.                                     //
11 //                                                                              //
12 // You should have received a copy of the GNU General Public License            //
13 // along with this program. If not, see <http://www.gnu.org/licenses/>.         //
14 //                                                                              //
15 // Written by Francois Fleuret                                                  //
16 // (C) Ecole Polytechnique Federale de Lausanne                                 //
17 // Contact <pom@epfl.ch> for comments & bug reports                             //
18 //////////////////////////////////////////////////////////////////////////////////
19
20 #ifndef ROOM_H
21 #define ROOM_H
22
23 #include "rectangle.h"
24 #include "proba_view.h"
25 #include "vector.h"
26
27 using namespace std;
28
29 class Room {
30
31   int _nb_cameras, _nb_positions;
32   int _view_width, _view_height;
33
34   Rectangle *_rectangles;
35
36 public:
37
38   Room(int view_width, int view_height, int nb_cameras, int nb_positions);
39   ~Room();
40
41   inline int nb_positions() const { return _nb_positions; }
42   inline int nb_cameras() const { return _nb_cameras; }
43   inline int view_width() const { return _view_width; }
44   inline int view_height() const { return _view_height; }
45
46   inline Rectangle *avatar(int n_camera, int n_position) const {
47     ASSERT(n_camera >= 0 && n_camera < _nb_cameras &&
48            n_position >= 0 && n_position < _nb_positions,
49            "Index out of bounds");
50     return _rectangles + n_camera * _nb_positions + n_position;
51   }
52
53   void save_stochastic_view(char *name, int ncam, const ProbaView *view,
54                             const Vector<scalar_t> *proba_presence) const;
55 };
56
57 #endif