matrix: add relatively_equal overload

This commit is contained in:
Danny Robson 2018-04-11 18:24:10 +10:00
parent 2ef759877e
commit 3b5e94e0ea

View File

@ -225,6 +225,19 @@ namespace util {
template <typename T> matrix<4,4,T> rotation (T angle, vector<3,T> about);
template <size_t Rows, size_t Cols, typename ValueT>
bool
relatively_equal (const util::matrix<Rows,Cols,ValueT> &a,
const util::matrix<Rows,Cols,ValueT> &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.
//