File: qwt3d_helper.h

package info (click to toggle)
qwtplot3d 0.2.7%2Bsvn191-7
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 1,304 kB
  • ctags: 1,968
  • sloc: cpp: 8,913; ansic: 5,078; python: 95; makefile: 66; sh: 1
file content (36 lines) | stat: -rw-r--r-- 481 bytes parent folder | download | duplicates (11)
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