9 #ifndef MRPT_MATH_WRAP2PI_H 10 #define MRPT_MATH_WRAP2PI_H 29 a = fmod(
a, static_cast<T>(2.0 *
M_PI));
30 if (was_neg)
a +=
static_cast<T
>(2.0 *
M_PI);
71 template <
class VECTOR>
74 const size_t N =
x.size();
75 for (
size_t i = 0; i < N; i++)
79 double Ap =
x[i] -
x[i - 1];
T angDistance(T from, T to)
Computes the shortest angular increment (or distance) between two planar orientations, such that it is constrained to [-pi,pi] and is correct for any combination of angles (e.g.
void wrapToPiInPlace(T &a)
Modifies the given angle to translate it into the ]-pi,pi] range.
This base provides a set of functions for maths stuff.
T wrapTo2Pi(T a)
Modifies the given angle to translate it into the [0,2pi[ range.
T wrapToPi(T a)
Modifies the given angle to translate it into the ]-pi,pi] range.
void wrapTo2PiInPlace(T &a)
Modifies the given angle to translate it into the [0,2pi[ range.
void unwrap2PiSequence(VECTOR &x)
Modify a sequence of angle values such as no consecutive values have a jump larger than PI in absolut...
GLubyte GLubyte GLubyte a