-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHex.cpp
More file actions
41 lines (31 loc) · 715 Bytes
/
Hex.cpp
File metadata and controls
41 lines (31 loc) · 715 Bytes
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
#include "Hex.h"
#include "HexVertex.h"
#include "HalfQuad.h"
Hex::Hex(int id, int index, HexVertex *vers[8], std::string& property)
: m_id(id), m_index(index), m_property(property), m_boundary(false)
{
for (int i = 0; i < 8; ++i) {
m_vers[i] = vers[i];
m_center += vers[i]->point();
}
m_center /= 8.0;
static int fv_order[][4] = {
1, 0, 4, 5,
3, 1, 5, 7,
3, 7, 6, 2,
0, 2, 6, 4,
5, 4, 6, 7,
1, 3, 2, 0,
};
for (int i = 0; i < MAX_ORIENTATION; ++i) {
HexVertex *vers[4];
for (int j = 0; j < 4; ++j) {
vers[j] = m_vers[fv_order[i][j]];
}
HalfQuad *halfquad = new HalfQuad(vers, ORIENTATION(i));
m_halfquads[i] = halfquad;
halfquad->hex() = this;
}
}
Hex::~Hex() {
}