diff --git a/headers/vmath.hpp/vmath_mat_fun.hpp b/headers/vmath.hpp/vmath_mat_fun.hpp index 3480dca..0bd5306 100644 --- a/headers/vmath.hpp/vmath_mat_fun.hpp +++ b/headers/vmath.hpp/vmath_mat_fun.hpp @@ -510,31 +510,11 @@ namespace vmath_hpp // approx - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat approx(const mat& xs, T y) { - return map_join([y](const vec& x){ return approx(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat approx(T x, const mat& ys) { - return map_join([x](const vec& y){ return approx(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr mat approx(const mat& xs, const mat& ys) { return map_join([](const vec& x, const vec& y){ return approx(x, y); }, xs, ys); } - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat approx(const mat& xs, T y, T epsilon) { - return map_join([y, epsilon](const vec& x){ return approx(x, y, epsilon); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat approx(T x, const mat& ys, T epsilon) { - return map_join([x, epsilon](const vec& y){ return approx(x, y, epsilon); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr mat approx(const mat& xs, const mat& ys, T epsilon) { return map_join([epsilon](const vec& x, const vec& y){ return approx(x, y, epsilon); }, xs, ys); @@ -542,16 +522,6 @@ namespace vmath_hpp // less - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat less(const mat& xs, T y) { - return map_join([y](const vec& x){ return less(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat less(T x, const mat& ys) { - return map_join([x](const vec& y){ return less(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr mat less(const mat& xs, const mat& ys) { return map_join([](const vec& x, const vec& y){ return less(x, y); }, xs, ys); @@ -559,16 +529,6 @@ namespace vmath_hpp // less_equal - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat less_equal(const mat& xs, T y) { - return map_join([y](const vec& x){ return less_equal(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat less_equal(T x, const mat& ys) { - return map_join([x](const vec& y){ return less_equal(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr mat less_equal(const mat& xs, const mat& ys) { return map_join([](const vec& x, const vec& y){ return less_equal(x, y); }, xs, ys); @@ -576,16 +536,6 @@ namespace vmath_hpp // greater - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat greater(const mat& xs, T y) { - return map_join([y](const vec& x){ return greater(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat greater(T x, const mat& ys) { - return map_join([x](const vec& y){ return greater(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr mat greater(const mat& xs, const mat& ys) { return map_join([](const vec& x, const vec& y){ return greater(x, y); }, xs, ys); @@ -593,16 +543,6 @@ namespace vmath_hpp // greater_equal - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat greater_equal(const mat& xs, T y) { - return map_join([y](const vec& x){ return greater_equal(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat greater_equal(T x, const mat& ys) { - return map_join([x](const vec& y){ return greater_equal(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr mat greater_equal(const mat& xs, const mat& ys) { return map_join([](const vec& x, const vec& y){ return greater_equal(x, y); }, xs, ys); @@ -610,16 +550,6 @@ namespace vmath_hpp // equal_to - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat equal_to(const mat& xs, T y) { - return map_join([y](const vec& x){ return equal_to(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat equal_to(T x, const mat& ys) { - return map_join([x](const vec& y){ return equal_to(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr mat equal_to(const mat& xs, const mat& ys) { return map_join([](const vec& x, const vec& y){ return equal_to(x, y); }, xs, ys); @@ -627,16 +557,6 @@ namespace vmath_hpp // not_equal_to - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat not_equal_to(const mat& xs, T y) { - return map_join([y](const vec& x){ return not_equal_to(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr mat not_equal_to(T x, const mat& ys) { - return map_join([x](const vec& y){ return not_equal_to(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr mat not_equal_to(const mat& xs, const mat& ys) { return map_join([](const vec& x, const vec& y){ return not_equal_to(x, y); }, xs, ys); diff --git a/headers/vmath.hpp/vmath_vec_fun.hpp b/headers/vmath.hpp/vmath_vec_fun.hpp index 55d1670..c5c460b 100644 --- a/headers/vmath.hpp/vmath_vec_fun.hpp +++ b/headers/vmath.hpp/vmath_vec_fun.hpp @@ -863,31 +863,11 @@ namespace vmath_hpp // approx - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec approx(const vec& xs, T y) { - return map_join([y](T x){ return approx(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec approx(T x, const vec& ys) { - return map_join([x](T y){ return approx(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr vec approx(const vec& xs, const vec& ys) { return map_join([](T x, T y){ return approx(x, y); }, xs, ys); } - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec approx(const vec& xs, T y, T epsilon) { - return map_join([y, epsilon](T x){ return approx(x, y, epsilon); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec approx(T x, const vec& ys, T epsilon) { - return map_join([x, epsilon](T y){ return approx(x, y, epsilon); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr vec approx(const vec& xs, const vec& ys, T epsilon) { return map_join([epsilon](T x, T y){ return approx(x, y, epsilon); }, xs, ys); @@ -895,16 +875,6 @@ namespace vmath_hpp // less - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec less(const vec& xs, T y) { - return map_join([y](T x){ return less(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec less(T x, const vec& ys) { - return map_join([x](T y){ return less(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr vec less(const vec& xs, const vec& ys) { return map_join([](T x, T y){ return less(x, y); }, xs, ys); @@ -912,16 +882,6 @@ namespace vmath_hpp // less_equal - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec less_equal(const vec& xs, T y) { - return map_join([y](T x){ return less_equal(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec less_equal(T x, const vec& ys) { - return map_join([x](T y){ return less_equal(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr vec less_equal(const vec& xs, const vec& ys) { return map_join([](T x, T y){ return less_equal(x, y); }, xs, ys); @@ -929,16 +889,6 @@ namespace vmath_hpp // greater - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec greater(const vec& xs, T y) { - return map_join([y](T x){ return greater(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec greater(T x, const vec& ys) { - return map_join([x](T y){ return greater(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr vec greater(const vec& xs, const vec& ys) { return map_join([](T x, T y){ return greater(x, y); }, xs, ys); @@ -946,16 +896,6 @@ namespace vmath_hpp // greater_equal - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec greater_equal(const vec& xs, T y) { - return map_join([y](T x){ return greater_equal(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec greater_equal(T x, const vec& ys) { - return map_join([x](T y){ return greater_equal(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr vec greater_equal(const vec& xs, const vec& ys) { return map_join([](T x, T y){ return greater_equal(x, y); }, xs, ys); @@ -963,16 +903,6 @@ namespace vmath_hpp // equal_to - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec equal_to(const vec& xs, T y) { - return map_join([y](T x){ return equal_to(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec equal_to(T x, const vec& ys) { - return map_join([x](T y){ return equal_to(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr vec equal_to(const vec& xs, const vec& ys) { return map_join([](T x, T y){ return equal_to(x, y); }, xs, ys); @@ -980,16 +910,6 @@ namespace vmath_hpp // not_equal_to - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec not_equal_to(const vec& xs, T y) { - return map_join([y](T x){ return not_equal_to(x, y); }, xs); - } - - template < typename T, std::size_t Size > - [[nodiscard]] constexpr vec not_equal_to(T x, const vec& ys) { - return map_join([x](T y){ return not_equal_to(x, y); }, ys); - } - template < typename T, std::size_t Size > [[nodiscard]] constexpr vec not_equal_to(const vec& xs, const vec& ys) { return map_join([](T x, T y){ return not_equal_to(x, y); }, xs, ys); diff --git a/untests/vmath_mat_fun_tests.cpp b/untests/vmath_mat_fun_tests.cpp index 6997ef8..479fd11 100644 --- a/untests/vmath_mat_fun_tests.cpp +++ b/untests/vmath_mat_fun_tests.cpp @@ -185,44 +185,17 @@ TEST_CASE("vmath/mat_fun") { STATIC_REQUIRE(all(int2x2(1, 1, 1, 1))); STATIC_REQUIRE(approx(int2x2(1,1,1,1), int2x2(0,1,2,3)) == bool2x2(false, true, false, false)); - STATIC_REQUIRE(approx(int2x2(0,1,2,3),1) == bool2x2(false, true, false, false)); - STATIC_REQUIRE(approx(1,int2x2(0,1,2,3)) == bool2x2(false, true, false, false)); - STATIC_REQUIRE(approx(int2x2(1,1,1,1), int2x2(0,1,2,3), 0) == bool2x2(false, true, false, false)); - STATIC_REQUIRE(approx(int2x2(0,1,2,3), 1, 0) == bool2x2(false, true, false, false)); - STATIC_REQUIRE(approx(1, int2x2(0,1,2,3), 0) == bool2x2(false, true, false, false)); - STATIC_REQUIRE(approx(int2x2(1,1,1,1), int2x2(0,1,2,3), 1) == bool2x2(true, true, true, false)); - STATIC_REQUIRE(approx(int2x2(0,1,2,3), 1, 1) == bool2x2(true, true, true, false)); - STATIC_REQUIRE(approx(1, int2x2(0,1,2,3), 1) == bool2x2(true, true, true, false)); - STATIC_REQUIRE(approx(int2x2(1,1,1,1), int2x2(0,1,2,3), 2) == bool2x2(true, true, true, true)); - STATIC_REQUIRE(approx(int2x2(0,1,2,3), 1, 2) == bool2x2(true, true, true, true)); - STATIC_REQUIRE(approx(1, int2x2(0,1,2,3), 2) == bool2x2(true, true, true, true)); STATIC_REQUIRE(less(int2x2(1,1,1,1), int2x2(0,1,2,3)) == bool2x2(false, false, true, true)); - STATIC_REQUIRE(less(int2x2(0,1,2,3), 1) == bool2x2(true, false, false, false)); - STATIC_REQUIRE(less(1, int2x2(0,1,2,3)) == bool2x2(false, false, true, true)); - STATIC_REQUIRE(less_equal(int2x2(1,1,1,1), int2x2(0,1,2,3)) == bool2x2(false, true, true, true)); - STATIC_REQUIRE(less_equal(int2x2(0,1,2,3), 1) == bool2x2(true, true, false, false)); - STATIC_REQUIRE(less_equal(1, int2x2(0,1,2,3)) == bool2x2(false, true, true, true)); - STATIC_REQUIRE(greater(int2x2(1,1,1,1), int2x2(0,1,2,3)) == bool2x2(true, false, false, false)); - STATIC_REQUIRE(greater(int2x2(0,1,2,3), 1) == bool2x2(false, false, true, true)); - STATIC_REQUIRE(greater(1, int2x2(0,1,2,3)) == bool2x2(true, false, false, false)); - STATIC_REQUIRE(greater_equal(int2x2(1,1,1,1), int2x2(0,1,2,3)) == bool2x2(true, true, false, false)); - STATIC_REQUIRE(greater_equal(int2x2(0,1,2,3), 1) == bool2x2(false, true, true, true)); - STATIC_REQUIRE(greater_equal(1, int2x2(0,1,2,3)) == bool2x2(true, true, false, false)); STATIC_REQUIRE(equal_to(int2x2(1,1,1,1), int2x2(0,1,2,3)) == bool2x2(false, true, false, false)); - STATIC_REQUIRE(equal_to(int2x2(0,1,2,3),1) == bool2x2(false, true, false, false)); - STATIC_REQUIRE(equal_to(1,int2x2(0,1,2,3)) == bool2x2(false, true, false, false)); - STATIC_REQUIRE(not_equal_to(int2x2(1,1,1,1), int2x2(0,1,2,3)) == bool2x2(true, false, true, true)); - STATIC_REQUIRE(not_equal_to(int2x2(0,1,2,3),1) == bool2x2(true, false, true, true)); - STATIC_REQUIRE(not_equal_to(1,int2x2(0,1,2,3)) == bool2x2(true, false, true, true)); } SECTION("transpose") { diff --git a/untests/vmath_qua_fun_tests.cpp b/untests/vmath_qua_fun_tests.cpp index ef9577a..c367be8 100644 --- a/untests/vmath_qua_fun_tests.cpp +++ b/untests/vmath_qua_fun_tests.cpp @@ -100,6 +100,7 @@ TEST_CASE("vmath/qua_fun") { STATIC_REQUIRE(less_equal(qua(1,1,1,1), qua(0,1,2,3)) == bool4(false, true, true, true)); STATIC_REQUIRE(greater(qua(1,1,1,1), qua(0,1,2,3)) == bool4(true, false, false, false)); STATIC_REQUIRE(greater_equal(qua(1,1,1,1), qua(0,1,2,3)) == bool4(true, true, false, false)); + STATIC_REQUIRE(equal_to(qua(1,1,1,1), qua(0,1,2,3)) == bool4(false, true, false, false)); STATIC_REQUIRE(not_equal_to(qua(1,1,1,1), qua(0,1,2,3)) == bool4(true, false, true, true)); } diff --git a/untests/vmath_vec_fun_tests.cpp b/untests/vmath_vec_fun_tests.cpp index 116784d..7efbc38 100644 --- a/untests/vmath_vec_fun_tests.cpp +++ b/untests/vmath_vec_fun_tests.cpp @@ -272,43 +272,16 @@ TEST_CASE("vmath/vec_fun") { STATIC_REQUIRE(all(int2(1, 1))); STATIC_REQUIRE(approx(int3(1,1,1), int3(0,1,2)) == bool3(false, true, false)); - STATIC_REQUIRE(approx(int3(0,1,2),1) == bool3(false, true, false)); - STATIC_REQUIRE(approx(1,int3(0,1,2)) == bool3(false, true, false)); - STATIC_REQUIRE(approx(int4(1,1,1,1), int4(0,1,2,3), 0) == bool4(false, true, false, false)); - STATIC_REQUIRE(approx(int4(0,1,2,3), 1, 0) == bool4(false, true, false, false)); - STATIC_REQUIRE(approx(1, int4(0,1,2,3), 0) == bool4(false, true, false, false)); - STATIC_REQUIRE(approx(int4(1,1,1,1), int4(0,1,2,3), 1) == bool4(true, true, true, false)); - STATIC_REQUIRE(approx(int4(0,1,2,3), 1, 1) == bool4(true, true, true, false)); - STATIC_REQUIRE(approx(1, int4(0,1,2,3), 1) == bool4(true, true, true, false)); - STATIC_REQUIRE(approx(int4(1,1,1,1), int4(0,1,2,3), 2) == bool4(true, true, true, true)); - STATIC_REQUIRE(approx(int4(0,1,2,3), 1, 2) == bool4(true, true, true, true)); - STATIC_REQUIRE(approx(1, int4(0,1,2,3), 2) == bool4(true, true, true, true)); STATIC_REQUIRE(less(int3(1,1,1), int3(0,1,2)) == bool3(false, false, true)); - STATIC_REQUIRE(less(int3(0,1,2), 1) == bool3(true, false, false)); - STATIC_REQUIRE(less(1, int3(0,1,2)) == bool3(false, false, true)); - STATIC_REQUIRE(less_equal(int3(1,1,1), int3(0,1,2)) == bool3(false, true, true)); - STATIC_REQUIRE(less_equal(int3(0,1,2), 1) == bool3(true, true, false)); - STATIC_REQUIRE(less_equal(1, int3(0,1,2)) == bool3(false, true, true)); - STATIC_REQUIRE(greater(int3(1,1,1), int3(0,1,2)) == bool3(true, false, false)); - STATIC_REQUIRE(greater(int3(0,1,2), 1) == bool3(false, false, true)); - STATIC_REQUIRE(greater(1, int3(0,1,2)) == bool3(true, false, false)); - STATIC_REQUIRE(greater_equal(int3(1,1,1), int3(0,1,2)) == bool3(true, true, false)); - STATIC_REQUIRE(greater_equal(int3(0,1,2), 1) == bool3(false, true, true)); - STATIC_REQUIRE(greater_equal(1, int3(0,1,2)) == bool3(true, true, false)); STATIC_REQUIRE(equal_to(int3(1,1,1), int3(0,1,2)) == bool3(false, true, false)); - STATIC_REQUIRE(equal_to(int3(0,1,2),1) == bool3(false, true, false)); - STATIC_REQUIRE(equal_to(1,int3(0,1,2)) == bool3(false, true, false)); - STATIC_REQUIRE(not_equal_to(int3(1,1,1), int3(0,1,2)) == bool3(true, false, true)); - STATIC_REQUIRE(not_equal_to(int3(0,1,2),1) == bool3(true, false, true)); - STATIC_REQUIRE(not_equal_to(1,int3(0,1,2)) == bool3(true, false, true)); } }