-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalisson_grid.hpp
56 lines (41 loc) · 1.07 KB
/
calisson_grid.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
48
49
50
51
52
53
54
55
56
#pragma once
#include <ostream>
#include <vector>
#include "grid.hpp"
namespace Calissons {
class Grid;
}
std::ostream& operator<<(std::ostream& os, const Calissons::Grid&);
namespace Calissons {
enum CalissonEdge { None = 0, Edge = 1, EdgeVar = 2, Losange = 3, Ext };
typedef struct {
int i;
int j;
int d;
} Coord;
typedef struct {
Coord e[4];
} EdgesNei;
class Grid {
public:
Grid(int size);
Grid(const Dominos::Grid& g);
CalissonEdge edge(const Coord& c) const;
void set_edge(const Coord& c, CalissonEdge e);
void init_empty();
void segmentify();
int start_j(int i) const;
int end_j(int i) const;
bool is_edg_inside(const Coord& c) const;
static EdgesNei get_edg_nei(const Coord& c);
int size() const;
void to_image_blueprint(std::ostream& os);
friend std::ostream& ::operator<<(std::ostream & os, const Grid&);
private:
void segmentify_seg(const Coord& c);
void to_image_blueprint_seg(std::ostream& os, const Coord& c);
int linearise(const Coord& c) const;
int size_;
std::vector<CalissonEdge> grid_;
};
} // namespace Calissons