mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-30 09:03:27 +00:00
added more constexpr
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user