-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTypes.h
More file actions
34 lines (26 loc) · 787 Bytes
/
Types.h
File metadata and controls
34 lines (26 loc) · 787 Bytes
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
#pragma once
// LINT is always 64-bit
#define LINT long long int
// 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