XII Release 0.1.0
Loading...
Searching...
No Matches
xiiAngleTemplate< Type > Class Template Reference

Wrapper class for a safe usage and conversions of angles. More...

#include <Angle.h>

Public Member Functions

 XII_DECLARE_POD_TYPE ()
 
constexpr xiiAngleTemplate ()
 Standard constructor, initializing with 0.
 
constexpr Type GetDegree () const
 Returns the degree value. (Performs a conversion)
 
constexpr Type GetRadian () const
 Returns the radian value. (No need for any conversion)
 
XII_ALWAYS_INLINE void SetRadian (Type fRadian)
 Sets the radian value. (No need for any conversion)
 
void NormalizeRange ()
 Brings the angle into the range of 0 degree - 360 degree.
 
xiiAngleTemplate< Type > GetNormalizedRange () const
 Returns an equivalent angle with range between 0 degree - 360 degree.
 
bool IsEqualSimple (xiiAngleTemplate< Type > rhs, xiiAngleTemplate< Type > epsilon) const
 Equality check with epsilon. Simple check without normalization. 360 degree will equal 0 degree, but 720 will not.
 
bool IsEqualNormalized (xiiAngleTemplate< Type > rhs, xiiAngleTemplate< Type > epsilon) const
 Equality check with epsilon that uses normalized angles. Will recognize 720 degree == 0 degree.
 
constexpr xiiAngleTemplate< Type > operator- () const
 
constexpr xiiAngleTemplate< Type > operator+ (xiiAngleTemplate< Type > r) const
 
constexpr xiiAngleTemplate< Type > operator- (xiiAngleTemplate< Type > r) const
 
void operator+= (xiiAngleTemplate< Type > r)
 
void operator-= (xiiAngleTemplate< Type > r)
 
constexpr bool operator== (const xiiAngleTemplate< Type > &r) const
 
constexpr std::partial_ordering operator<=> (const xiiAngleTemplate< Type > &r) const
 

Static Public Member Functions

static constexpr XII_ALWAYS_INLINE Type DegToRadMultiplier ()
 Returns the constant to multiply with an angle in degree to convert it to radians.
 
static constexpr XII_ALWAYS_INLINE Type RadToDegMultiplier ()
 Returns the constant to multiply with an angle in degree to convert it to radians.
 
static constexpr Type DegToRad (Type f)
 Converts an angle in degree to radians.
 
static constexpr Type RadToDeg (Type f)
 Converts an angle in radians to degree.
 
static constexpr xiiAngleTemplate< Type > MakeZero ()
 Returns a zero initialized angle. Same as a default constructed object.
 
static constexpr xiiAngleTemplate< Type > MakeFromDegree (Type fDegree)
 Creates an instance of xiiAngleTemplate<Type> that was initialized from degree. (Performs a conversion)
 
static constexpr xiiAngleTemplate< Type > MakeFromRadian (Type fRadian)
 Creates an instance of xiiAngleTemplate<Type> that was initialized from radian. (No need for any conversion)
 
static constexpr xiiAngleTemplate< Type > AngleBetween (xiiAngleTemplate< Type > a, xiiAngleTemplate< Type > b)
 Computes the smallest angle between the two given angles. The angle will always be a positive value.
 

Detailed Description

template<typename Type>
class xiiAngleTemplate< Type >

Wrapper class for a safe usage and conversions of angles.

Uses radian internally. Will not automatically keep its range between 0 degree - 360 degree (0 - 2PI) but you can call NormalizeRange to do so.

Member Function Documentation

◆ AngleBetween()

template<typename Type>
XII_FORCE_INLINE xiiAngleTemplate< Type > xiiAngleTemplate< Type >::AngleBetween ( xiiAngleTemplate< Type > a,
xiiAngleTemplate< Type > b )
staticconstexpr

Computes the smallest angle between the two given angles. The angle will always be a positive value.

Note
The two angles must be in the same range. E.g. they should be either normalized or at least the absolute angle between them should not be more than 180 degree.

◆ GetNormalizedRange()

template<typename Type>
xiiAngleTemplate< Type > xiiAngleTemplate< Type >::GetNormalizedRange ( ) const
inline

Returns an equivalent angle with range between 0 degree - 360 degree.

See also
NormalizeRange()

◆ NormalizeRange()

template<typename Type>
void xiiAngleTemplate< Type >::NormalizeRange ( )
inline

Brings the angle into the range of 0 degree - 360 degree.

See also
GetNormalizedRange()

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