|
TinyRobotics
|
Represents an angle with unit conversion and wrap-around support. More...
#include <Angle.h>
Public Member Functions | |
| Angle (float angle, AngleUnit unit) | |
| void | setValue (float newAngle, AngleUnit newUnit) |
| float | getValue (AngleUnit desiredUnit) const |
| Angle | operator* (float scalar) const |
| Angle | operator/ (float scalar) const |
| bool | operator== (const Angle &other) const |
| bool | operator!= (const Angle &other) const |
| bool | operator< (const Angle &other) const |
| bool | operator<= (const Angle &other) const |
| bool | operator> (const Angle &other) const |
| bool | operator>= (const Angle &other) const |
| Angle & | operator*= (float scalar) |
| Angle & | operator/= (float scalar) |
Protected Member Functions | |
| void | normalize () |
| void | add (Angle other) |
| void | subtract (Angle other) |
Protected Attributes | |
| float | angle = 0.0f |
| AngleUnit | unit = AngleUnit::DEG |
Represents an angle with unit conversion and wrap-around support.
The Angle class encapsulates an angle value and its unit, supporting degrees (DEG) and radians (RAD). It provides methods to set and retrieve the angle in any supported unit, automatically handling conversions and wrap-around (0-360° or 0-2π rad).
Example: