libnxter
0.1
|
Provides simple arithmetic for absolute and relative angles. More...
#include "Debug.nxc"
Go to the source code of this file.
Functions | |
int | AngleAbsToRel (int absAngle) |
Converts absolute angle (0 .. 360) to relative angle (-180 .. 180) | |
int | AngleRelToAbs (int relAngle) |
Converts relative angle (-180 .. 180) to absolute angle (0 .. 360) | |
int | AngleAbsAdd (int absAngleA, int angle) |
Adds angle to an absolute angle (0 .. 360) absAngleA. Returns an absolute angle properly truncated to stay in (0 .. 360) range. | |
int | AngleAbsSub (int absAngleA, int angle) |
Subtracts angle from an absolute angle (0 .. 360) absAngleA. Returns an absolute angle properly truncated to stay in (0 .. 360) range. | |
int | AngleRelAdd (int relAngleA, int angle) |
Adds angle to a relative angle (-180 .. 180) relAngleA. Returns a relative angle properly truncated to stay in (-180 .. 180) range. | |
int | AngleRelSub (int relAngleA, int angle) |
Subtracts angle from a relative angle (-180 .. 180) relAngleA. Returns a relative angle properly truncated to stay in (-180 .. 180) range. | |
Provides simple arithmetic for absolute and relative angles.
Absolute angle is the world coordinate angle which ranges in 0 .. 360, where 0 lies on x-axis towards the positive side and increses on anti-clockwise rotation. Relative angle is an angle value that ranges in -180 .. +180, and is mostly useful in places where angle value is used to directly influence some other factor (such as in a motor control). There are times when they need to be interchanged depending on the context. This file provides the necessary conversion routines and simple arithmetics for working with absolute and relative angles. Arithmetics take care of wrapping the angles correctly.
Definition in file Angle.nxc.