add matrix transform overloads

This commit is contained in:
BlackMATov
2020-11-29 06:26:21 +07:00
parent 987071fbb1
commit 0841b7a1f0
4 changed files with 130 additions and 101 deletions

View File

@@ -79,46 +79,6 @@ namespace vmath_tests
constexpr explicit approx4(const vec<T, 4>& v) : value(v) {}
};
template < typename T >
struct approx2x2 {
mat<T, 2> value;
constexpr explicit approx2x2(const mat<T, 2>& v) : value(v) {}
};
template < typename T >
struct approx3x3 {
mat<T, 3> value;
constexpr explicit approx3x3(const mat<T, 3>& v) : value(v) {}
};
template < typename T >
struct approx4x4 {
mat<T, 4> value;
constexpr explicit approx4x4(const mat<T, 4>& v) : value(v) {}
};
//
//
//
template < typename T >
approx2(const vec<T, 2>&) -> approx2<T>;
template < typename T >
approx3(const vec<T, 3>&) -> approx3<T>;
template < typename T >
approx4(const vec<T, 4>&) -> approx4<T>;
template < typename T >
approx2x2(const mat<T, 2>&) -> approx2x2<T>;
template < typename T >
approx3x3(const mat<T, 3>&) -> approx3x3<T>;
template < typename T >
approx4x4(const mat<T, 4>&) -> approx4x4<T>;
//
//
//
@@ -142,25 +102,4 @@ namespace vmath_tests
constexpr bool operator==(const vec<T, 4>& l, const approx4<T>& r) {
return all(equal_to(l, r.value, approx_epsilon_v<T>));
}
template < typename T >
constexpr bool operator==(const mat<T, 2>& l, const approx2x2<T>& r) {
return l[0] == approx2(r.value[0])
&& l[1] == approx2(r.value[1]);
}
template < typename T >
constexpr bool operator==(const mat<T, 3>& l, const approx3x3<T>& r) {
return l[0] == approx3(r.value[0])
&& l[1] == approx3(r.value[1])
&& l[2] == approx3(r.value[2]);
}
template < typename T >
constexpr bool operator==(const mat<T, 4>& l, const approx4x4<T>& r) {
return l[0] == approx4(r.value[0])
&& l[1] == approx4(r.value[1])
&& l[2] == approx4(r.value[2])
&& l[3] == approx4(r.value[3]);
}
}