ソースを参照

Apply Clang format to header and source files

Patrick-Christopher Mattulat 11 ヶ月 前
コミット
714d7a4ad5

+ 3 - 3
include/ls_math/os/dynamic_goal.hpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-11-06
- * Changed:         2022-11-06
+ * Changed:         2023-06-02
  *
  * */
 
@@ -11,10 +11,10 @@
 #define LS_MATH_DYNAMIC_GOAL_HPP
 
 #if defined(_WIN32) && defined(_MSC_VER)
-#include <ls_math/os/windows/msvc_dll_definitions.hpp>
+  #include <ls_math/os/windows/msvc_dll_definitions.hpp>
 #endif
 #if defined(unix) || defined(__APPLE__) || defined(_WIN32) && defined(__GNUC__)
-#include <ls_math/os/unix/unix_so_definitions.hpp>
+  #include <ls_math/os/unix/unix_so_definitions.hpp>
 #endif
 
 #endif

+ 4 - 4
include/ls_math/os/windows/msvc_dll_definitions.hpp

@@ -3,15 +3,15 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-11-06
- * Changed:         2022-11-06
+ * Changed:         2023-06-02
  *
  * */
 
 #ifndef LS_MATH_MSVC_DLL_DEFINITIONS_HPP
 #define LS_MATH_MSVC_DLL_DEFINITIONS_HPP
 
-#define LS_MATH_DLL_EXPORT        __declspec(dllexport)
-#define LS_MATH_DLL_IMPORT        __declspec(dllimport)
-#define LS_MATH_DYNAMIC_GOAL      LS_MATH_DLL_EXPORT
+#define LS_MATH_DLL_EXPORT __declspec(dllexport)
+#define LS_MATH_DLL_IMPORT __declspec(dllimport)
+#define LS_MATH_DYNAMIC_GOAL LS_MATH_DLL_EXPORT
 
 #endif

+ 18 - 18
include/ls_math/vector/Vector2.hpp

@@ -3,16 +3,16 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-08-05
- * Changed:         2022-11-06
+ * Changed:         2023-06-02
  *
  * */
 
 #ifndef LS_MATH_VECTOR2_HPP
 #define LS_MATH_VECTOR2_HPP
 
+#include <cstdlib>
 #include <ls_math/core/types/VectorTypes.hpp>
 #include <ls_math/os/dynamic_goal.hpp>
-#include <cstdlib>
 
 namespace ls::math::vector
 {
@@ -20,44 +20,44 @@ namespace ls::math::vector
   {
     public:
 
-      Vector2(const ls::math::core::type::vector2_component& _x, const ls::math::core::type::vector2_component& _y);
+      Vector2(const ls::math::core::type::vector2_component &_x, const ls::math::core::type::vector2_component &_y);
       ~Vector2() = default;
 
       // arithmetic operations
 
-      ls::math::vector::Vector2 operator+(const ls::math::vector::Vector2& _vector) const;
-      ls::math::vector::Vector2 operator-(const ls::math::vector::Vector2& _vector) const;
-      ls::math::core::type::vector_scalar operator*(const ls::math::vector::Vector2& _vector) const;
+      ls::math::vector::Vector2 operator+(const ls::math::vector::Vector2 &_vector) const;
+      ls::math::vector::Vector2 operator-(const ls::math::vector::Vector2 &_vector) const;
+      ls::math::core::type::vector_scalar operator*(const ls::math::vector::Vector2 &_vector) const;
       ls::math::vector::Vector2 operator*(double _value);
       ls::math::vector::Vector2 operator/(double _divisor);
 
       // comparison operations
 
-      bool operator==(const Vector2& _vector);
-      bool operator!=(const Vector2& _vector);
+      bool operator==(const Vector2 &_vector);
+      bool operator!=(const Vector2 &_vector);
 
       // additional functionality
 
-      [[nodiscard]] static ls::math::vector::Vector2 add(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
-      [[nodiscard]] static ls::math::core::type::vector_scalar dot(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
+      [[nodiscard]] static ls::math::vector::Vector2 add(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend);
+      [[nodiscard]] static ls::math::core::type::vector_scalar dot(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend);
       [[nodiscard]] ls::math::core::type::vector2_components getComponents();
       [[nodiscard]] double getLength();
       [[nodiscard]] ls::math::core::type::vector2_component getX();
       [[nodiscard]] ls::math::core::type::vector2_component getY();
       [[nodiscard]] ls::math::vector::Vector2 normalize();
-      void setX(const ls::math::core::type::vector2_component& _value);
-      void setY(const ls::math::core::type::vector2_component& _value);
-      [[nodiscard]] static ls::math::vector::Vector2 subtract(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
+      void setX(const ls::math::core::type::vector2_component &_value);
+      void setY(const ls::math::core::type::vector2_component &_value);
+      [[nodiscard]] static ls::math::vector::Vector2 subtract(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend);
 
     private:
 
       ls::math::core::type::vector2_components components{};
 
-      [[nodiscard]] static ls::math::vector::Vector2 _add(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
-      [[nodiscard]] static ls::math::core::type::vector_scalar _dot(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
-      [[nodiscard]] static double _getLength(const ls::math::core::type::vector2_component& _x, const ls::math::core::type::vector2_component& _y);
-      [[nodiscard]] static ls::math::vector::Vector2 _operatorDivision(const ls::math::core::type::vector2_component& _x, const ls::math::core::type::vector2_component& _y, double _divisor);
-      [[nodiscard]] static ls::math::vector::Vector2 _subtract(const ls::math::vector::Vector2& _leftAddend, const ls::math::vector::Vector2& _rightAddend);
+      [[nodiscard]] static ls::math::vector::Vector2 _add(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend);
+      [[nodiscard]] static ls::math::core::type::vector_scalar _dot(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend);
+      [[nodiscard]] static double _getLength(const ls::math::core::type::vector2_component &_x, const ls::math::core::type::vector2_component &_y);
+      [[nodiscard]] static ls::math::vector::Vector2 _operatorDivision(const ls::math::core::type::vector2_component &_x, const ls::math::core::type::vector2_component &_y, double _divisor);
+      [[nodiscard]] static ls::math::vector::Vector2 _subtract(const ls::math::vector::Vector2 &_leftAddend, const ls::math::vector::Vector2 &_rightAddend);
   };
 }
 

+ 7 - 7
source/ls_math/vector/Vector2.cpp

@@ -3,13 +3,13 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-08-05
- * Changed:         2022-11-08
+ * Changed:         2023-06-02
  *
  * */
 
-#include <ls_math/vector/Vector2.hpp>
-#include <limits>
 #include <cmath>
+#include <limits>
+#include <ls_math/vector/Vector2.hpp>
 
 ls::math::vector::Vector2::Vector2(const ls::math::core::type::vector2_component &_x, const ls::math::core::type::vector2_component &_y)
 {
@@ -17,17 +17,17 @@ ls::math::vector::Vector2::Vector2(const ls::math::core::type::vector2_component
   this->components[1] = _y;
 }
 
-ls::math::vector::Vector2 ls::math::vector::Vector2::operator+(const ls::math::vector::Vector2& _vector) const
+ls::math::vector::Vector2 ls::math::vector::Vector2::operator+(const ls::math::vector::Vector2 &_vector) const
 {
   return ls::math::vector::Vector2::_add(*this, _vector);
 }
 
-ls::math::vector::Vector2 ls::math::vector::Vector2::operator-(const ls::math::vector::Vector2& _vector) const
+ls::math::vector::Vector2 ls::math::vector::Vector2::operator-(const ls::math::vector::Vector2 &_vector) const
 {
   return ls::math::vector::Vector2::_subtract(*this, _vector);
 }
 
-ls::math::core::type::vector_scalar ls::math::vector::Vector2::operator*(const ls::math::vector::Vector2& _vector) const
+ls::math::core::type::vector_scalar ls::math::vector::Vector2::operator*(const ls::math::vector::Vector2 &_vector) const
 {
   return ls::math::vector::Vector2::_dot(*this, _vector);
 }
@@ -118,7 +118,7 @@ ls::math::vector::Vector2 ls::math::vector::Vector2::_subtract(const ls::math::v
   return ls::math::vector::Vector2{_leftAddend.components[0] - _rightAddend.components[0], _leftAddend.components[1] - _rightAddend.components[1]};
 }
 
-double ls::math::vector::Vector2::_getLength(const ls::math::core::type::vector2_component& _x, const ls::math::core::type::vector2_component& _y)
+double ls::math::vector::Vector2::_getLength(const ls::math::core::type::vector2_component &_x, const ls::math::core::type::vector2_component &_y)
 {
   return sqrt(_x * _x + _y * _y);
 }

+ 3 - 3
test/cases/vector/Vector2Test.cpp

@@ -3,13 +3,13 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2022-08-05
- * Changed:         2022-08-07
+ * Changed:         2023-06-02
  *
  * */
 
+#include <cmath>
 #include <gtest/gtest.h>
 #include <ls_math/ls_math_vector.hpp>
-#include <cmath>
 
 using namespace ls::math::vector;
 using namespace ls::math::core::type;
@@ -67,7 +67,7 @@ namespace
 
     // round by two decimals
 
-    double powValue = pow(10.0f, (double)2);
+    double powValue = pow(10.0f, (double) 2);
     double roundedX = round(n.getX() * powValue) / powValue;
     double roundedY = round(n.getY() * powValue) / powValue;