Unravel Engine C++ Reference
Loading...
Searching...
No Matches
flip_path.hpp
Go to the documentation of this file.
1#ifndef GENERATOR_FLIPPATH_HPP
2#define GENERATOR_FLIPPATH_HPP
3
4#include "edge.hpp"
5#include "transform_path.hpp"
6
7namespace generator
8{
9
11template<typename path_t>
13{
14private:
16 impl_t transform_path_;
17
18public:
19 class edges_t
20 {
21 public:
23 {
24 edge_t edge = edges_.generate();
25 std::swap(edge.vertices[0], edge.vertices[1]);
26 return edge;
27 }
28
29 bool done() const noexcept
30 {
31 return edges_.done();
32 }
33
34 void next()
35 {
36 edges_.next();
37 }
38
39 private:
41
42 explicit edges_t(const transform_path_t<path_t>& path) : edges_{path.edges()}
43 {
44 }
45
46 friend class flip_path_t;
47 };
48
50 flip_path_t(path_t path)
51 : transform_path_{std::move(path),
52 [](path_vertex_t& vertex)
53 {
54 vertex.tangent *= -1.0;
55 vertex.normal *= -1.0;
56 }}
57 {
58 }
59
60 edges_t edges() const noexcept
61 {
62 return edges_t{*this};
63 }
64
66
67 vertices_t vertices() const noexcept
68 {
69 return transform_path_.vertices();
70 }
71};
72
73template<typename path_t>
75{
76 return flip_path_t<path_t>{std::move(path)};
77}
78} // namespace generator
79
80#endif
manifold_type type
gml::ivec2 vertices
Definition edge.hpp:12
bool done() const noexcept
Definition flip_path.hpp:29
Flips mesh inside out. Reverses triangles and normals.
Definition flip_path.hpp:13
vertices_t vertices() const noexcept
Definition flip_path.hpp:67
edges_t edges() const noexcept
Definition flip_path.hpp:60
typename impl_t::vertices_t vertices_t
Definition flip_path.hpp:65
flip_path_t(path_t path)
Definition flip_path.hpp:50
Apply a mutator function to each vertex.
flip_path_t< path_t > flip_path(path_t path)
Definition flip_path.hpp:74