Unravel Engine C++ Reference
Loading...
Searching...
No Matches
rotate_shape.hpp
Go to the documentation of this file.
1#ifndef GENERATOR_ROTATESHAPE_HPP
2#define GENERATOR_ROTATESHAPE_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 rotate_shape_t(shape_t shape, double angle)
21 : transform_shape_{std::move(shape),
22 [angle](shape_vertex_t& value)
23 {
24 auto rotation = gml::rotate(angle);
25 value.position = gml::transform(rotation, value.position);
26 value.tangent = gml::transform(rotation, value.tangent);
27 }}
28 {
29 }
30
31 using edges_t = typename impl_t::edges_t;
32
33 edges_t edges() const noexcept
34 {
35 return transform_shape_.edges();
36 }
37
39
40 vertices_t vertices() const noexcept
41 {
42 return transform_shape_.vertices();
43 }
44};
45
46template<typename shape_t>
47rotate_shape_t<shape_t> rotate_shape(shape_t shape, double angle)
48{
49 return rotate_shape_t<shape_t>{std::move(shape), angle};
50}
51} // namespace generator
52
53#endif
Rotates a shape around the origin on the xy-plane.
vertices_t vertices() const noexcept
typename impl_t::edges_t edges_t
edges_t edges() const noexcept
typename impl_t::vertices_t vertices_t
rotate_shape_t(shape_t shape, double angle)
Apply a mutator function to each vertex.
typename impl_t::edges_t edges_t
rotate_shape_t< shape_t > rotate_shape(shape_t shape, double angle)
glm::tvec3< T > transform(const glm::tquat< T > &q, const glm::tvec3< T > &v)
Definition math.hpp:114
glm::tmat4x4< T > rotate(const glm::tvec3< T > &angle)
Definition math.hpp:176