-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTypes.h
62 lines (46 loc) · 1.18 KB
/
Types.h
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
// LINT is always 64-bit
#define LINT long long int
// undefined
#define NOT_DEFINED -1
#define NOT_FOUND NOT_DEFINED
// useful macros
#define LIMIT(x,xmin,xmax) if (x < xmin) x = xmin; if (x > xmax) x = xmax
#define LIMIT_MIN(x,xmin) if (x < xmin) x = xmin
#define LIMIT_MAX(x,xmax) if (x > xmax) x = xmax
// tolerance
#define TOLERANCE(T) std::numeric_limits<T>::epsilon() * static_cast<T>(10.0)
#define TOLERANCE4 TOLERANCE(float)
#define TOLERANCE8 TOLERANCE(double)
// round
#define ROUND(x) (int) (floor(x + .5))
//===== PI - associated ========================================================
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#ifndef PI05
#define PI05 (M_PI * 0.5)
#endif
#ifndef PI20
#define PI20 (M_PI * 2.0)
#endif
#ifndef PI10
#define PI10 M_PI
#endif
#ifndef PCI
#define PCI (180.0 / M_PI)
#endif
#ifndef CPI
#define CPI (M_PI / 180.0)
#endif
#ifndef MI_RAD
#define MI_RAD (M_PI / 10800.)
#endif
#ifndef RAD_MI
#define RAD_MI (10800.0 / M_PI)
#endif
#ifndef MI_45
#define MI_45 2700.0
#endif
// swap
#define SWAP(T,x1,x2) { T temp = x1; x1 = x2; x2 = temp; }