Unravel Engine C++ Reference
Loading...
Searching...
No Matches
icosahedron_mesh.hpp
Go to the documentation of this file.
1#ifndef GENERATOR_ICOSAHEDRONMESH_HPP
2#define GENERATOR_ICOSAHEDRONMESH_HPP
3
4#include <array>
5#include <memory>
6
7#include "mesh_vertex.hpp"
8#include "triangle.hpp"
9#include "triangle_mesh.hpp"
10#include "utils.hpp"
11
12namespace generator
13{
14
18{
19public:
21 {
22 public:
23 bool done() const noexcept;
24 triangle_t generate() const;
25 void next();
26
27 private:
28 const icosahedron_mesh_t* mesh_;
29
30 int i_;
31
32 // Needs be a shared_ptr in order to make copy/move not to mess up the
33 // internal pointer in triangles_.
34 std::shared_ptr<const triangle_mesh_t> triangle_mesh_;
35
37
38 explicit triangles_t(const icosahedron_mesh_t& mesh);
39
40 friend class icosahedron_mesh_t;
41 };
42
44 {
45 public:
46 bool done() const noexcept;
47 mesh_vertex_t generate() const;
48 void next();
49
50 private:
51 const icosahedron_mesh_t* mesh_;
52
53 int i_;
54
55 // Needs be a shared_ptr in order to make copy/move not to mess up the
56 // internal pointer in triangles_.
57 std::shared_ptr<const triangle_mesh_t> triangle_mesh_;
58
60
61 explicit vertices_t(const icosahedron_mesh_t& mesh);
62
63 friend class icosahedron_mesh_t;
64 };
65
66private:
67 double radius_;
68
69 int segments_;
70
71 int face_vertex_count_;
72
73public:
76 icosahedron_mesh_t(double radius = 1.0, int segments = 1);
77
78 triangles_t triangles() const noexcept;
79
80 vertices_t vertices() const noexcept;
81};
82} // namespace generator
83
84#endif
vertices_t vertices() const noexcept
icosahedron_mesh_t(double radius=1.0, int segments=1)
triangles_t triangles() const noexcept
const segment_list * segments