From 7b07106816c5c1444118c89048437e0e8c2ee83c Mon Sep 17 00:00:00 2001 From: Godzil Date: Fri, 14 Feb 2020 14:21:57 +0000 Subject: [PATCH] Add some nice math helping functions --- source/include/math_helper.h | 15 +++++++++++++++ source/math_helper.cpp | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 source/include/math_helper.h create mode 100644 source/math_helper.cpp diff --git a/source/include/math_helper.h b/source/include/math_helper.h new file mode 100644 index 0000000..900e08e --- /dev/null +++ b/source/include/math_helper.h @@ -0,0 +1,15 @@ +/* + * DoRayMe - a quick and dirty Raytracer + * Math helping function header + * + * Created by Manoël Trapier + * Copyright (c) 2020 986-Studio. + * + */ + +#ifndef DORAYME_MATH_HELPER_H +#define DORAYME_MATH_HELPER_H + +bool double_equal(double a, double b); + +#endif //DORAYME_MATH_HELPER_H diff --git a/source/math_helper.cpp b/source/math_helper.cpp new file mode 100644 index 0000000..b86f2f9 --- /dev/null +++ b/source/math_helper.cpp @@ -0,0 +1,17 @@ +/* + * DoRayMe - a quick and dirty Raytracer + * Math helping functions + * + * Created by Manoël Trapier + * Copyright (c) 2020 986-Studio. + * + */ + +#include +#include +#include + +bool double_equal(double a, double b) +{ + return fabs(a - b) < DBL_EPSILON; +}