37TEST_CASE(
"Test 01 Unproject NaN",
"[unproject][mat4f][linear_algebra][math]" ) {
38 const Mat4f mMv({1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1});
39 const Mat4f mP({1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1});
40 const Recti viewport(0,0,800,600);
41 const float pick[] = { 400, 300, 0 };
50 REQUIRE(
false == std::isnan(objPos.
x) );
51 REQUIRE(
false == std::isnan(objPos.
y) );
52 REQUIRE(
false == std::isnan(objPos.
z) );
54 REQUIRE(
true == res );
57TEST_CASE(
"Test 10 Unproject Pick 1",
"[unproject][mat4f][linear_algebra][math]" ) {
58 const Mat4f mMv({ 1, 0, 0, 0,
62 const Mat4f mP({ 2.3464675f, 0, 0, 0,
66 const Recti viewport(0, 0, 1000, 1000);
67 const float pick[] = { 250, 250, 0.5f };
69 const Vec3f expObj(-4.2612f, -4.1417f, -19.9980f );
77 REQUIRE(
true == res );
78 COMPARE_NARRAYS_EPS(expObj.
cbegin(), result.
cbegin(), 3, 0.0001f);
80 const Vec3f expView = mMv * expObj;
84 REQUIRE(
true == res );
85 COMPARE_NARRAYS_EPS(expView.
cbegin(), result.
cbegin(), 3, 0.0001f);
88TEST_CASE(
"Test 11 Unproject Pick 2",
"[unproject][mat4f][linear_algebra][math]" ) {
89 const Mat4f mMv({ 1, 0, 0, 0,
93 const Mat4f mP({ 2.3464675f, 0, 0, 0,
97 const Recti viewport(0, 0, 1000, 1000);
98 const float pick[] = { 250, 250, 0.5f };
100 const Vec3f expObj(-4.2612f, -4.1417f, 180.002f );
108 REQUIRE(
true == res );
109 COMPARE_NARRAYS_EPS(expObj.
cbegin(), result.
cbegin(), 3, 0.0001f);
111 const Vec3f expView = mMv * expObj;
115 REQUIRE(
true == res );
116 COMPARE_NARRAYS_EPS(expView.
cbegin(), result.
cbegin(), 3, 0.0001f);
static bool mapWinToView(const value_type winx, const value_type winy, const value_type winz, const Matrix4 &mP, const Recti &viewport, Vec3 &viewPos) noexcept
static bool mapWinToObj(const value_type winx, const value_type winy, const value_type winz, const Matrix4 &mMv, const Matrix4 &mP, const Recti &viewport, Vec3 &objPos) noexcept