QWT API (中文)
7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
src
plot3d
qwt3d_helper.h
1
#ifndef __HELPER_H__
2
#define __HELPER_H__
3
4
#include <math.h>
5
#include <float.h>
6
#include <vector>
7
#include <algorithm>
8
9
namespace
{
10
// Returns the minimum of two double values
11
inline
double
Min_(
double
a,
double
b)
12
{
13
return
(a < b) ? a : b;
14
}
15
}
16
17
namespace
Qwt3D {
18
19
// Checks if a value is practically zero (within floating-point epsilon)
20
inline
bool
isPracticallyZero(
double
a,
double
b = 0)
21
{
22
if
(!b)
23
return
(fabs(a) <= DBL_MIN);
24
25
return
(fabs(a - b) <= Min_(fabs(a), fabs(b)) * DBL_EPSILON);
26
}
27
28
// Rounds a double value to the nearest integer
29
inline
int
round(
double
d)
30
{
31
return
(d > 0) ? int(d + 0.5) : int(d - 0.5);
32
}
33
34
}
// ns
35
36
#endif
制作者
1.9.8