Browse Source

Add HYPOT2 and float comparison macros

pull/1/head
Scott Lahteine 8 years ago
parent
commit
413b61e64a
  1. 7
      Marlin/macros.h

7
Marlin/macros.h

@ -55,7 +55,8 @@
#endif #endif
#define RADIANS(d) ((d)*M_PI/180.0) #define RADIANS(d) ((d)*M_PI/180.0)
#define DEGREES(r) ((r)*180.0/M_PI) #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 // Macros to contrain values
#define NOLESS(v,n) do{ if (v < n) v = n; }while(0) #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 MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(max(max(a, b), c), d) #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 #endif //__MACROS_H

Loading…
Cancel
Save