From 934ca0da0a2e8a8062fbfb2ad44f3c08eaee25f7 Mon Sep 17 00:00:00 2001 From: Orange Date: Sat, 15 Mar 2025 18:57:41 +0300 Subject: [PATCH] added explicit constructor for angle and comment for angle --- include/omath/Angle.hpp | 8 ++++---- include/omath/Triangle.hpp | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/omath/Angle.hpp b/include/omath/Angle.hpp index 4ae0dee..45e8e06 100644 --- a/include/omath/Angle.hpp +++ b/include/omath/Angle.hpp @@ -19,7 +19,7 @@ namespace omath class Angle { Type m_angle; - constexpr Angle(const Type& degrees) + constexpr explicit Angle(const Type& degrees) { if constexpr (flags == AngleFlags::Normalized) m_angle = angles::WrapAngle(degrees, min, max); @@ -36,7 +36,7 @@ namespace omath [[nodiscard]] constexpr static Angle FromDegrees(const Type& degrees) { - return {degrees}; + return Angle{degrees}; } constexpr Angle() : m_angle(0) { @@ -45,7 +45,7 @@ namespace omath [[nodiscard]] constexpr static Angle FromRadians(const Type& degrees) { - return {angles::RadiansToDegrees(degrees)}; + return Angle{angles::RadiansToDegrees(degrees)}; } [[nodiscard]] @@ -146,7 +146,7 @@ namespace omath [[nodiscard]] constexpr Angle operator-() const { - return {-m_angle}; + return Angle{-m_angle}; } }; } diff --git a/include/omath/Triangle.hpp b/include/omath/Triangle.hpp index 9779982..a2fc92e 100644 --- a/include/omath/Triangle.hpp +++ b/include/omath/Triangle.hpp @@ -6,6 +6,16 @@ namespace omath { + /* + |\ + | \ + a | \ hypot + | \ + ----- + b + */ + + template class Triangle final {