LinearAlgebra
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
Passer::LinearAlgebra::AngleOf< T > Class Template Reference

Detailed Description

template<typename T>
class Passer::LinearAlgebra::AngleOf< T >

An angle in various representations.

Template Parameters
TThe internal type used for the representation of the angle. The angle is internally limited to (-180..180] degrees or (-PI...PI] radians. When an angle exceeds this range, it is normalized to a value within the range.

#include <Angle.h>

Public Member Functions

 AngleOf ()
 Create a new angle with a zero value.
 
float InDegrees () const
 Get the angle value in degrees.
 
float InRadians () const
 Get the angle value in radians.
 
T GetBinary () const
 Get the raw value for the angle.
 
void SetBinary (T rawValue)
 Set the raw value of the angle.
 
bool operator== (const AngleOf< T > angle) const
 Tests whether this angle is equal to the given angle.
 
bool operator> (AngleOf< T > angle) const
 Tests if this angle is greater than the given angle.
 
bool operator>= (AngleOf< T > angle) const
 Tests if this angle is greater than or equal to the given angle.
 
bool operator< (AngleOf< T > angle) const
 Tests if this angle is less than the given angle.
 
bool operator<= (AngleOf< T > angle) const
 Tests if this angle is less than or equal to the given angle.
 
AngleOf< Toperator- () const
 Negate the angle.
 
AngleOf< Toperator- (const AngleOf< T > &angle) const
 Substract another angle from this angle.
 
AngleOf< Toperator+ (const AngleOf< T > &angle) const
 Add another angle from this angle.
 
AngleOf< Toperator+= (const AngleOf< T > &angle)
 Add another angle to this angle.
 
void Normalize ()
 Normalizes the angle to (-180..180] or (-PI..PI] Should not be needed but available in case it is.
 

Static Public Member Functions

static AngleOf< TDegrees (float degrees)
 Creates an angle in degrees.
 
static AngleOf< TRadians (float radians)
 Creates an angle in radians.
 
static AngleOf< TBinary (T rawValue)
 Creates an angle from a raw value.
 
static signed int Sign (AngleOf< T > angle)
 Returns the sign of the angle.
 
static AngleOf< TAbs (AngleOf< T > angle)
 Returns the magnitude of the angle.
 
static AngleOf< TNormalize (AngleOf< T > angle)
 Normalizes the angle to (-180..180] or (-PI..PI].
 
static AngleOf< TClamp (AngleOf< T > angle, AngleOf< T > min, AngleOf< T > max)
 Clamps the angle value between the two given angles.
 
static AngleOf< TMoveTowards (AngleOf< T > fromAngle, AngleOf< T > toAngle, float maxAngle)
 Rotates an angle towards another angle with a max distance.
 
static float Cos (AngleOf< T > angle)
 Calculates the cosine of an angle.
 
static float Sin (AngleOf< T > angle)
 Calculates the sine of an angle.
 
static float Tan (AngleOf< T > angle)
 Calculates the tangent of an angle.
 
static AngleOf< TAcos (float f)
 Calculates the arc cosine angle.
 
static AngleOf< TAsin (float f)
 Calculates the arc sine angle.
 
static AngleOf< TAtan (float f)
 Calculates the arc tangent angle.
 
static AngleOf< TAtan2 (float y, float x)
 Calculates the tangent for the given values.
 
static float CosineRuleSide (float a, float b, AngleOf< T > gamma)
 Computes the length of a side using the rule of cosines.
 
static AngleOf< TCosineRuleAngle (float a, float b, float c)
 Computes the angle of a corner using the rule of cosines.
 
static AngleOf< TSineRuleAngle (float a, AngleOf< T > beta, float c)
 Computes the angle of a corner using the rule of sines.
 

Static Public Attributes

static const AngleOf< Tzero = AngleOf<T>()
 An zero value angle.
 

Friends

AngleOf< Toperator* (const AngleOf< T > &angle, float factor)
 Mutliplies the angle.
 
AngleOf< Toperator* (float factor, const AngleOf< T > &angle)
 Multiplies the angle.
 

Member Function Documentation

◆ Degrees()

template<typename T >
static AngleOf< T > Passer::LinearAlgebra::AngleOf< T >::Degrees ( float  degrees)
static

Creates an angle in degrees.

Parameters
degreesthe angle in degrees
Returns
The angle value

◆ Radians()

template<typename T >
static AngleOf< T > Passer::LinearAlgebra::AngleOf< T >::Radians ( float  radians)
static

Creates an angle in radians.

Parameters
radiansthe angle in radians
Returns
The angle value

◆ Binary()

template<typename T >
AngleOf< T > AngleOf::Binary ( T  rawValue)
static

Creates an angle from a raw value.

Parameters
rawValuethe raw value to use for the angle
Returns
The the angle

◆ InDegrees()

template<typename T >
float Passer::LinearAlgebra::AngleOf< T >::InDegrees ( ) const

Get the angle value in degrees.

Returns
The angle value in degrees

◆ InRadians()

template<typename T >
float Passer::LinearAlgebra::AngleOf< T >::InRadians ( ) const

Get the angle value in radians.

Returns
The angle value in radians

◆ GetBinary()

template<typename T >
T AngleOf::GetBinary ( ) const

Get the raw value for the angle.

Returns
The raw value

◆ SetBinary()

template<typename T >
void AngleOf::SetBinary ( T  rawValue)

Set the raw value of the angle.

Parameters
rawValueThe raw value

◆ operator==()

template<typename T >
bool AngleOf::operator== ( const AngleOf< T angle) const

Tests whether this angle is equal to the given angle.

Parameters
angleThe angle to compare to
Returns
True when the angles are equal, False otherwise
Note
The equality is determine within the limits of precision of the raw type T

◆ operator>()

template<typename T >
bool AngleOf::operator> ( AngleOf< T angle) const

Tests if this angle is greater than the given angle.

Parameters
angleThe given angle
Returns
True when this angle is greater than the given angle, False otherwise

◆ operator>=()

template<typename T >
bool AngleOf::operator>= ( AngleOf< T angle) const

Tests if this angle is greater than or equal to the given angle.

Parameters
angleThe given angle
Returns
True when this angle is greater than or equal to the given angle. False otherwise.

◆ operator<()

template<typename T >
bool AngleOf::operator< ( AngleOf< T angle) const

Tests if this angle is less than the given angle.

Parameters
angleThe given angle
Returns
True when this angle is less than the given angle. False otherwise.

◆ operator<=()

template<typename T >
bool AngleOf::operator<= ( AngleOf< T angle) const

Tests if this angle is less than or equal to the given angle.

Parameters
angleThe given angle
Returns
True when this angle is less than or equal to the given angle. False otherwise.

◆ Sign()

template<typename T >
signed int Passer::LinearAlgebra::AngleOf< T >::Sign ( AngleOf< T angle)
static

Returns the sign of the angle.

Parameters
angleThe angle
Returns
-1 when the angle is negative, 1 when it is positive and 0 otherwise.

◆ Abs()

template<typename T >
AngleOf< T > Passer::LinearAlgebra::AngleOf< T >::Abs ( AngleOf< T angle)
static

Returns the magnitude of the angle.

Parameters
angleThe angle
Returns
The positive magitude of the angle. Negative values are negated to get a positive result

◆ operator-() [1/2]

template<typename T >
AngleOf< T > AngleOf::operator- ( ) const

Negate the angle.

Returns
The negated angle

◆ operator-() [2/2]

template<typename T >
AngleOf< T > AngleOf::operator- ( const AngleOf< T > &  angle) const

Substract another angle from this angle.

Parameters
angleThe angle to subtract from this angle
Returns
The result of the subtraction

◆ operator+()

template<typename T >
AngleOf< T > AngleOf::operator+ ( const AngleOf< T > &  angle) const

Add another angle from this angle.

Parameters
angleThe angle to add to this angle
Returns
The result of the addition

◆ operator+=()

template<typename T >
AngleOf< T > AngleOf::operator+= ( const AngleOf< T > &  angle)

Add another angle to this angle.

Parameters
angleThe angle to add to this angle
Returns
The result of the addition

◆ Normalize()

template<typename T >
AngleOf< T > AngleOf::Normalize ( AngleOf< T angle)
static

Normalizes the angle to (-180..180] or (-PI..PI].

Parameters
angleThe angle to normalize
Returns
The normalized angle;

◆ Clamp()

template<typename T >
AngleOf< T > AngleOf::Clamp ( AngleOf< T angle,
AngleOf< T min,
AngleOf< T max 
)
static

Clamps the angle value between the two given angles.

Parameters
angleThe angle to clamp
minThe minimum angle
maxThe maximum angle
Returns
The clamped value
Remarks
When the min value is greater than the max value, angle is returned unclamped.

◆ MoveTowards()

template<typename T >
AngleOf< T > AngleOf::MoveTowards ( AngleOf< T fromAngle,
AngleOf< T toAngle,
float  maxAngle 
)
static

Rotates an angle towards another angle with a max distance.

Parameters
fromAngleThe angle to start from
toAngleThe angle to rotate towards
maxAngleThe maximum angle to rotate
Returns
The rotated angle

◆ Cos()

template<typename T >
float AngleOf::Cos ( AngleOf< T angle)
static

Calculates the cosine of an angle.

Parameters
angleThe given angle
Returns
The cosine of the angle

◆ Sin()

template<typename T >
float AngleOf::Sin ( AngleOf< T angle)
static

Calculates the sine of an angle.

Parameters
angleThe given angle
Returns
The sine of the angle

◆ Tan()

template<typename T >
float AngleOf::Tan ( AngleOf< T angle)
static

Calculates the tangent of an angle.

Parameters
angleThe given angle
Returns
The tangent of the angle

◆ Acos()

template<typename T >
AngleOf< T > AngleOf::Acos ( float  f)
static

Calculates the arc cosine angle.

Parameters
fThe value
Returns
The arc cosine for the given value

◆ Asin()

template<typename T >
AngleOf< T > AngleOf::Asin ( float  f)
static

Calculates the arc sine angle.

Parameters
fThe value
Returns
The arc sine for the given value

◆ Atan()

template<typename T >
AngleOf< T > AngleOf::Atan ( float  f)
static

Calculates the arc tangent angle.

Parameters
fThe value
Returns
The arc tangent for the given value

◆ Atan2()

template<typename T >
AngleOf< T > Passer::LinearAlgebra::AngleOf< T >::Atan2 ( float  y,
float  x 
)
static

Calculates the tangent for the given values.

Parameters
yThe vertical value
xThe horizontal value
Returns
The tanget for the given values Uses the y and x signs to compute the quadrant

◆ CosineRuleSide()

template<typename T >
float AngleOf::CosineRuleSide ( float  a,
float  b,
AngleOf< T gamma 
)
static

Computes the length of a side using the rule of cosines.

Parameters
aThe length of side A
bThe length of side B
gammaThe angle of the corner opposing side C
Returns
The length of side C

◆ CosineRuleAngle()

template<typename T >
AngleOf< T > AngleOf::CosineRuleAngle ( float  a,
float  b,
float  c 
)
static

Computes the angle of a corner using the rule of cosines.

Parameters
aThe length of side A
bThe length of side B
cThe length of side C
Returns
The angle of the corner opposing side C

◆ SineRuleAngle()

template<typename T >
AngleOf< T > AngleOf::SineRuleAngle ( float  a,
AngleOf< T beta,
float  c 
)
static

Computes the angle of a corner using the rule of sines.

Parameters
aThe length of side A
betathe angle of the corner opposing side B
cThe length of side C
Returns
The angle of the corner opposing side A

Friends And Related Symbol Documentation

◆ operator* [1/2]

template<typename T >
AngleOf< T > operator* ( const AngleOf< T > &  angle,
float  factor 
)
friend

Mutliplies the angle.

Parameters
angleThe angle to multiply
factorThe factor by which the angle is multiplied
Returns
The multiplied angle

◆ operator* [2/2]

template<typename T >
AngleOf< T > operator* ( float  factor,
const AngleOf< T > &  angle 
)
friend

Multiplies the angle.

Parameters
factorThe factor by which the angle is multiplies
angleThe angle to multiply
Returns
The multiplied angle

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