added explicit constructor for angle and comment for angle

This commit is contained in:
2025-03-15 18:57:41 +03:00
parent 4200ef63a6
commit 934ca0da0a
2 changed files with 14 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ namespace omath
class Angle class Angle
{ {
Type m_angle; Type m_angle;
constexpr Angle(const Type& degrees) constexpr explicit Angle(const Type& degrees)
{ {
if constexpr (flags == AngleFlags::Normalized) if constexpr (flags == AngleFlags::Normalized)
m_angle = angles::WrapAngle(degrees, min, max); m_angle = angles::WrapAngle(degrees, min, max);
@@ -36,7 +36,7 @@ namespace omath
[[nodiscard]] [[nodiscard]]
constexpr static Angle FromDegrees(const Type& degrees) constexpr static Angle FromDegrees(const Type& degrees)
{ {
return {degrees}; return Angle{degrees};
} }
constexpr Angle() : m_angle(0) constexpr Angle() : m_angle(0)
{ {
@@ -45,7 +45,7 @@ namespace omath
[[nodiscard]] [[nodiscard]]
constexpr static Angle FromRadians(const Type& degrees) constexpr static Angle FromRadians(const Type& degrees)
{ {
return {angles::RadiansToDegrees<Type>(degrees)}; return Angle{angles::RadiansToDegrees<Type>(degrees)};
} }
[[nodiscard]] [[nodiscard]]
@@ -146,7 +146,7 @@ namespace omath
[[nodiscard]] [[nodiscard]]
constexpr Angle operator-() const constexpr Angle operator-() const
{ {
return {-m_angle}; return Angle{-m_angle};
} }
}; };
} }

View File

@@ -6,6 +6,16 @@
namespace omath namespace omath
{ {
/*
|\
| \
a | \ hypot
| \
-----
b
*/
template<class Vector> template<class Vector>
class Triangle final class Triangle final
{ {