# Ignition Math

## API Reference

6.9.3~pre2
Angle Class Reference

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 <ignition/math/Angle.hh>

## Public Member Functions

Angle ()
Default constructor that initializes an Angle to zero radians/degrees. More...

Conversion constructor that initializes an Angle to the specified radians. This constructor supports implicit conversion of a double to an Angle. For example: More...

Angle (const Angle &_angle)
Copy constructor that initializes this Angle to the value contained in the _angle parameter. More...

Angle (Angle &&_angle) noexcept
Move constructor. More...

virtual ~Angle ()
Destructor. More...

void Degree (double _degree)
Set the value from an angle in degrees. More...

double Degree () const
Get the 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...

Angleoperator= (const Angle &_angle)
Copy assignment operator. More...

Angleoperator= (Angle &&_angle) noexcept
Move assignment 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...

Set the value from an angle in radians. More...

Get the angle in radians. More...

void SetDegree (double _degree)
Set the value from an angle in degrees. More...

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(IGN_PI * 0.5). More...

static const Angle Pi
An angle with a value of Pi. Equivalent to math::Angle(IGN_PI). More...

static const Angle TwoPi
An angle with a value of Pi * 2. Equivalent to math::Angle(IGN_PI * 2). More...

static const Angle Zero
An angle with a value of zero. Equivalent to math::Angle(0). More...

## Friends

std::ostreamoperator<< (std::ostream &_out, const Angle &_a)
Stream insertion operator. Outputs in radians. More...

std::istreamoperator>> (std::istream &_in, Angle &_a)
Stream extraction operator. Assumes input is in radians. 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

#include <iostream>
int main(int argc, char **argv)
{
// A default constructed angle should be zero.
std::cout << "The angle 'a' should be zero: " << a << std::endl;
std::cout << "Pi in radians: " << a << std::endl;
std::cout << "Pi in degrees: " << a.Degree() << std::endl;
std::cout << "Pi + PI/2 in radians: " << a << std::endl;
std::cout << "Normalized to the range -Pi and Pi: "
<< a.Normalized() << std::endl;
}

## ◆ Angle() [1/4]

 Angle ( )

Default constructor that initializes an Angle to zero radians/degrees.

## ◆ Angle() [2/4]

 Angle ( const 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:

Angle a = 3.14;
Parameters

## ◆ Angle() [3/4]

 Angle ( const Angle & _angle )

Copy constructor that initializes this Angle to the value contained in the _angle parameter.

Parameters
 [in] _angle Angle to copy

## ◆ Angle() [4/4]

 Angle ( Angle && _angle )
noexcept

Move constructor.

Parameters
 [in] _angle Angle to move

## ◆ ~Angle()

 virtual ~Angle ( )
virtual

Destructor.

## ◆ Degree() [1/2]

 void Degree ( double _degree )

Set the value from an angle in degrees.

Parameters
 [in] _degree Degree value
SetDegree(double)

## ◆ Degree() [2/2]

 double Degree ( ) const

Get the angle in degrees.

Returns
Double containing the angle's degree value.

## ◆ Normalize()

 void Normalize ( )

Normalize the angle in the range -Pi to Pi. This modifies the value contained in this Angle instance.

Normalized()

Referenced by MassMatrix3< T >::PrincipalAxesOffset().

## ◆ Normalized()

 Angle Normalized ( ) const

Return the normalized angle in the range -Pi to Pi. This does not modify the value contained in this Angle instance.

Returns
The normalized value of this Angle.

## ◆ operator!=()

 bool operator!= ( const Angle & _angle ) const

Inequality operator.

Parameters
 [in] _angle Angle to check for inequality.
Returns
True if this != _angle.

Referenced by Angle::operator*().

## ◆ operator()()

 double operator() ( ) const

Returns
double containing the angle's radian value

## ◆ operator*() [1/2]

 double operator* ( ) const
inline

Dereference operator.

Returns
Double containing the angle's radian value

## ◆ operator*() [2/2]

 Angle operator* ( const Angle & _angle ) const

Multiplication operator, result = this * _angle.

Parameters
 [in] _angle Angle for multiplication.
Returns
The new angle

## ◆ operator*=()

 Angle operator*= ( const Angle & _angle )

Multiplication set operator, this = this * _angle.

Parameters
 [in] _angle Angle for multiplication.
Returns
The new angle.

Referenced by Angle::operator*().

## ◆ operator+()

 Angle operator+ ( const Angle & _angle ) const

Addition operator, result = this + _angle.

Parameters
Returns
The new angle.

Referenced by Angle::operator*().

## ◆ operator+=()

 Angle operator+= ( const Angle & _angle )

Addition set operator, this = this + _angle.

Parameters
Returns
The new angle.

Referenced by Angle::operator*().

## ◆ operator-()

 Angle operator- ( const Angle & _angle ) const

Subtraction operator, result = this - _angle.

Parameters
 [in] _angle Angle for subtraction.
Returns
The new angle.

Referenced by Angle::operator*().

## ◆ operator-=()

 Angle operator-= ( const Angle & _angle )

Subtraction set operator, this = this - _angle.

Parameters
 [in] _angle Angle for subtraction.
Returns
The new angle.

Referenced by Angle::operator*().

## ◆ operator/()

 Angle operator/ ( const Angle & _angle ) const

Division operator, result = this / _angle.

Parameters
 [in] _angle Angle for division.
Returns
The new angle.

Referenced by Angle::operator*().

## ◆ operator/=()

 Angle operator/= ( const Angle & _angle )

Division set operator, this = this / _angle.

Parameters
 [in] _angle Angle for division.
Returns
The new angle.

Referenced by Angle::operator*().

## ◆ operator<()

 bool operator< ( const Angle & _angle ) const

Less than operator.

Parameters
 [in] _angle Angle to check.
Returns
True if this < _angle.

Referenced by Angle::operator*().

## ◆ operator<=()

 bool operator<= ( const Angle & _angle ) const

Less than or equal operator.

Parameters
 [in] _angle Angle to check.
Returns
True if this <= _angle.

Referenced by Angle::operator*().

## ◆ operator=() [1/2]

 Angle& operator= ( const Angle & _angle )

Copy assignment operator.

Parameters
 [in] _angle Angle to copy

## ◆ operator=() [2/2]

 Angle& operator= ( Angle && _angle )
noexcept

Move assignment operator.

Parameters
 [in] _angle Angle to move

## ◆ 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.

Referenced by Angle::operator*().

## ◆ operator>()

 bool operator> ( const Angle & _angle ) const

Greater than operator.

Parameters
 [in] _angle Angle to check.
Returns
True if this > _angle.

Referenced by Angle::operator*().

## ◆ operator>=()

 bool operator>= ( const Angle & _angle ) const

Greater than or equal operator.

Parameters
 [in] _angle Angle to check.
Returns
True if this >= _angle.

Referenced by Angle::operator*().

Set the value from an angle in radians.

Parameters

Referenced by MassMatrix3< T >::PrincipalAxesOffset().

Returns
Double containing the angle's radian value.

## ◆ SetDegree()

 void SetDegree ( double _degree )

Set the value from an angle in degrees.

Parameters
 [in] _degree Degree value

Set the value from an angle in radians.

Parameters

## ◆ operator<<

 std::ostream& operator<< ( std::ostream & _out, const Angle & _a )
friend

Stream insertion operator. Outputs in radians.

Parameters
 [in] _out Output stream. [in] _a Angle to output.
Returns
The output stream.

## ◆ operator>>

 std::istream& operator>> ( std::istream & _in, Angle & _a )
friend

Stream extraction operator. Assumes input is in radians.

Parameters
 [in,out] _in Input stream. [out] _a Angle to read value into.
Returns
The input stream.

## ◆ HalfPi

 const Angle HalfPi
static

An angle with a value of Pi * 0.5. Equivalent to math::Angle(IGN_PI * 0.5).

## ◆ Pi

 const Angle Pi
static

An angle with a value of Pi. Equivalent to math::Angle(IGN_PI).

## ◆ TwoPi

 const Angle TwoPi
static

An angle with a value of Pi * 2. Equivalent to math::Angle(IGN_PI * 2).

## ◆ Zero

 const Angle 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: