added more constexpr

This commit is contained in:
2026-04-30 05:38:20 +03:00
parent fa4e2b1d94
commit aae22f5af9
2 changed files with 8 additions and 8 deletions

View File

@@ -70,31 +70,31 @@ namespace omath
}
[[nodiscard]]
Type sin() const noexcept
constexpr Type sin() const noexcept
{
return std::sin(as_radians());
}
[[nodiscard]]
Type cos() const noexcept
constexpr Type cos() const noexcept
{
return std::cos(as_radians());
}
[[nodiscard]]
Type tan() const noexcept
constexpr Type tan() const noexcept
{
return std::tan(as_radians());
}
[[nodiscard]]
Type atan() const noexcept
constexpr Type atan() const noexcept
{
return std::atan(as_radians());
}
[[nodiscard]]
Type cot() const noexcept
constexpr Type cot() const noexcept
{
return cos() / sin();
}

View File

@@ -24,7 +24,7 @@ namespace omath::angles
template<class Type>
requires std::is_floating_point_v<Type>
[[nodiscard]] Type horizontal_fov_to_vertical(const Type& horizontal_fov, const Type& aspect) noexcept
[[nodiscard]] constexpr Type horizontal_fov_to_vertical(const Type& horizontal_fov, const Type& aspect) noexcept
{
const auto fov_rad = degrees_to_radians(horizontal_fov);
@@ -35,7 +35,7 @@ namespace omath::angles
template<class Type>
requires std::is_floating_point_v<Type>
[[nodiscard]] Type vertical_fov_to_horizontal(const Type& vertical_fov, const Type& aspect) noexcept
[[nodiscard]] constexpr Type vertical_fov_to_horizontal(const Type& vertical_fov, const Type& aspect) noexcept
{
const auto fov_as_radians = degrees_to_radians(vertical_fov);
@@ -47,7 +47,7 @@ namespace omath::angles
template<class Type>
requires std::is_arithmetic_v<Type>
[[nodiscard]] Type wrap_angle(const Type& angle, const Type& min, const Type& max) noexcept
[[nodiscard]] constexpr Type wrap_angle(const Type& angle, const Type& min, const Type& max) noexcept
{
if (angle <= max && angle >= min)
return angle;