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

Strongly-typed degree value wrapper. More...

#include <angle.hpp>

Public Types

using value_type = Type
 Underlying scalar value type.
 

Public Member Functions

constexpr basic_degree ()=default
 Constructs a degree value initialized to zero.
 
template<scalar Other>
requires (std::is_convertible_v<Other, Type>)
constexpr basic_degree (const Other value) noexcept
 Constructs a degree value from a scalar. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr basic_degree (const basic_degree< Other > &other) noexcept
 Constructs a degree value from another degree type. More...
 
constexpr ~basic_degree () noexcept=default
 Destructor.
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator= (const basic_degree< Other > &other) noexcept -> basic_degree< Type > &
 Assigns from another degree type. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator+= (const basic_degree< Other > &rhs) noexcept -> basic_degree< Type > &
 Adds another degree value to this value. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator-= (const basic_degree< Other > &rhs) noexcept -> basic_degree< Type > &
 Subtracts another degree value from this value. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator*= (const Other rhs) noexcept -> basic_degree< Type > &
 Scales this degree value by a floating point factor. More...
 
template<floating_point Other>
requires (std::is_convertible_v<Other, Type>)
constexpr auto operator/= (const Other rhs) noexcept -> basic_degree< Type > &
 Divides this degree value by a floating point factor. More...
 
constexpr auto value () const noexcept -> value_type
 Returns the stored degree 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_degree min {value_type{0}}
 Minimum representable canonical degree value used by this library. More...
 
static constexpr basic_degree max {value_type{360}}
 Maximum representable canonical degree value used by this library. More...
 

Detailed Description

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

Strongly-typed degree value wrapper.

This type represents an angle measured in degrees. 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_degree() [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_degree< Type >::basic_degree ( const Other  value)
constexprnoexcept

Constructs a degree value from a scalar.

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

◆ basic_degree() [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_degree< Type >::basic_degree ( const basic_degree< Other > &  other)
constexprnoexcept

Constructs a degree value from another degree type.

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

Member Function Documentation

◆ data()

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

Returns a pointer to the underlying stored value.

Returns
Pointer to the stored degree value.

◆ operator value_type()

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

Implicit conversion to the underlying scalar value.

Returns
Stored degree 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_degree< Type >::operator*= ( const Other  rhs) -> basic_degree<Type>&
constexprnoexcept

Scales this degree 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_degree< Type >::operator+= ( const basic_degree< Other > &  rhs) -> basic_degree<Type>&
constexprnoexcept

Adds another degree 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_degree< Type >::operator-= ( const basic_degree< Other > &  rhs) -> basic_degree<Type>&
constexprnoexcept

Subtracts another degree 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_degree< Type >::operator/= ( const Other  rhs) -> basic_degree<Type>&
constexprnoexcept

Divides this degree value by a floating point factor.

Template Parameters
OtherFloating-point type convertible to value_type.
Parameters
rhsDivisor.
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_degree< Type >::operator= ( const basic_degree< Other > &  other) -> basic_degree<Type>&
constexprnoexcept

Assigns from another degree type.

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

◆ value()

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

Returns the stored degree value.

Returns
Stored degree value.

Member Data Documentation

◆ max

template<floating_point Type>
constexpr basic_degree sbx::math::basic_degree< Type >::max {value_type{360}}
inlinestaticconstexpr

Maximum representable canonical degree 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_degree sbx::math::basic_degree< Type >::min {value_type{0}}
inlinestaticconstexpr

Minimum representable canonical degree 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: