CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
RotateShape.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "TransformShape.hpp"
11
13
15 template<typename Shape> class RotateShape {
16 private:
19
20 public:
23 RotateShape(Shape shape, double angle)
24 : mTransformShape{std::move(shape), [angle](ShapeVertex& value) {
25 const auto rotation = rotate(angle);
26 value.position = Math::transform(rotation, value.position);
27 value.tangent = Math::transform(rotation, value.tangent);
28 }} {}
29
30 using Edges = typename Impl::Edges;
31
32 [[nodiscard]] Edges edges() const noexcept { return mTransformShape.edges(); }
33
34 using Vertices = typename Impl::Vertices;
35
36 [[nodiscard]] Vertices vertices() const noexcept { return mTransformShape.vertices(); }
37 };
38
39 template<typename Shape> RotateShape<Shape> rotateShape(Shape shape, double angle) { return RotateShape<Shape>{std::move(shape), angle}; }
40
41} // namespace CeresEngine::MeshGenerator
Rotates a shape around the origin on the xy-plane.
Definition RotateShape.hpp:15
Edges edges() const noexcept
Definition RotateShape.hpp:32
typename Impl::Vertices Vertices
Definition RotateShape.hpp:34
Impl mTransformShape
Definition RotateShape.hpp:18
RotateShape(Shape shape, double angle)
Definition RotateShape.hpp:23
Vertices vertices() const noexcept
Definition RotateShape.hpp:36
typename Impl::Edges Edges
Definition RotateShape.hpp:30
A point on a path.
Definition ShapeVertex.hpp:16
Apply a mutator function to each vertex.
Definition TransformShape.hpp:18
typename Impl::Edges Edges
Definition TransformShape.hpp:50
A type that describes a conjunction of shapes that can be filled and stroked.
Definition Shape.hpp:198
Definition AnyGenerator.hpp:12
RotateShape< Shape > rotateShape(Shape shape, double angle)
Definition RotateShape.hpp:39
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
TVector3< T > transform(const TQuaternion< T > &q, const TVector3< T > &v)
Definition Math.hpp:694
Definition Span.hpp:668