-
Notifications
You must be signed in to change notification settings - Fork 0
/
Region.hpp
48 lines (36 loc) · 814 Bytes
/
Region.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef WORLDBUILDER_REGION
#define WORLDBUILDER_REGION
#include "Point.hpp"
#include <vector>
#include <random>
enum Location
{
NorthEast,
North,
NorthWest,
East,
Central,
West,
SouthEast,
South,
SouthWest
};
class Region
{
public:
Region(double t_width, double t_height);
Region(const Point &t_p1, const Point &t_p2);
Region(const Point &t_p1, double t_width, double t_height);
Region get_location(Location t_location) const;
std::vector<Region> subdivide(int t_horizontal, int t_vertical) const;
double width() const;
double height() const;
Point top_left() const;
Point bottom_right() const;
bool contains(const Point &t_p) const;
Point choose_point(std::mt19937 &t_engine) const;
private:
Point m_p1;
Point m_p2;
};
#endif