summaryrefslogtreecommitdiffstats
path: root/lib/tqwtplot3d/include/qwt3d_helper.h
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-11 14:15:27 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-07-11 14:15:27 -0500
commitb85a292ce06475d560bfa1195b63a8bfe211f22d (patch)
tree463d71be55ff807513139f1de106aef6bdd7b4db /lib/tqwtplot3d/include/qwt3d_helper.h
parentce039289815e2802fdeca8d384126c807ca9cb58 (diff)
downloadulab-b85a292ce06475d560bfa1195b63a8bfe211f22d.tar.gz
ulab-b85a292ce06475d560bfa1195b63a8bfe211f22d.zip
Add 0.2.7 release of qwtplot3d for future TQt3 conversion and use
Diffstat (limited to 'lib/tqwtplot3d/include/qwt3d_helper.h')
-rw-r--r--lib/tqwtplot3d/include/qwt3d_helper.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/tqwtplot3d/include/qwt3d_helper.h b/lib/tqwtplot3d/include/qwt3d_helper.h
new file mode 100644
index 0000000..0c1bfd7
--- /dev/null
+++ b/lib/tqwtplot3d/include/qwt3d_helper.h
@@ -0,0 +1,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