diff options
Diffstat (limited to 'src/utils.h')
-rw-r--r-- | src/utils.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h index 4433023f..a11cd59e 100644 --- a/src/utils.h +++ b/src/utils.h @@ -140,6 +140,13 @@ static inline double angle_between(double x1, double y1, double z1, return acos(cosine); } +static inline int within_tolerance(double a, double b, double percent) +{ + double tol = a * (percent/100.0); + if ( fabs(b-a) < fabs(tol) ) return 1; + return 0; +} + /* ----------------------------- Useful macros ------------------------------ */ |