LinearAlgebra
|
An angle in various representations.
T | The 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< T > | operator- () const |
Negate the angle. | |
AngleOf< T > | operator- (const AngleOf< T > &angle) const |
Substract another angle from this angle. | |
AngleOf< T > | operator+ (const AngleOf< T > &angle) const |
Add another angle from this angle. | |
AngleOf< T > | operator+= (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< T > | Degrees (float degrees) |
Creates an angle in degrees. | |
static AngleOf< T > | Radians (float radians) |
Creates an angle in radians. | |
static AngleOf< T > | Binary (T rawValue) |
Creates an angle from a raw value. | |
static signed int | Sign (AngleOf< T > angle) |
Returns the sign of the angle. | |
static AngleOf< T > | Abs (AngleOf< T > angle) |
Returns the magnitude of the angle. | |
static AngleOf< T > | Normalize (AngleOf< T > angle) |
Normalizes the angle to (-180..180] or (-PI..PI]. | |
static AngleOf< T > | Clamp (AngleOf< T > angle, AngleOf< T > min, AngleOf< T > max) |
Clamps the angle value between the two given angles. | |
static AngleOf< T > | MoveTowards (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< T > | Acos (float f) |
Calculates the arc cosine angle. | |
static AngleOf< T > | Asin (float f) |
Calculates the arc sine angle. | |
static AngleOf< T > | Atan (float f) |
Calculates the arc tangent angle. | |
static AngleOf< T > | Atan2 (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< T > | CosineRuleAngle (float a, float b, float c) |
Computes the angle of a corner using the rule of cosines. | |
static AngleOf< T > | SineRuleAngle (float a, AngleOf< T > beta, float c) |
Computes the angle of a corner using the rule of sines. | |
Static Public Attributes | |
static const AngleOf< T > | zero = AngleOf<T>() |
An zero value angle. | |
Friends | |
AngleOf< T > | operator* (const AngleOf< T > &angle, float factor) |
Mutliplies the angle. | |
AngleOf< T > | operator* (float factor, const AngleOf< T > &angle) |
Multiplies the angle. | |
Creates an angle in degrees.
degrees | the angle in degrees |
Creates an angle in radians.
radians | the angle in radians |
Creates an angle from a raw value.
rawValue | the raw value to use for the angle |
float Passer::LinearAlgebra::AngleOf< T >::InDegrees | ( | ) | const |
Get the angle value in degrees.
float Passer::LinearAlgebra::AngleOf< T >::InRadians | ( | ) | const |
Get the angle value in radians.
Get the raw value for the angle.
Set the raw value of the angle.
rawValue | The raw value |
Tests whether this angle is equal to the given angle.
angle | The angle to compare to |
Tests if this angle is greater than the given angle.
angle | The given angle |
Tests if this angle is greater than or equal to the given angle.
angle | The given angle |
Tests if this angle is less than the given angle.
angle | The given angle |
Tests if this angle is less than or equal to the given angle.
angle | The given angle |
Returns the sign of the angle.
angle | The angle |
Returns the magnitude of the angle.
angle | The angle |
AngleOf< T > AngleOf::operator- | ( | ) | const |
Negate the angle.
Substract another angle from this angle.
angle | The angle to subtract from this angle |
Add another angle from this angle.
angle | The angle to add to this angle |
Add another angle to this angle.
angle | The angle to add to this angle |
Normalizes the angle to (-180..180] or (-PI..PI].
angle | The angle to normalize |
Clamps the angle value between the two given angles.
angle | The angle to clamp |
min | The minimum angle |
max | The maximum angle |
|
static |
Rotates an angle towards another angle with a max distance.
fromAngle | The angle to start from |
toAngle | The angle to rotate towards |
maxAngle | The maximum angle to rotate |
Calculates the cosine of an angle.
angle | The given angle |
Calculates the sine of an angle.
angle | The given angle |
Calculates the tangent of an angle.
angle | The given angle |
Calculates the arc cosine angle.
f | The value |
Calculates the arc sine angle.
f | The value |
Calculates the arc tangent angle.
f | The value |
Calculates the tangent for the given values.
y | The vertical value |
x | The horizontal value |
Computes the length of a side using the rule of cosines.
a | The length of side A |
b | The length of side B |
gamma | The angle of the corner opposing side C |
Computes the angle of a corner using the rule of cosines.
a | The length of side A |
b | The length of side B |
c | The length of side C |
Computes the angle of a corner using the rule of sines.
a | The length of side A |
beta | the angle of the corner opposing side B |
c | The length of side C |
Mutliplies the angle.
angle | The angle to multiply |
factor | The factor by which the angle is multiplied |
Multiplies the angle.
factor | The factor by which the angle is multiplies |
angle | The angle to multiply |