|
@@ -55,7 +55,8 @@
|
55
|
55
|
#endif
|
56
|
56
|
#define RADIANS(d) ((d)*M_PI/180.0)
|
57
|
57
|
#define DEGREES(r) ((r)*180.0/M_PI)
|
58
|
|
-#define HYPOT(x,y) sqrt(sq(x)+sq(y))
|
|
58
|
+#define HYPOT2(x,y) (sq(x)+sq(y))
|
|
59
|
+#define HYPOT(x,y) sqrt(HYPOT2(x,y))
|
59
|
60
|
|
60
|
61
|
// Macros to contrain values
|
61
|
62
|
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
|
|
@@ -124,4 +125,8 @@
|
124
|
125
|
#define MAX3(a, b, c) max(max(a, b), c)
|
125
|
126
|
#define MAX4(a, b, c, d) max(max(max(a, b), c), d)
|
126
|
127
|
|
|
128
|
+#define UNEAR_ZERO(x) ((x) < 0.000001)
|
|
129
|
+#define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001)
|
|
130
|
+#define NEAR(x,y) NEAR_ZERO((x)-(y))
|
|
131
|
+
|
127
|
132
|
#endif //__MACROS_H
|