24#ifndef LIBSBX_MATH_ANGLE_HPP_
25#define LIBSBX_MATH_ANGLE_HPP_
32#include <libsbx/math/smooth_value.hpp>
44template<
floating_po
int Type>
80 template<scalar Other>
81 requires (std::is_convertible_v<Other, Type>)
91 template<
floating_po
int Other>
92 requires (std::is_convertible_v<Other, Type>)
110 requires (std::is_convertible_v<Other, Type>)
123 requires (std::is_convertible_v<Other, Type>)
136 requires (std::is_convertible_v<Other, Type>)
149 requires (std::is_convertible_v<Other, Type>)
150 constexpr auto operator*=(const Other rhs) noexcept ->
basic_degree<Type>&;
162 requires (std::is_convertible_v<Other, Type>)
163 constexpr auto operator/=(const Other rhs) noexcept ->
basic_degree<Type>&;
177 constexpr operator
value_type() const noexcept;
205template<
floating_po
int Type>
206constexpr auto operator==(
const basic_degree<Type>& lhs,
const basic_degree<Type>& rhs)
noexcept -> bool;
219template<
floating_po
int Type,
floating_po
int Other>
220constexpr auto operator<=>(
const basic_degree<Type>& lhs,
const basic_degree<Other>& rhs)
noexcept -> std::partial_ordering;
233template<
floating_po
int Type,
floating_po
int Other>
234requires (std::is_convertible_v<Other, Type>)
235constexpr auto operator+(basic_degree<Type> lhs,
const basic_degree<Other>& rhs)
noexcept -> basic_degree<Type>;
248template<
floating_po
int Type,
floating_po
int Other>
249requires (std::is_convertible_v<Other, Type>)
250constexpr auto operator-(basic_degree<Type> lhs,
const basic_degree<Other>& rhs)
noexcept -> basic_degree<Type>;
263template<
floating_po
int Type, std::convertible_to<Type> Other>
264constexpr auto operator*(basic_degree<Type> lhs,
const Other rhs)
noexcept -> basic_degree<Type>;
277template<
floating_po
int Type, std::convertible_to<Type> Other>
278constexpr auto operator/(basic_degree<Type> lhs,
const Other rhs)
noexcept -> basic_degree<Type>;
291template<
floating_po
int Type>
292constexpr auto clamp(
const basic_degree<Type>& value,
const basic_degree<Type>& min,
const basic_degree<Type>& max) ->
const basic_degree<Type>&;
304template<
floating_po
int Type>
314template<
floating_po
int Type>
342template<
floating_po
int Type>
353template<
floating_po
int Type>
389 template<scalar Other>
390 requires (std::is_convertible_v<Other, Type>)
400 template<
floating_po
int Other>
401 requires (std::is_convertible_v<Other, Type>)
419 requires (std::is_convertible_v<Other, Type>)
432 requires (std::is_convertible_v<Other, Type>)
445 requires (std::is_convertible_v<Other, Type>)
458 requires (std::is_convertible_v<Other, Type>)
459 constexpr auto operator*=(const Other rhs) noexcept ->
basic_radian<Type>&;
473 constexpr operator
value_type() const noexcept;
501template<
floating_po
int Type>
502constexpr auto operator==(
const basic_radian<Type>& lhs,
const basic_radian<Type>& rhs)
noexcept -> bool;
515template<
floating_po
int Type,
floating_po
int Other>
516constexpr auto operator<=>(
const basic_radian<Type>& lhs,
const basic_radian<Other>& rhs)
noexcept -> std::partial_ordering;
529template<
floating_po
int Type,
floating_po
int Other>
530requires (std::is_convertible_v<Other, Type>)
531constexpr auto operator+(basic_radian<Type> lhs,
const basic_radian<Other>& rhs)
noexcept -> basic_radian<Type>;
544template<
floating_po
int Type,
floating_po
int Other>
545requires (std::is_convertible_v<Other, Type>)
546constexpr auto operator-(basic_radian<Type> lhs,
const basic_radian<Other>& rhs)
noexcept -> basic_radian<Type>;
559template<
floating_po
int Type, std::convertible_to<Type> Other>
560requires (std::is_convertible_v<Other, Type>)
561constexpr auto operator*(basic_radian<Type> lhs,
const Other rhs)
noexcept -> basic_radian<Type>;
574template<
floating_po
int Type>
575constexpr auto clamp(
const basic_radian<Type>& value,
const basic_radian<Type>& min,
const basic_radian<Type>& max) ->
const basic_radian<Type>&;
590template<
floating_po
int Type>
621 template<
floating_po
int Other>
622 requires (std::is_convertible_v<Other, Type>)
634 template<
floating_po
int Other>
635 requires (std::is_convertible_v<Other, Type>)
647 template<
floating_po
int Other>
648 requires (std::is_convertible_v<Other, Type>)
660 template<
floating_po
int Other>
661 requires (std::is_convertible_v<Other, Type>)
673 template<
floating_po
int Other>
674 requires (std::is_convertible_v<Other, Type>)
686 template<
floating_po
int Other>
687 requires (std::is_convertible_v<Other, Type>)
699 template<
floating_po
int Other>
700 requires (std::is_convertible_v<Other, Type>)
712 template<
floating_po
int Other>
713 requires (std::is_convertible_v<Other, Type>)
749template<
floating_po
int Type>
750constexpr auto operator==(
const basic_angle<Type>& lhs,
const basic_angle<Type>& rhs)
noexcept -> bool;
763template<
floating_po
int Type,
floating_po
int Other>
764constexpr auto operator<=>(
const basic_angle<Type>& lhs,
const basic_angle<Other>& rhs)
noexcept -> std::partial_ordering;
777template<
floating_po
int LhsType,
floating_po
int RhsType>
778requires (std::is_convertible_v<RhsType, LhsType>)
779constexpr auto operator+(basic_angle<LhsType> lhs,
const basic_angle<RhsType>& rhs)
noexcept -> basic_angle<LhsType>;
792template<
floating_po
int LhsType,
floating_po
int RhsType>
793requires (std::is_convertible_v<RhsType, LhsType>)
794constexpr auto operator+(basic_angle<LhsType> lhs,
const basic_degree<RhsType>& rhs)
noexcept -> basic_angle<LhsType>;
807template<
floating_po
int LhsType,
floating_po
int RhsType>
808requires (std::is_convertible_v<RhsType, LhsType>)
809constexpr auto operator+(basic_angle<LhsType> lhs,
const basic_radian<RhsType>& rhs)
noexcept -> basic_angle<LhsType>;
822template<
floating_po
int LhsType,
floating_po
int RhsType>
823requires (std::is_convertible_v<RhsType, LhsType>)
824constexpr auto operator-(basic_angle<LhsType> lhs,
const basic_angle<RhsType>& rhs)
noexcept -> basic_angle<LhsType>;
837template<
floating_po
int LhsType,
floating_po
int RhsType>
838requires (std::is_convertible_v<RhsType, LhsType>)
839constexpr auto operator-(basic_angle<LhsType> lhs,
const basic_degree<RhsType>& rhs)
noexcept -> basic_angle<LhsType>;
852template<
floating_po
int LhsType,
floating_po
int RhsType>
853requires (std::is_convertible_v<RhsType, LhsType>)
854constexpr auto operator-(basic_angle<LhsType> lhs,
const basic_radian<RhsType>& rhs)
noexcept -> basic_angle<LhsType>;
867template<
floating_po
int LhsType,
floating_po
int RhsType>
868requires (std::is_convertible_v<RhsType, LhsType>)
869constexpr auto operator*(basic_angle<LhsType> lhs,
const RhsType rhs)
noexcept -> basic_angle<LhsType>;
882template<
floating_po
int Type>
883constexpr auto clamp(
const basic_angle<Type>& value,
const basic_angle<Type>& min,
const basic_angle<Type>& max) ->
const basic_angle<Type>&;
899template<
floating_po
int Type>
911template<
floating_po
int Type>
923template<
floating_po
int Type>
935template<
floating_po
int Type>
947template<
floating_po
int Type>
959template<
floating_po
int Type>
971template<
floating_po
int Type>
983template<
floating_po
int Type>
995template<
floating_po
int Type>
1012constexpr auto operator""_deg(
long double value)
noexcept ->
degree;
1021constexpr auto operator""_deg(
unsigned long long value)
noexcept ->
degree;
1030constexpr auto operator""_rad(
long double value)
noexcept ->
radian;
1039constexpr auto operator""_rad(
unsigned long long value)
noexcept ->
radian;
1045#include <libsbx/math/angle.ipp>
constexpr auto sin(const basic_angle< Type > &angle) noexcept -> Type
Computes the sine of an angle.
Definition: angle.ipp:422
constexpr auto to_degrees(const basic_radian< Type > &radian) noexcept -> basic_degree< Type >
Converts radians to degrees.
Definition: angle.ipp:412
constexpr auto cos(const basic_angle< Type > &angle) noexcept -> Type
Computes the cosine of an angle.
Definition: angle.ipp:437
constexpr auto tan(const basic_angle< Type > &angle) noexcept -> Type
Computes the tangent of an angle.
Definition: angle.ipp:452
constexpr auto to_radians(const basic_degree< Type > °ree) noexcept -> basic_radian< Type >
Converts degrees to radians.
Definition: angle.ipp:417
Unified angle type stored internally in radians.
Definition: angle.hpp:591
Type value_type
Underlying scalar value type.
Definition: angle.hpp:598
constexpr auto to_radians() const noexcept -> basic_radian< value_type >
Converts this angle to radians.
Definition: angle.ipp:328
constexpr auto to_degrees() const noexcept -> basic_degree< value_type >
Converts this angle to degrees.
Definition: angle.ipp:323
Strongly-typed degree value wrapper.
Definition: angle.hpp:45
constexpr ~basic_degree() noexcept=default
Destructor.
static constexpr basic_degree max
Maximum representable canonical degree value used by this library.
Definition: angle.hpp:66
static constexpr basic_degree min
Minimum representable canonical degree value used by this library.
Definition: angle.hpp:59
constexpr basic_degree()=default
Constructs a degree value initialized to zero.
constexpr auto value() const noexcept -> value_type
Returns the stored degree value.
Definition: angle.ipp:64
Type value_type
Underlying scalar value type.
Definition: angle.hpp:52
constexpr auto data() noexcept -> value_type *
Returns a pointer to the underlying stored value.
Definition: angle.ipp:74
Strongly-typed radian value wrapper.
Definition: angle.hpp:354
constexpr auto value() const noexcept -> value_type
Returns the stored radian value.
Definition: angle.ipp:190
static constexpr basic_radian min
Minimum representable canonical radian value used by this library.
Definition: angle.hpp:368
Type value_type
Underlying scalar value type.
Definition: angle.hpp:361
static constexpr basic_radian max
Maximum representable canonical radian value used by this library.
Definition: angle.hpp:375
constexpr auto data() noexcept -> value_type *
Returns a pointer to the underlying stored value.
Definition: angle.ipp:200
constexpr ~basic_radian() noexcept=default
Destructor.
constexpr basic_radian()=default
Constructs a radian value initialized to zero.
Concept for floating-point types.
Definition: concepts.hpp:72
constexpr auto mix(const Type x, const Type y, const Type a) -> Type
Linearly interpolates between two values.
Definition: algorithm.ipp:7
Core numeric concepts and type traits.
Definition: traits.hpp:14
Definition: traits.hpp:11
Definition: smooth_value.hpp:26