57 #define M_PI 3.14159265359
65 template <
class T,
typename Real>
66 inline bool is_zero(
const T& _a, Real _eps)
67 {
return fabs(_a) < _eps; }
69 template <
class T1,
class T2,
typename Real>
70 inline bool is_eq(
const T1& a,
const T2& b, Real _eps)
73 template <
class T1,
class T2,
typename Real>
74 inline bool is_gt(
const T1& a,
const T2& b, Real _eps)
75 {
return (a > b) && !is_eq(a,b,_eps); }
77 template <
class T1,
class T2,
typename Real>
78 inline bool is_ge(
const T1& a,
const T2& b, Real _eps)
79 {
return (a > b) || is_eq(a,b,_eps); }
81 template <
class T1,
class T2,
typename Real>
82 inline bool is_lt(
const T1& a,
const T2& b, Real _eps)
83 {
return (a < b) && !is_eq(a,b,_eps); }
85 template <
class T1,
class T2,
typename Real>
86 inline bool is_le(
const T1& a,
const T2& b, Real _eps)
87 {
return (a < b) || is_eq(a,b,_eps); }
91 const float flt_eps__ = (float)1e-05;
92 const double dbl_eps__ = 1e-09;
94 inline float eps__(
float)
97 inline double eps__(
double)
101 inline bool is_zero(
const T& a)
102 {
return is_zero(a, eps__(a)); }
104 template <
class T1,
class T2>
105 inline bool is_eq(
const T1& a,
const T2& b)
108 template <
class T1,
class T2>
109 inline bool is_gt(
const T1& a,
const T2& b)
110 {
return (a > b) && !is_eq(a,b); }
112 template <
class T1,
class T2>
113 inline bool is_ge(
const T1& a,
const T2& b)
114 {
return (a > b) || is_eq(a,b); }
116 template <
class T1,
class T2>
117 inline bool is_lt(
const T1& a,
const T2& b)
118 {
return (a < b) && !is_eq(a,b); }
120 template <
class T1,
class T2>
121 inline bool is_le(
const T1& a,
const T2& b)
122 {
return (a < b) || is_eq(a,b); }
148 return (T) _sin_angle >= 0 ? acos(_cos_angle) : -acos(_cos_angle);
152 inline T positive_angle(T _angle)
153 {
return _angle < 0 ? (2*M_PI + _angle) : _angle; }
156 inline T positive_angle(T _cos_angle, T _sin_angle)
157 {
return positive_angle(
angle(_cos_angle, _sin_angle)); }
160 inline T deg_to_rad(
const T& _angle)
161 {
return M_PI*(_angle/180); }
164 inline T rad_to_deg(
const T& _angle)
165 {
return 180*(_angle/M_PI); }
167 inline double log_(
double _value)
168 {
return log(_value); }
bool is_zero(const T &_a, Real _eps)
T angle(T _cos_angle, T _sin_angle)
T sane_aarg(T _aarg)
Trigonometry/angles - related.