Add HYPOT2 and float comparison macros
This commit is contained in:
parent
0ea7ed6db6
commit
413b61e64a
|
@ -55,7 +55,8 @@
|
|||
#endif
|
||||
#define RADIANS(d) ((d)*M_PI/180.0)
|
||||
#define DEGREES(r) ((r)*180.0/M_PI)
|
||||
#define HYPOT(x,y) sqrt(sq(x)+sq(y))
|
||||
#define HYPOT2(x,y) (sq(x)+sq(y))
|
||||
#define HYPOT(x,y) sqrt(HYPOT2(x,y))
|
||||
|
||||
// Macros to contrain values
|
||||
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0)
|
||||
|
@ -124,4 +125,8 @@
|
|||
#define MAX3(a, b, c) max(max(a, b), c)
|
||||
#define MAX4(a, b, c, d) max(max(max(a, b), c), d)
|
||||
|
||||
#define UNEAR_ZERO(x) ((x) < 0.000001)
|
||||
#define NEAR_ZERO(x) ((x) > -0.000001 && (x) < 0.000001)
|
||||
#define NEAR(x,y) NEAR_ZERO((x)-(y))
|
||||
|
||||
#endif //__MACROS_H
|
||||
|
|
Loading…
Reference in a new issue