The Angle class is used to simplify and clarify the use of radians and degrees measurements. A default constructed Angle instance has a value of zero radians/degrees. More...
#include <gz/math/Angle.hh>
Public Member Functions | |
Angle ()=default | |
Default constructor that initializes an Angle to zero radians/degrees. More... | |
constexpr | Angle (double _radian) |
Conversion constructor that initializes an Angle to the specified radians. This constructor supports implicit conversion of a double to an Angle. For example: More... | |
double | Degree () const |
Get the angle in degrees. More... | |
void | Degree (double _degree) |
Set the value from an angle in degrees. More... | |
void | Normalize () |
Normalize the angle in the range -Pi to Pi. This modifies the value contained in this Angle instance. More... | |
Angle | Normalized () const |
Return the normalized angle in the range -Pi to Pi. This does not modify the value contained in this Angle instance. More... | |
bool | operator!= (const Angle &_angle) const |
Inequality operator. More... | |
double | operator() () const |
Return the angle's radian value. More... | |
double | operator* () const |
Dereference operator. More... | |
Angle | operator* (const Angle &_angle) const |
Multiplication operator, result = this * _angle. More... | |
Angle | operator*= (const Angle &_angle) |
Multiplication set operator, this = this * _angle. More... | |
Angle | operator+ (const Angle &_angle) const |
Addition operator, result = this + _angle. More... | |
Angle | operator+= (const Angle &_angle) |
Addition set operator, this = this + _angle. More... | |
Angle | operator- (const Angle &_angle) const |
Subtraction operator, result = this - _angle. More... | |
Angle | operator-= (const Angle &_angle) |
Subtraction set operator, this = this - _angle. More... | |
Angle | operator/ (const Angle &_angle) const |
Division operator, result = this / _angle. More... | |
Angle | operator/= (const Angle &_angle) |
Division set operator, this = this / _angle. More... | |
bool | operator< (const Angle &_angle) const |
Less than operator. More... | |
bool | operator<= (const Angle &_angle) const |
Less than or equal operator. More... | |
bool | operator== (const Angle &_angle) const |
Equality operator, result = this == _angle. More... | |
bool | operator> (const Angle &_angle) const |
Greater than operator. More... | |
bool | operator>= (const Angle &_angle) const |
Greater than or equal operator. More... | |
double | Radian () const |
Get the angle in radians. More... | |
void | Radian (double _radian) |
Set the value from an angle in radians. More... | |
void | SetDegree (double _degree) |
Set the value from an angle in degrees. More... | |
void | SetRadian (double _radian) |
Set the value from an angle in radians. More... | |
Static Public Attributes | |
static const Angle & | HalfPi |
An angle with a value of Pi * 0.5. Equivalent to math::Angle(GZ_PI * 0.5). More... | |
static const Angle & | Pi |
An angle with a value of Pi. Equivalent to math::Angle(GZ_PI). More... | |
static const Angle & | TwoPi |
An angle with a value of Pi * 2. Equivalent to math::Angle(GZ_PI * 2). More... | |
static const Angle & | Zero |
An angle with a value of zero. Equivalent to math::Angle(0). More... | |
Detailed Description
The Angle class is used to simplify and clarify the use of radians and degrees measurements. A default constructed Angle instance has a value of zero radians/degrees.
Unless otherwise specified, the Angle class assumes units are in radians. An example of this are the stream insertion (<<) and extraction (>>) operators.
Example
Constructor & Destructor Documentation
◆ Angle() [1/2]
◆ Angle() [2/2]
|
inlineconstexpr |
Member Function Documentation
◆ Degree() [1/2]
double Degree | ( | ) | const |
Get the angle in degrees.
- Returns
- Double containing the angle's degree value.
◆ Degree() [2/2]
void Degree | ( | double | _degree | ) |
Set the value from an angle in degrees.
- Parameters
-
[in] _degree Degree value
- Deprecated:
- Use void SetDegree(double)
◆ Normalize()
void Normalize | ( | ) |
Normalize the angle in the range -Pi to Pi. This modifies the value contained in this Angle instance.
- See also
- Normalized()
Referenced by MassMatrix3< T >::PrincipalAxesOffset().
◆ Normalized()
Angle Normalized | ( | ) | const |
◆ operator!=()
bool operator!= | ( | const Angle & | _angle | ) | const |
Inequality operator.
- Parameters
-
[in] _angle Angle to check for inequality.
- Returns
- True if this != _angle.
◆ operator()()
double operator() | ( | ) | const |
Return the angle's radian value.
- Returns
- double containing the angle's radian value
◆ operator*() [1/2]
|
inline |
Dereference operator.
- Returns
- Double containing the angle's radian value
◆ operator*() [2/2]
Multiplication operator, result = this * _angle.
- Parameters
-
[in] _angle Angle for multiplication.
- Returns
- The new angle
◆ operator*=()
Multiplication set operator, this = this * _angle.
- Parameters
-
[in] _angle Angle for multiplication.
- Returns
- The new angle.
◆ operator+()
Addition operator, result = this + _angle.
- Parameters
-
[in] _angle Angle for addition.
- Returns
- The new angle.
◆ operator+=()
Addition set operator, this = this + _angle.
- Parameters
-
[in] _angle Angle for addition.
- Returns
- The new angle.
◆ operator-()
Subtraction operator, result = this - _angle.
- Parameters
-
[in] _angle Angle for subtraction.
- Returns
- The new angle.
◆ operator-=()
Subtraction set operator, this = this - _angle.
- Parameters
-
[in] _angle Angle for subtraction.
- Returns
- The new angle.
◆ operator/()
Division operator, result = this / _angle.
- Parameters
-
[in] _angle Angle for division.
- Returns
- The new angle.
◆ operator/=()
Division set operator, this = this / _angle.
- Parameters
-
[in] _angle Angle for division.
- Returns
- The new angle.
◆ operator<()
bool operator< | ( | const Angle & | _angle | ) | const |
◆ operator<=()
bool operator<= | ( | const Angle & | _angle | ) | const |
◆ operator==()
bool operator== | ( | const Angle & | _angle | ) | const |
Equality operator, result = this == _angle.
- Parameters
-
[in] _angle Angle to check for equality.
- Returns
- True if this == _angle.
◆ operator>()
bool operator> | ( | const Angle & | _angle | ) | const |
◆ operator>=()
bool operator>= | ( | const Angle & | _angle | ) | const |
◆ Radian() [1/2]
double Radian | ( | ) | const |
Get the angle in radians.
- Returns
- Double containing the angle's radian value.
◆ Radian() [2/2]
void Radian | ( | double | _radian | ) |
Set the value from an angle in radians.
- Parameters
-
[in] _radian Radian value.
- Deprecated:
- Use void SetRadian(double)
Referenced by MassMatrix3< T >::PrincipalAxesOffset().
◆ SetDegree()
void SetDegree | ( | double | _degree | ) |
Set the value from an angle in degrees.
- Parameters
-
[in] _degree Degree value
◆ SetRadian()
void SetRadian | ( | double | _radian | ) |
Set the value from an angle in radians.
- Parameters
-
[in] _radian Radian value.
Member Data Documentation
◆ HalfPi
|
static |
An angle with a value of Pi * 0.5. Equivalent to math::Angle(GZ_PI * 0.5).
◆ Pi
|
static |
An angle with a value of Pi. Equivalent to math::Angle(GZ_PI).
◆ TwoPi
|
static |
An angle with a value of Pi * 2. Equivalent to math::Angle(GZ_PI * 2).
◆ Zero
|
static |
An angle with a value of zero. Equivalent to math::Angle(0).
The documentation for this class was generated from the following file: