QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt3d_helper.h
1#ifndef QWT3D_HELPER_H
2#define QWT3D_HELPER_H
3
4#include <cmath>
5#include <cfloat>
6#include <vector>
7#include <algorithm>
8
9namespace
10{
11// Returns the minimum of two double values
12inline double Min_(double a, double b)
13{
14 return (a < b) ? a : b;
15}
16}
17
18namespace Qwt3D
19{
20
21// Checks if a value is practically zero (within floating-point epsilon)
22inline bool isPracticallyZero(double a, double b = 0)
23{
24 if (!b)
25 return (fabs(a) <= DBL_MIN);
26
27 return (fabs(a - b) <= Min_(fabs(a), fabs(b)) * DBL_EPSILON);
28}
29
30} // ns
31
32#endif