43 #include <boost/utility.hpp> 44 #include <boost/type_traits.hpp> 50 #define SMALL_NUM 0.00000001 62 inline bool is_close(
double a,
double b,
double epsilon = 1e-4)
64 return std::fabs(a - b) <
epsilon;
75 for (std::vector<double>::const_iterator it = angles.begin(); it!=angles.end(); ++it)
83 return std::atan2(
y, x);
97 return x / (1 + fabs(x));
106 template <
typename P1,
typename P2>
109 return std::sqrt( std::pow(point2.x-point1.x,2) + std::pow(point2.y-point1.y,2) );
119 template <
typename V1,
typename V2>
120 inline double cross2d(
const V1& v1,
const V2& v2)
122 return v1.x()*v2.y() - v2.x()*v1.y();
148 inline const T&
get_const_reference(
const T& val,
typename boost::disable_if<boost::is_pointer<T> >::type* dummy = 0) {
return val;}
const T & get_const_reference(const T *ptr)
Helper function that returns the const reference to a value defined by either its raw pointer type or...
double cross2d(const V1 &v1, const V2 &v2)
Calculate the 2d cross product (returns length of the resulting vector along the z-axis in 3d) ...
TFSIMD_FORCE_INLINE const tfScalar & y() const
double fast_sigmoid(double x)
Calculate a fast approximation of a sigmoid function.
RotType
Symbols for left/none/right rotations.
TFSIMD_FORCE_INLINE const tfScalar & x() const
double average_angles(const std::vector< double > &angles)
Return the average angle of an arbitrary number of given angles [rad].
bool smaller_than_abs(double i, double j)
Small helper function: check if |a|<|b|.
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
bool is_close(double a, double b, double epsilon=1e-4)
Check whether two variables (double) are close to each other.
double distance_points2d(const P1 &point1, const P2 &point2)
Calculate Euclidean distance between two 2D point datatypes.
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)