Unravel Engine C++ Reference
Loading...
Searching...
No Matches
scale_path.hpp
Go to the documentation of this file.
1#ifndef GENERATOR_SCALEPATH_HPP
2#define GENERATOR_SCALEPATH_HPP
3
4#include "transform_path.hpp"
5
6namespace generator
7{
8
10template<typename path_t>
12{
13private:
15 impl_t transform_path_;
16
17public:
20 scale_path_t(path_t path, const gml::dvec3& scale)
21 : transform_path_{std::move(path),
22 [scale](path_vertex_t& value)
23 {
24 value.position *= scale;
25 value.tangent = gml::normalize(scale * value.tangent);
26 value.normal = gml::normalize(scale * value.normal);
27 }}
28 {
29 }
30
31 using edges_t = typename impl_t::edges_t;
32
33 edges_t edges() const noexcept
34 {
35 return transform_path_.edges();
36 }
37
39
40 vertices_t vertices() const noexcept
41 {
42 return transform_path_.vertices();
43 }
44};
45
46template<typename path_t>
47scale_path_t<path_t> scale_path(path_t path, const gml::dvec3& scale)
48{
49 return scale_path_t<path_t>{std::move(path), scale};
50}
51} // namespace generator
52
53#endif
Scales a path. Keeps tangents and normals unit length.
typename impl_t::edges_t edges_t
vertices_t vertices() const noexcept
typename impl_t::vertices_t vertices_t
scale_path_t(path_t path, const gml::dvec3 &scale)
edges_t edges() const noexcept
Apply a mutator function to each vertex.
typename impl_t::edges_t edges_t
float scale
Definition hub.cpp:25
scale_path_t< path_t > scale_path(path_t path, const gml::dvec3 &scale)