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