29 #ifndef utilfunctions_h__ 30 #define utilfunctions_h__ 38 return fmod(fmod(angle, 2.0
f*M_PI) + 2.0
f*M_PI, 2.0
f*M_PI);
50 static inline float sqr(
float val)
55 static inline int sign(
int x)
57 return x > 0 ? 1 : -1;
63 return radVal *
static_cast<T
>(180.0 / M_PI);
69 return degVal *
static_cast<T
>(M_PI / 180.0);
72 static bool poseDifferenceLargerThan(
const Eigen::Vector3f& pose1,
const Eigen::Vector3f& pose2,
float distanceDiffThresh,
float angleDiffThresh)
75 if ( ( (pose1.head<2>() - pose2.head<2>()).norm() ) > distanceDiffThresh){
79 float angleDiff = (pose1.z() - pose2.z());
81 if (angleDiff > M_PI) {
82 angleDiff -= M_PI * 2.0f;
83 }
else if (angleDiff < -M_PI) {
84 angleDiff += M_PI * 2.0f;
87 if (
abs(angleDiff) > angleDiffThresh){
static float sqr(float val)
static float normalize_angle_pos(float angle)
static float normalize_angle(float angle)
static T toRad(const T degVal)
static T toDeg(const T radVal)
INLINE Rall1d< T, V, S > abs(const Rall1d< T, V, S > &x)
static bool poseDifferenceLargerThan(const Eigen::Vector3f &pose1, const Eigen::Vector3f &pose2, float distanceDiffThresh, float angleDiffThresh)