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

Strongly-typed radian value wrapper. More...

#include <angle.hpp>

Public Types

using value_type = Type
 Underlying scalar value type.
 

Public Member Functions

constexpr basic_radian ()=default
 Constructs a radian value initialized to zero.
 
template<scalar Other>
requires (std::is_convertible_v<Other, Type>)
constexpr basic_radian (const Other value) noexcept
 Constructs a radian value from a scalar. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr basic_radian (const basic_radian< Other > &other) noexcept
 Constructs a radian value from another radian type. More...
 
constexpr ~basic_radian () noexcept=default
 Destructor.
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator= (const basic_radian< Other > &other) noexcept -> basic_radian< Type > &
 Assigns from another radian type. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator+= (const basic_radian< Other > &rhs) noexcept -> basic_radian< Type > &
 Adds another radian value to this value. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator-= (const basic_radian< Other > &rhs) noexcept -> basic_radian< Type > &
 Subtracts another radian value from this value. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator*= (const Other rhs) noexcept -> basic_radian< Type > &
 Scales this radian value by a floating point factor. More...
 
constexpr auto value () const noexcept -> value_type
 Returns the stored radian value. More...
 
constexpr operator value_type () const noexcept
 Implicit conversion to the underlying scalar value. More...
 
constexpr auto data () noexcept -> value_type *
 Returns a pointer to the underlying stored value. More...
 

Static Public Attributes

static constexpr basic_radian min {value_type{0}}
 Minimum representable canonical radian value used by this library. More...
 
static constexpr basic_radian max {value_type{2 * std::numbers::pi_v<value_type>}}
 Maximum representable canonical radian value used by this library. More...
 

Detailed Description

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

Strongly-typed radian value wrapper.

This type represents an angle measured in radians. It is a thin wrapper around a floating point storage type, enabling explicit unit usage and overload selection.

Template Parameters
TypeFloating-point storage type.

Constructor & Destructor Documentation

◆ basic_radian() [1/2]

template<floating_point Type>
requires (std::is_convertible_v<Other, Type>)
template<scalar Other>
requires (std::is_convertible_v<Other, Type>)
constexpr sbx::math::basic_radian< Type >::basic_radian ( const Other  value)
constexprnoexcept

Constructs a radian value from a scalar.

Template Parameters
OtherScalar input type convertible to value_type.
Parameters
valueRadian value to store.

◆ basic_radian() [2/2]

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_radian< Type >::basic_radian ( const basic_radian< Other > &  other)
constexprnoexcept

Constructs a radian value from another radian type.

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

Member Function Documentation

◆ data()

template<floating_point Type>
constexpr auto sbx::math::basic_radian< Type >::data
constexprnoexcept

Returns a pointer to the underlying stored value.

Returns
Pointer to the stored radian value.

◆ operator value_type()

template<floating_point Type>
constexpr sbx::math::basic_radian< Type >::operator value_type
constexprnoexcept

Implicit conversion to the underlying scalar value.

Returns
Stored radian value.

◆ 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_radian< Type >::operator*= ( const Other  rhs) -> basic_radian<Type>&
constexprnoexcept

Scales this radian value by a floating point factor.

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

◆ 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_radian< Type >::operator+= ( const basic_radian< Other > &  rhs) -> basic_radian<Type>&
constexprnoexcept

Adds another radian value to this value.

Template Parameters
OtherFloating-point storage type of the operand.
Parameters
rhsRight-hand side operand.
Returns
Reference to this instance.

◆ 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_radian< Type >::operator-= ( const basic_radian< Other > &  rhs) -> basic_radian<Type>&
constexprnoexcept

Subtracts another radian value from this value.

Template Parameters
OtherFloating-point storage type of the operand.
Parameters
rhsRight-hand side operand.
Returns
Reference to this instance.

◆ 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_radian< Type >::operator= ( const basic_radian< Other > &  other) -> basic_radian<Type>&
constexprnoexcept

Assigns from another radian type.

Template Parameters
OtherFloating-point storage type of the source.
Parameters
otherSource radian value.
Returns
Reference to this instance.

◆ value()

template<floating_point Type>
constexpr auto sbx::math::basic_radian< Type >::value
constexprnoexcept

Returns the stored radian value.

Returns
Stored radian value.

Member Data Documentation

◆ max

template<floating_point Type>
constexpr basic_radian sbx::math::basic_radian< Type >::max {value_type{2 * std::numbers::pi_v<value_type>}}
inlinestaticconstexpr

Maximum representable canonical radian value used by this library.

This value is intended for clamping and range conventions used by the library.

◆ min

template<floating_point Type>
constexpr basic_radian sbx::math::basic_radian< Type >::min {value_type{0}}
inlinestaticconstexpr

Minimum representable canonical radian value used by this library.

This value is intended for clamping and range conventions used by the library.


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