forked from floft/sprouts
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathregion.h
55 lines (46 loc) · 947 Bytes
/
region.h
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
#include "edge.h"
#ifndef REGION_H
#define REGION_H
#include <memory>
#include <vector>
#include "graph.h"
#include "cubicspline.h"
#include "node.h"
#include "polygon.h"
/**************
*Description:
*Input:
*Output:
**************/
using namespace std;
struct Land
{
vector<weak_ptr<Edge>> edges;
vector<shared_ptr<Node>> nodes;
bool isInverted;
Polygon polygon;
};
inline Land transform(const Matrix & tform, Land land)
{
land.polygon = transform(tform, std::move(land.polygon));
return std::move(land);
}
struct Region
{
vector<Land> lands;
vector<shared_ptr<Node>> isolatedNodes;
};
inline Region transform(const Matrix & tform, Region region)
{
for(Land & land : region.lands)
{
land = transform(tform, std::move(land));
}
return std::move(region);
}
struct DisjointPartition
{
vector<weak_ptr<Node>> nodes;
weak_ptr<Region> containingRegion;
};
#endif // REGION_H