From 72ce2044f4be80d2fd6e9fcb80e98428537cb919 Mon Sep 17 00:00:00 2001 From: Sara Date: Thu, 21 Nov 2024 08:32:57 +0100 Subject: [PATCH] chore: moved vector class to core/math --- src/{ => core}/math/vector.cpp | 2 ++ src/{ => core}/math/vector.hpp | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) rename src/{ => core}/math/vector.cpp (99%) rename src/{ => core}/math/vector.hpp (99%) diff --git a/src/math/vector.cpp b/src/core/math/vector.cpp similarity index 99% rename from src/math/vector.cpp rename to src/core/math/vector.cpp index 6566de2..b8b44e9 100644 --- a/src/math/vector.cpp +++ b/src/core/math/vector.cpp @@ -4,6 +4,7 @@ #define VECTOR_EPSILON 0.00001f +namespace ce { Vecf::Vecf(float x, float y) : x{x}, y{y} {} @@ -99,3 +100,4 @@ void Vecf::scale(float x, float y) { void Vecf::scale(Vecf const &factors) { this->scale(factors.x, factors.y); } +} diff --git a/src/math/vector.hpp b/src/core/math/vector.hpp similarity index 99% rename from src/math/vector.hpp rename to src/core/math/vector.hpp index a7daefe..e8ea656 100644 --- a/src/math/vector.hpp +++ b/src/core/math/vector.hpp @@ -4,7 +4,10 @@ #include #include +namespace ce { struct Vecf { + float x{0.f}, y{0.f}; + Vecf() = default; Vecf(float x, float y); Vecf(std::initializer_list members); @@ -49,8 +52,6 @@ struct Vecf { void scale(float x, float y); //! scale vector member-wise void scale(Vecf const &factors); - - float x{0.f}, y{0.f}; }; static inline @@ -97,5 +98,6 @@ static inline Vecf &operator/=(Vecf &lhs, float rhs) { return lhs = lhs * rhs; } +} #endif // !VECTOR_MATH_HPP