From 3b5e94e0ea3850d4ed3313de07e18ebfa14bc37b Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 11 Apr 2018 18:24:10 +1000 Subject: [PATCH] matrix: add relatively_equal overload --- matrix.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/matrix.hpp b/matrix.hpp index 43668483..c77c25b7 100644 --- a/matrix.hpp +++ b/matrix.hpp @@ -225,6 +225,19 @@ namespace util { template matrix<4,4,T> rotation (T angle, vector<3,T> about); + template + bool + relatively_equal (const util::matrix &a, + const util::matrix &b, + const float percentage) + { + for (size_t r = 0; r < Rows; ++r) + if (!all (relatively_equal (a[r], b[r], percentage))) + return false; + return true; + } + + /////////////////////////////////////////////////////////////////////////// // Convert an affine rotation matrix to euler angles. //