blob: 0c1bfd743b7f86caba6083a642e2ee2b7ba525c7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#ifndef __HELPER_H__
#define __HELPER_H__
#include <math.h>
#include <float.h>
#include <vector>
#include <algorithm>
namespace
{
inline double Min_(double a, double b)
{
return (a<b) ? a : b;
}
}
namespace Qwt3D
{
inline bool isPracticallyZero(double a, double b = 0)
{
if (!b)
return (fabs (a) <= DBL_MIN);
return (fabs (a - b) <= Min_(fabs(a), fabs(b))*DBL_EPSILON);
}
inline int round(double d)
{
return (d>0) ? int(d+0.5) : int(d-0.5);
}
} //ns
#endif
|