ScummVM API documentation
region_set.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef PHOENIXVR_REGIONS_H
23 #define PHOENIXVR_REGIONS_H
24 
25 #include "common/array.h"
26 #include "phoenixvr/rectf.h"
27 
28 namespace Common {
29 class String;
30 class SeekableReadStream;
31 } // namespace Common
32 
33 namespace PhoenixVR {
34 struct Region {
35  float a, b, c, d;
36  void setEmpty() {
37  a = b = c = d = 0;
38  }
39  RectF toRect() const;
40  Common::String toString() const;
41  bool contains3D(float angleX, float angleY) const;
42  bool contains3D(PointF p) const { return contains3D(p.x, p.y); }
43  bool contains2D(float x, float y) const {
44  return toRect().contains(x, y);
45  }
46 };
47 
48 class RegionSet {
49  Common::Array<Region> _regions;
50 
51 public:
53  uint size() const { return _regions.size(); }
54  const Common::Array<Region> &getRegions() const { return _regions; }
55  const Region &getRegion(uint idx) const {
56  return _regions[idx];
57  }
58 };
59 } // namespace PhoenixVR
60 
61 #endif
Definition: str.h:59
Definition: stream.h:745
Definition: region_set.h:34
Definition: angle.h:32
Definition: algorithm.h:29
size_type size() const
Definition: array.h:316
Definition: region_set.h:48