mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
Implements angle class with normalization
Adds an angle class with support for different normalization and clamping strategies. Includes trigonometric functions and arithmetic operators. Introduces unit tests to verify correct functionality. Disables unity builds to address a compilation issue.
This commit is contained in:
@@ -123,13 +123,13 @@ namespace omath
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr Angle& operator+(const Angle& other) noexcept
|
||||
constexpr Angle operator+(const Angle& other) noexcept
|
||||
{
|
||||
if constexpr (flags == AngleFlags::Normalized)
|
||||
return {angles::wrap_angle(m_angle + other.m_angle, min, max)};
|
||||
return Angle{angles::wrap_angle(m_angle + other.m_angle, min, max)};
|
||||
|
||||
else if constexpr (flags == AngleFlags::Clamped)
|
||||
return {std::clamp(m_angle + other.m_angle, min, max)};
|
||||
return Angle{std::clamp(m_angle + other.m_angle, min, max)};
|
||||
|
||||
else
|
||||
static_assert(false);
|
||||
@@ -138,7 +138,7 @@ namespace omath
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr Angle& operator-(const Angle& other) noexcept
|
||||
constexpr Angle operator-(const Angle& other) noexcept
|
||||
{
|
||||
return operator+(-other);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user