37static const float NaN = std::numeric_limits<float>::quiet_NaN();
39TEST_CASE(
"Test 01 Unproject NaN",
"[unproject][mat4f][linear_algebra][math]" ) {
40 const Mat4f mMv({1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1});
41 const Mat4f mP({1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1});
42 const Recti viewport(0,0,800,600);
43 const float pick[] = { 400, 300, 0 };
49 bool res = Mat4f::mapWinToObj(pick[0], pick[1], pick[2],
53 REQUIRE(
false == std::isnan(objPos.
x) );
54 REQUIRE(
false == std::isnan(objPos.
y) );
55 REQUIRE(
false == std::isnan(objPos.
z) );
57 REQUIRE(
true == res );
60TEST_CASE(
"Test 10 Unproject Pick 1",
"[unproject][mat4f][linear_algebra][math]" ) {
61 const Mat4f mMv({ 1, 0, 0, 0,
65 const Mat4f mP({ 2.3464675f, 0, 0, 0,
69 const Recti viewport(0, 0, 1000, 1000);
70 const float pick[] = { 250, 250, 0.5f };
72 const Vec3f expected(-4.2612f, -4.1417f, -19.9980f );
77 bool res = Mat4f::mapWinToObj(pick[0], pick[1], pick[2],
81 REQUIRE(
true == res );
85TEST_CASE(
"Test 11 Unproject Pick 2",
"[unproject][mat4f][linear_algebra][math]" ) {
86 const Mat4f mMv({ 1, 0, 0, 0,
90 const Mat4f mP({ 2.3464675f, 0, 0, 0,
94 const Recti viewport(0, 0, 1000, 1000);
95 const float pick[] = { 250, 250, 0.5f };
97 const Vec3f expected(-4.2612f, -4.1417f, 180.002f );
102 bool res = Mat4f::mapWinToObj(pick[0], pick[1], pick[2],
106 REQUIRE(
true == res );
#define COMPARE_NARRAYS_EPS(lhs, rhs, len, eps)
Basic 4x4 value_type matrix implementation using fields for intensive use-cases (host operations).
Rectangle with x, y, width and height integer components.
constexpr const_iterator cbegin() const noexcept
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
TEST_CASE("Test 01 Unproject NaN", "[unproject][mat4f][linear_algebra][math]")