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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#pragma once
#include <array>
#include <cstdint>
namespace kel {
namespace impl {
struct ico_surface_helper {
/**
* On each triangle we assume a ccw order and we start on the top-left part of the
* triangle. The orientation of the triangle is determined by the horizontal line
* (on the 2D foldout of the icosahedron) which is the down direction.
*/
static constexpr std::array<std::array<uint8_t,3u>, 20u> neighbour_map {
{1,4,5},//0
{2,0,6},//1
{3,1,7},//2
{4,2,8},//3
{0,3,9},//4
{14,10,0},//5
{10,11,1},//6
{11,12,2},//7
{12,13,3},//8
{13,14,4},//9
{6,5,15},//10
{7,6,16},//11
{8,7,17},//12
{9,8,18},//13
{5,9,19},//14
{19,16,10},//15
{15,17,11},//16
{16,18,12},//17
{17,19,13},//18
{18,15,14} //19
};
};
}
template<uint64_t SubD>
class ico_addr {
private:
std::array<uint8_t, SubD+1u> vals_;
public:
template<uint64_t Div = 1u>
ico_addr<Div> slice() const {
return {};
}
};
template<typename T, uint64_t D>
class ico_triangle {
private:
std::array<ico_triangle<T,D-1u>> subdivs_;
public:
};
template<typename T>
class ico_triangle<T,0u> final {
private:
T val_;
public:
};
template<typename T, uint64_t SubD>
class icosahedron final {
private:
std::array<ico_triangle<T,SubD>,20u> surfaces_;
public:
};
}
|