ezEngine  Milestone 7
ezAngle Class Reference

Float wrapper struct for a safe usage and conversions of angles. More...

#include <Angle.h>

Public Member Functions

 EZ_DECLARE_POD_TYPE ()
 
 ezAngle ()
 Standard constructor, initializing with 0.
 
float GetDegree () const
 Returns the degree value. (Performs a conversion)
 
float GetRadian () const
 Returns the radian value. (No need for any conversion)
 
void NormalizeRange ()
 Brings the angle into the range of 0 degree - 360 degree. More...
 
ezAngle GetNormalizedRange () const
 Returns an equivalent angle with range between 0 degree - 360 degree. More...
 
bool IsEqualSimple (ezAngle rhs, ezAngle epsilon) const
 Equality check with epsilon. Simple check without normalization. 360 degree will equal 0 degree, but 720 will not.
 
bool IsEqualNormalized (ezAngle rhs, ezAngle epsilon) const
 Equality check with epsilon that uses normalized angles. Will recognize 720 degree == 0 degree.
 
ezAngle operator- () const
 
ezAngle operator+ (ezAngle r) const
 
ezAngle operator- (ezAngle r) const
 
void operator+= (ezAngle r)
 
void operator-= (ezAngle r)
 
bool operator== (const ezAngle &r) const
 
bool operator!= (const ezAngle &r) const
 
bool operator< (const ezAngle &r) const
 
template<typename Type >
EZ_FORCE_INLINE Type Pi ()
 
template<typename Type >
EZ_FORCE_INLINE Type DegToRadMultiplier ()
 
template<typename Type >
EZ_FORCE_INLINE Type RadToDegMultiplier ()
 
template<typename Type >
Type DegToRad (Type f)
 
template<typename Type >
Type RadToDeg (Type f)
 

Static Public Member Functions

template<typename Type >
static EZ_FORCE_INLINE Type DegToRadMultiplier ()
 Returns the constant to multiply with an angle in degree to convert it to radians.
 
template<typename Type >
static EZ_FORCE_INLINE Type RadToDegMultiplier ()
 Returns the constant to multiply with an angle in degree to convert it to radians.
 
template<typename Type >
static Type DegToRad (Type f)
 Converts an angle in degree to radians.
 
template<typename Type >
static Type RadToDeg (Type f)
 Converts an angle in radians to degree.
 
static ezAngle Degree (float fDegree)
 Creates an instance of ezAngle that was initialized from degree. (Performs a conversion)
 
static ezAngle Radian (float fRadian)
 Creates an instance of ezAngle that was initialized from radian. (No need for any conversion)
 
static ezAngle AngleBetween (ezAngle a, ezAngle b)
 Computes the smallest angle between the two given angles. The angle will always be a positive value. More...
 

Private Member Functions

 ezAngle (float fRadian)
 For internal use only.
 

Static Private Member Functions

template<typename Type >
static Type Pi ()
 Preventing an include circle by defining pi again (annoying, but unlikely to change ;)). Normally you should use ezMath::BasicType<Type>::Pi()
 

Private Attributes

float m_fRadian
 The ezRadian value.
 

Detailed Description

Float wrapper struct 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

ezAngle ezAngle::AngleBetween ( ezAngle  a,
ezAngle  b 
)
static

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.
ezAngle ezAngle::GetNormalizedRange ( ) const
inline

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

See Also
NormalizeRange()
void ezAngle::NormalizeRange ( )

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: