diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-06 13:18:40 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2025-01-06 13:18:40 +0100 |
commit | 8620f57f7101b2090add89330e74854b77161d3f (patch) | |
tree | f2e0f561dc9fa43cab2b6098f65ada3f33782dbf /src/crepe/api/Vector2.hpp | |
parent | 7126db6e1d97b7ede4cc929abfdeadd360e4cb74 (diff) |
place zapper method
Diffstat (limited to 'src/crepe/api/Vector2.hpp')
-rw-r--r-- | src/crepe/api/Vector2.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/crepe/api/Vector2.hpp b/src/crepe/api/Vector2.hpp index e195760..a4ce641 100644 --- a/src/crepe/api/Vector2.hpp +++ b/src/crepe/api/Vector2.hpp @@ -168,4 +168,14 @@ bool Vector2<T>::is_nan() const { return std::isnan(x) && std::isnan(y); } +template <class T> +Vector2<T> Vector2<T>::rotate(float deg) const { + float rad = -deg / 180 * M_PI; + return { + x * std::cos(rad) - y * std::sin(rad), + x * std::sin(rad) + y * std::cos(rad), + }; +} + + } // namespace crepe |