sandbox
Loading...
Searching...
No Matches
sbx::math::basic_angle< Type > Class Template Reference

Unified angle type stored internally in radians. More...

#include <angle.hpp>

Public Types

using value_type = Type
 Underlying scalar value type.
 

Public Member Functions

constexpr basic_angle (const basic_degree< value_type > &degree) noexcept
 Constructs an angle from a degree value. More...
 
constexpr basic_angle (const basic_radian< value_type > &radian) noexcept
 Constructs an angle from a radian value. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr basic_angle (const basic_angle< Other > &other) noexcept
 Constructs an angle from another angle type. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator+= (const basic_angle< Other > &other) noexcept -> basic_angle< Type > &
 Adds another angle to this angle. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator+= (const basic_degree< Other > &other) noexcept -> basic_angle< Type > &
 Adds a degree value to this angle. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator+= (const basic_radian< Other > &other) noexcept -> basic_angle< Type > &
 Adds a radian value to this angle. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator-= (const basic_angle< Other > &other) noexcept -> basic_angle< Type > &
 Subtracts another angle from this angle. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator-= (const basic_degree< Other > &other) noexcept -> basic_angle< Type > &
 Subtracts a degree value from this angle. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator-= (const basic_radian< Other > &other) noexcept -> basic_angle< Type > &
 Subtracts a radian value from this angle. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator*= (const Other other) noexcept -> basic_angle< Type > &
 Scales this angle by a floating point factor. More...
 
constexpr auto to_degrees () const noexcept -> basic_degree< value_type >
 Converts this angle to degrees. More...
 
constexpr auto to_radians () const noexcept -> basic_radian< value_type >
 Converts this angle to radians. More...
 

Detailed Description

template<floating_point Type>
class sbx::math::basic_angle< Type >

Unified angle type stored internally in radians.

This type provides explicit construction from degrees or radians, supports arithmetic, and provides unit conversion helpers.

Template Parameters
TypeFloating-point storage type.

Constructor & Destructor Documentation

◆ basic_angle() [1/3]

template<floating_point Type>
constexpr sbx::math::basic_angle< Type >::basic_angle ( const basic_degree< value_type > &  degree)
constexprnoexcept

Constructs an angle from a degree value.

Parameters
degreeAngle expressed in degrees.

◆ basic_angle() [2/3]

template<floating_point Type>
constexpr sbx::math::basic_angle< Type >::basic_angle ( const basic_radian< value_type > &  radian)
constexprnoexcept

Constructs an angle from a radian value.

Parameters
radianAngle expressed in radians.

◆ basic_angle() [3/3]

template<floating_point Type>
requires (std::is_convertible_v<Other, Type>)
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr sbx::math::basic_angle< Type >::basic_angle ( const basic_angle< Other > &  other)
constexprnoexcept

Constructs an angle from another angle type.

Template Parameters
OtherFloating-point storage type of the source.
Parameters
otherSource angle.

Member Function Documentation

◆ operator*=()

template<floating_point Type>
requires (std::is_convertible_v<Other, Type>)
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto sbx::math::basic_angle< Type >::operator*= ( const Other  other) -> basic_angle<Type>&
constexprnoexcept

Scales this angle by a floating point factor.

Template Parameters
OtherFloating-point type convertible to value_type.
Parameters
otherScale factor.
Returns
Reference to this instance.

◆ operator+=() [1/3]

template<floating_point Type>
requires (std::is_convertible_v<Other, Type>)
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto sbx::math::basic_angle< Type >::operator+= ( const basic_angle< Other > &  other) -> basic_angle<Type>&
constexprnoexcept

Adds another angle to this angle.

Template Parameters
OtherFloating-point storage type of the operand.
Parameters
otherAngle to add.
Returns
Reference to this instance.

◆ operator+=() [2/3]

template<floating_point Type>
requires (std::is_convertible_v<Other, Type>)
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto sbx::math::basic_angle< Type >::operator+= ( const basic_degree< Other > &  other) -> basic_angle<Type>&
constexprnoexcept

Adds a degree value to this angle.

Template Parameters
OtherFloating-point storage type of the operand.
Parameters
otherDegree value to add.
Returns
Reference to this instance.

◆ operator+=() [3/3]

template<floating_point Type>
requires (std::is_convertible_v<Other, Type>)
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto sbx::math::basic_angle< Type >::operator+= ( const basic_radian< Other > &  other) -> basic_angle<Type>&
constexprnoexcept

Adds a radian value to this angle.

Template Parameters
OtherFloating-point storage type of the operand.
Parameters
otherRadian value to add.
Returns
Reference to this instance.

◆ operator-=() [1/3]

template<floating_point Type>
requires (std::is_convertible_v<Other, Type>)
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto sbx::math::basic_angle< Type >::operator-= ( const basic_angle< Other > &  other) -> basic_angle<Type>&
constexprnoexcept

Subtracts another angle from this angle.

Template Parameters
OtherFloating-point storage type of the operand.
Parameters
otherAngle to subtract.
Returns
Reference to this instance.

◆ operator-=() [2/3]

template<floating_point Type>
requires (std::is_convertible_v<Other, Type>)
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto sbx::math::basic_angle< Type >::operator-= ( const basic_degree< Other > &  other) -> basic_angle<Type>&
constexprnoexcept

Subtracts a degree value from this angle.

Template Parameters
OtherFloating-point storage type of the operand.
Parameters
otherDegree value to subtract.
Returns
Reference to this instance.

◆ operator-=() [3/3]

template<floating_point Type>
requires (std::is_convertible_v<Other, Type>)
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto sbx::math::basic_angle< Type >::operator-= ( const basic_radian< Other > &  other) -> basic_angle<Type>&
constexprnoexcept

Subtracts a radian value from this angle.

Template Parameters
OtherFloating-point storage type of the operand.
Parameters
otherRadian value to subtract.
Returns
Reference to this instance.

◆ to_degrees()

template<floating_point Type>
constexpr auto sbx::math::basic_angle< Type >::to_degrees
constexprnoexcept

Converts this angle to degrees.

Returns
Angle expressed in degrees.

◆ to_radians()

template<floating_point Type>
constexpr auto sbx::math::basic_angle< Type >::to_radians
constexprnoexcept

Converts this angle to radians.

Returns
Angle expressed in radians.

The documentation for this class was generated from the following files: