This tutorial explains how to use the
Angle class from Ignition Math library.
Compile the code
ign-math/examples and use
cmake to compile the code:
When the code is compiled, run:
The ouput of the program:
The code instantiates an angle class. The default constructed angle should be zero.
There are some predefined angles, such as:
By default, all values are in radians, but you can use the method
Degree to convert to degrees.
Angle class overloads the
+=, and many other, math operators.
Use the method
Normalized to bound the value between
This example will only work if the Ruby interface library was compiled and installed. Modify the
RUBYLIB environment variable to include the Ignition Math library install path. For example, if you install to
Execute the code:
There are some predefined values:
Create new objects:
Use the values in radians or degrees:
Angle class overloads math operators.
Normalize the value between