12#define ANONYMOUS anonymous
16static const double a = (1.0 + std::sqrt(5.0)) / 2.0;
17static const double d = std::sqrt(1.0 +
a *
a);
18static const double x = 1.0 / d;
19static const double y =
a / d;
21static const std::array<gml::dvec3, 12> vertices{{{-
x,
y, 0.0},
34static const std::array<gml::ivec3, 20> triangles{{{0, 11, 5}, {0, 5, 1}, {0, 1, 7}, {0, 7, 10}, {0, 10, 11},
35 {1, 5, 9}, {5, 11, 4}, {11, 10, 2}, {10, 7, 6}, {7, 1, 8},
36 {3, 9, 4}, {3, 4, 2}, {3, 2, 6}, {3, 6, 8}, {3, 8, 9},
37 {4, 9, 5}, {2, 4, 11}, {6, 2, 10}, {8, 6, 7}, {9, 8, 1}}};
48 , triangles_{triangle_mesh_->triangles()}
54 return i_ ==
static_cast<int>(ANONYMOUS::triangles.size());
60 throw std::out_of_range(
"Done!");
64 const int base = i_ * mesh_->face_vertex_count_;
76 throw std::out_of_range(
"Done!");
86 triangle_mesh_ = std::make_shared<triangle_mesh_t>(ANONYMOUS::vertices[ANONYMOUS::triangles[i_][0]],
87 ANONYMOUS::vertices[ANONYMOUS::triangles[i_][1]],
88 ANONYMOUS::vertices[ANONYMOUS::triangles[i_][2]],
91 triangles_ = triangle_mesh_->triangles();
103 , vertices_{triangle_mesh_->
vertices()}
109 return i_ ==
static_cast<int>(ANONYMOUS::triangles.size());
115 throw std::out_of_range(
"Done!");
127 throw std::out_of_range(
"Done!");
137 triangle_mesh_ = std::make_shared<triangle_mesh_t>(ANONYMOUS::vertices[ANONYMOUS::triangles[i_][0]],
138 ANONYMOUS::vertices[ANONYMOUS::triangles[i_][1]],
139 ANONYMOUS::vertices[ANONYMOUS::triangles[i_][2]],
142 vertices_ = triangle_mesh_->vertices();
bool done() const noexcept
triangle_t generate() const
mesh_vertex_t generate() const
bool done() const noexcept
vertices_t vertices() const noexcept
icosahedron_mesh_t(double radius=1.0, int segments=1)
triangles_t triangles() const noexcept
gml::ivec3 vertices
Zero based indices of the triangle vertices in counterclockwise order.
int count(const generator_t &generator) noexcept
Counts the number of steps left in the generator.
const segment_list * segments