From 878127f9ea2c8537ab9c0de364a6bab2a8409ded Mon Sep 17 00:00:00 2001 From: Christopher Kulla Date: Mon, 2 May 2022 10:11:29 -0700 Subject: [PATCH] Fix compiler warnings on windows (#250) Signed-off-by: Chris Kulla --- src/Imath/ImathMatrix.h | 32 ++--- src/Imath/ImathMatrixAlgo.h | 2 +- src/ImathTest/half_perf_test.cpp | 16 +-- src/ImathTest/testBox.cpp | 36 +++-- src/ImathTest/testBoxAlgo.cpp | 57 ++++---- src/ImathTest/testColor.cpp | 2 +- src/ImathTest/testExtractEuler.cpp | 19 +-- src/ImathTest/testExtractSHRT.cpp | 47 ++++--- src/ImathTest/testFrustum.cpp | 152 ++++++++++++--------- src/ImathTest/testFrustumTest.cpp | 12 +- src/ImathTest/testFun.cpp | 14 +- src/ImathTest/testInterop.cpp | 21 +-- src/ImathTest/testInterval.cpp | 8 +- src/ImathTest/testInvert.cpp | 48 +++---- src/ImathTest/testJacobiEigenSolver.cpp | 26 ++-- src/ImathTest/testLineAlgo.cpp | 8 +- src/ImathTest/testMiscMatrixAlgo.cpp | 49 ++++--- src/ImathTest/testProcrustes.cpp | 56 ++++---- src/ImathTest/testQuat.cpp | 72 +++++----- src/ImathTest/testQuatSetRotation.cpp | 4 +- src/ImathTest/testQuatSlerp.cpp | 12 +- src/ImathTest/testRandom.cpp | 2 +- src/ImathTest/testTinySVD.cpp | 173 ++++++++++++++---------- 23 files changed, 480 insertions(+), 388 deletions(-) diff --git a/src/Imath/ImathMatrix.h b/src/Imath/ImathMatrix.h index c689e94d..d241f409 100644 --- a/src/Imath/ImathMatrix.h +++ b/src/Imath/ImathMatrix.h @@ -3226,22 +3226,22 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44& Matrix44::setValue (const Matrix44& v) IMATH_NOEXCEPT { - x[0][0] = v.x[0][0]; - x[0][1] = v.x[0][1]; - x[0][2] = v.x[0][2]; - x[0][3] = v.x[0][3]; - x[1][0] = v.x[1][0]; - x[1][1] = v.x[1][1]; - x[1][2] = v.x[1][2]; - x[1][3] = v.x[1][3]; - x[2][0] = v.x[2][0]; - x[2][1] = v.x[2][1]; - x[2][2] = v.x[2][2]; - x[2][3] = v.x[2][3]; - x[3][0] = v.x[3][0]; - x[3][1] = v.x[3][1]; - x[3][2] = v.x[3][2]; - x[3][3] = v.x[3][3]; + x[0][0] = T(v.x[0][0]); + x[0][1] = T(v.x[0][1]); + x[0][2] = T(v.x[0][2]); + x[0][3] = T(v.x[0][3]); + x[1][0] = T(v.x[1][0]); + x[1][1] = T(v.x[1][1]); + x[1][2] = T(v.x[1][2]); + x[1][3] = T(v.x[1][3]); + x[2][0] = T(v.x[2][0]); + x[2][1] = T(v.x[2][1]); + x[2][2] = T(v.x[2][2]); + x[2][3] = T(v.x[2][3]); + x[3][0] = T(v.x[3][0]); + x[3][1] = T(v.x[3][1]); + x[3][2] = T(v.x[3][2]); + x[3][3] = T(v.x[3][3]); return *this; } diff --git a/src/Imath/ImathMatrixAlgo.h b/src/Imath/ImathMatrixAlgo.h index a788af80..9d310b81 100644 --- a/src/Imath/ImathMatrixAlgo.h +++ b/src/Imath/ImathMatrixAlgo.h @@ -1033,7 +1033,7 @@ addOffset (const Matrix44& inMat, Matrix44 O; Vec3 _rOffset (rOffset); - _rOffset *= M_PI / 180.0; + _rOffset *= T(M_PI / 180.0); O.rotate (_rOffset); O[3][0] = tOffset[0]; diff --git a/src/ImathTest/half_perf_test.cpp b/src/ImathTest/half_perf_test.cpp index f1ee599e..5a8faa5d 100644 --- a/src/ImathTest/half_perf_test.cpp +++ b/src/ImathTest/half_perf_test.cpp @@ -8,6 +8,7 @@ #endif #include +#include #include #include @@ -372,26 +373,17 @@ main (int argc, char* argv[]) if (halfs && floats) { - srand (numentries); + Rand48 r(numentries); for (int i = 0; i < numentries; ++i) { - halfs[i] = (uint16_t) (rand()); + halfs[i] = (uint16_t) r.nexti(); floats[i] = imath_half_to_float (halfs[i]); } perf_test_half_to_float (floats, halfs, numentries); // test float -> half with real-world values -#ifdef _WIN32 - unsigned int rv; - for (int i = 0; i < numentries; ++i) - { - rand_s( &rv ); - floats[i] = 65504.0 * (((double) rand() / (double) UINT_MAX) * 2.0 - 1.0); - } -#else for (int i = 0; i < numentries; ++i) - floats[i] = 65504.0 * (drand48() * 2.0 - 1.0); -#endif + floats[i] = float(r.nextf(-65504, 65504)); perf_test_float_to_half (halfs, floats, numentries); } diff --git a/src/ImathTest/testBox.cpp b/src/ImathTest/testBox.cpp index dfa8efff..c9717e5b 100644 --- a/src/ImathTest/testBox.cpp +++ b/src/ImathTest/testBox.cpp @@ -39,7 +39,7 @@ addItem (const std::vector& value, std::vector& perms) T p; for (unsigned int i = 0; i < value.size(); i++) { - p[i] = value[i]; + p[i] = static_cast(value[i]); } perms.push_back (p); } @@ -92,8 +92,8 @@ testConstructors (const char* type) // { T p; - for (unsigned int i = 0; i < T::dimensions(); i++) - p[i] = i; + for (unsigned int i = 0; i < T::dimensions (); i++) + p[i] = static_cast(i); IMATH_INTERNAL_NAMESPACE::Box b (p); assert (b.min == p && b.max == p); @@ -107,8 +107,8 @@ testConstructors (const char* type) T p1; for (unsigned int i = 0; i < T::dimensions(); i++) { - p0[i] = i; - p1[i] = 10 * T::dimensions() - i - 1; + p0[i] = static_cast(i); + p1[i] = static_cast(10 * T::dimensions () - i - 1); } IMATH_INTERNAL_NAMESPACE::Box b (p0, p1); @@ -610,7 +610,7 @@ testSize (const char* type) T p; for (unsigned int i = 0; i < T::dimensions(); i++) { - p[i] = i; + p[i] = static_cast(i); } IMATH_INTERNAL_NAMESPACE::Box b1 (-p, p); assert (b1.size() == p * T (2)); @@ -669,8 +669,10 @@ testCenter (const char* type) T p1; for (unsigned int i = 0; i < T::dimensions(); i++) { - p0[i] = -typename T::BaseType (1 << (i + 1)); - p1[i] = typename T::BaseType (1 << (T::dimensions() - i)); + int lo = 1 << (i + 1); + int hi = 1 << (T::dimensions () - i); + p0[i] = -static_cast(lo); + p1[i] = static_cast(hi); } IMATH_INTERNAL_NAMESPACE::Box b1 (p0, p1); assert (b1.center() == (p1 + p0) / 2); @@ -722,8 +724,10 @@ testIsEmpty (const char* type) T p1; for (unsigned int i = 0; i < T::dimensions(); i++) { - p0[i] = -typename T::BaseType (1 << (i + 1)); - p1[i] = typename T::BaseType (1 << (T::dimensions() - i)); + int lo = 1 << (i + 1); + int hi = 1 << (T::dimensions () - i); + p0[i] = -static_cast(lo); + p1[i] = static_cast(hi); } IMATH_INTERNAL_NAMESPACE::Box b1 (p0, p1); assert (!b1.isEmpty()); @@ -776,8 +780,10 @@ testIsInfinite (const char* type) T p1; for (unsigned int i = 0; i < T::dimensions(); i++) { - p0[i] = -typename T::BaseType (1 << (i + 1)); - p1[i] = typename T::BaseType (1 << (T::dimensions() - i)); + int lo = 1 << (i + 1); + int hi = 1 << (T::dimensions () - i); + p0[i] = -static_cast(lo); + p1[i] = static_cast(hi); } IMATH_INTERNAL_NAMESPACE::Box b1 (p0, p1); assert (!b1.isInfinite()); @@ -838,8 +844,10 @@ testHasVolume (const char* type) T p1; for (unsigned int i = 0; i < T::dimensions(); i++) { - p0[i] = -typename T::BaseType (1 << (i + 1)); - p1[i] = typename T::BaseType (1 << (T::dimensions() - i)); + int lo = 1 << (i + 1); + int hi = 1 << (T::dimensions () - i); + p0[i] = -static_cast(lo); + p1[i] = static_cast(hi); } IMATH_INTERNAL_NAMESPACE::Box b1 (p0, p1); assert (b1.hasVolume()); diff --git a/src/ImathTest/testBoxAlgo.cpp b/src/ImathTest/testBoxAlgo.cpp index eb134d76..54455c32 100644 --- a/src/ImathTest/testBoxAlgo.cpp +++ b/src/ImathTest/testBoxAlgo.cpp @@ -51,9 +51,10 @@ testEntryAndExitPoints (const Box3f& box) for (int i = 0; i < 100000; ++i) { - V3f p1 (random.nextf (box.max.x, box.min.x), - random.nextf (box.max.y, box.min.y), - random.nextf (box.max.z, box.min.z)); + V3f p1 ( + float(random.nextf (box.max.x, box.min.x)), + float(random.nextf (box.max.y, box.min.y)), + float(random.nextf (box.max.z, box.min.z))); V3f p2 (p1 + hollowSphereRand (random)); @@ -91,8 +92,8 @@ testEntryAndExitPoints (const Box3f& box) // box, and it passes the box at a minimum distance of r1. // - const float r1 = 0.00001; - const float r2 = 1.0; + const float r1 = 0.00001f; + const float r2 = 1.0f; V3f p1 = box.min + r2 * hollowSphereRand (random); V3f p2; @@ -133,18 +134,20 @@ testEntryAndExitPoints (const Box3f& box) do { - p1 = V3f (random.nextf (bigBox.min.x, bigBox.max.x), - random.nextf (bigBox.min.y, bigBox.max.y), - random.nextf (bigBox.min.z, bigBox.max.z)); + p1 = V3f ( + float(random.nextf (bigBox.min.x, bigBox.max.x)), + float(random.nextf (bigBox.min.y, bigBox.max.y)), + float(random.nextf (bigBox.min.z, bigBox.max.z))); } while (box.intersects (p1)); V3f p2; do { - p2 = V3f (random.nextf (box.min.x, box.max.x), - random.nextf (box.min.y, box.max.y), - random.nextf (box.min.z, box.max.z)); + p2 = V3f ( + float(random.nextf (box.min.x, box.max.x)), + float(random.nextf (box.min.y, box.max.y)), + float(random.nextf (box.min.z, box.max.z))); } while (approximatelyEqual (p1, p2, e)); Line3f ray (p1, p2); @@ -422,9 +425,10 @@ testRayBoxIntersection (const Box3f& box) for (int i = 0; i < 100000; ++i) { - V3f p1 (random.nextf (box.max.x, box.min.x), - random.nextf (box.max.y, box.min.y), - random.nextf (box.max.z, box.min.z)); + V3f p1 ( + float(random.nextf (box.max.x, box.min.x)), + float(random.nextf (box.max.y, box.min.y)), + float(random.nextf (box.max.z, box.min.z))); V3f p2 (p1 + hollowSphereRand (random)); @@ -462,8 +466,8 @@ testRayBoxIntersection (const Box3f& box) // box, and it passes the box at a minimum distance of r1. // - const float r1 = 0.00001; - const float r2 = 1.0; + const float r1 = 0.00001f; + const float r2 = 1.0f; V3f p1 = box.min + r2 * hollowSphereRand (random); V3f p2; @@ -494,9 +498,10 @@ testRayBoxIntersection (const Box3f& box) for (int i = 0; i < 1000; ++i) { - V3f p1 (random.nextf (box.min.x, box.max.x), - random.nextf (box.min.y, box.max.y), - random.nextf (box.min.z, box.max.z)); + V3f p1 ( + float(random.nextf (box.min.x, box.max.x)), + float(random.nextf (box.min.y, box.max.y)), + float(random.nextf (box.min.z, box.max.z))); V3f p2 (p1 + hollowSphereRand (random)); @@ -520,18 +525,20 @@ testRayBoxIntersection (const Box3f& box) do { - p1 = V3f (random.nextf (bigBox.min.x, bigBox.max.x), - random.nextf (bigBox.min.y, bigBox.max.y), - random.nextf (bigBox.min.z, bigBox.max.z)); + p1 = V3f ( + float(random.nextf (bigBox.min.x, bigBox.max.x)), + float(random.nextf (bigBox.min.y, bigBox.max.y)), + float(random.nextf (bigBox.min.z, bigBox.max.z))); } while (box.intersects (p1)); V3f p2; do { - p2 = V3f (random.nextf (box.min.x, box.max.x), - random.nextf (box.min.y, box.max.y), - random.nextf (box.min.z, box.max.z)); + p2 = V3f ( + float(random.nextf (box.min.x, box.max.x)), + float(random.nextf (box.min.y, box.max.y)), + float(random.nextf (box.min.z, box.max.z))); } while (approximatelyEqual (p1, p2, e)); Line3f ray (p1, p2); diff --git a/src/ImathTest/testColor.cpp b/src/ImathTest/testColor.cpp index accf23b7..bfe0cf2d 100644 --- a/src/ImathTest/testColor.cpp +++ b/src/ImathTest/testColor.cpp @@ -38,7 +38,7 @@ testColor() assert (in3 == out3); IMATH_INTERNAL_NAMESPACE::C4c testConstructor1; - IMATH_INTERNAL_NAMESPACE::C4c testConstructor1i (0.f); + IMATH_INTERNAL_NAMESPACE::C4c testConstructor1i (0); IMATH_INTERNAL_NAMESPACE::C4c testConstructor2 (testConstructor1i); testConstructor1 = testConstructor2; // use these so the compiler doesn't emit a warning diff --git a/src/ImathTest/testExtractEuler.cpp b/src/ImathTest/testExtractEuler.cpp index 7b52a4c1..506c3d12 100644 --- a/src/ImathTest/testExtractEuler.cpp +++ b/src/ImathTest/testExtractEuler.cpp @@ -24,7 +24,7 @@ namespace float rad (float deg) { - return deg * (M_PI / 180); + return deg * float(M_PI / 180); } M44f @@ -100,10 +100,11 @@ testRandomAngles (M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf // Create a rotation matrix, M // - Eulerf e (rad (r.nextf (-180, 180)), - rad (r.nextf (-180, 180)), - rad (r.nextf (-180, 180)), - Eulerf::XYZ); + Eulerf e ( + rad (float(r.nextf (-180, 180))), + rad (float(r.nextf (-180, 180))), + rad (float(r.nextf (-180, 180))), + Eulerf::XYZ); M44f M (e.toMatrix44()); @@ -113,7 +114,7 @@ testRandomAngles (M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf for (int j = 0; j < 3; ++j) for (int k = 0; k < 3; ++k) - M[j][k] += r.nextf (-1e-7, 1e-7); + M[j][k] += float(r.nextf (-1e-7, 1e-7)); // // Extract Euler angles from M, convert the Euler angles @@ -169,7 +170,7 @@ test (M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf::Order orde for (int i = 0; i < 360; i += 90) for (int j = 0; j < 360; j += 90) for (int k = 0; k < 360; k += 90) - testAngles (V3f (i, j, k), matrixEulerMatrix, order); + testAngles (V3f (float(i), float(j), float(k)), matrixEulerMatrix, order); } void @@ -177,11 +178,11 @@ testRandomAngles33() { Rand48 r (0); - float eps = 8.0 * std::numeric_limits::epsilon(); + float eps = 8.0f * std::numeric_limits::epsilon (); for (int i = 0; i < 100000; ++i) { - float angle = rad (r.nextf (-180, 180)); + float angle = rad (float(r.nextf (-180, 180))); M33f M; M.setRotation (angle); diff --git a/src/ImathTest/testExtractSHRT.cpp b/src/ImathTest/testExtractSHRT.cpp index 35d95aa9..66eebf5e 100644 --- a/src/ImathTest/testExtractSHRT.cpp +++ b/src/ImathTest/testExtractSHRT.cpp @@ -32,7 +32,7 @@ namespace float rad (float deg) { - return deg * (M_PI / 180); + return deg * float(M_PI / 180); } void @@ -108,7 +108,8 @@ testRandomAngles33() // Scale M. // - V2f s (random.nextf (0.000001, 2.0), random.nextf (0.000001, 2.0)); + V2f s (float(random.nextf (0.000001, 2.0)), + float(random.nextf (0.000001, 2.0))); for (int j = 0; j < 2; j++) if (random.nextf (0.0, 1.0) >= 0.5) @@ -120,9 +121,8 @@ testRandomAngles33() // Shear M. // - float h = random.nextf (0.000001, 2.); - if (random.nextf (0.0, 1.0) >= 0.5) - h *= -1; + float h = float(random.nextf (0.000001, 2.)); + if (random.nextf (0.0, 1.0) >= 0.5) h *= -1; M *= M33f().setShear (h); @@ -130,7 +130,7 @@ testRandomAngles33() // Rotate M. // - float r = rad (random.nextf (-180, 180)); + float r = rad (float(random.nextf (-180, 180))); M *= M33f().setRotation (r); @@ -138,7 +138,8 @@ testRandomAngles33() // Translate M. // - V2f t (random.nextf (-10, 10), random.nextf (-10, 10)); + V2f t (float(random.nextf (-10, 10)), + float(random.nextf (-10, 10))); M *= M33f().setTranslation (t); @@ -148,7 +149,7 @@ testRandomAngles33() for (int j = 0; j < 3; ++j) for (int k = 0; k < 2; ++k) - M[j][k] += random.nextf (-1e-7, 1e-7); + M[j][k] += float(random.nextf (-1e-7, 1e-7)); debug (("Scale : %f %f\n", s[0], s[1])); debug (("Shear : %f\n", h)); @@ -264,7 +265,10 @@ testRandomAngles44() // Translate M. // - V3f t (random.nextf (-10, 10), random.nextf (-10, 10), random.nextf (-10, 10)); + V3f t ( + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10))); M.translate (t); @@ -272,9 +276,10 @@ testRandomAngles44() // Rotate M. // - V3f r (rad (random.nextf (-180, 180)), - rad (random.nextf (-180, 180)), - rad (random.nextf (-180, 180))); + V3f r ( + rad (float(random.nextf (-180, 180))), + rad (float(random.nextf (-180, 180))), + rad (float(random.nextf (-180, 180)))); M.rotate (r); @@ -282,9 +287,10 @@ testRandomAngles44() // Shear M. // - V3f h (random.nextf (0.000001, 2.0), - random.nextf (0.000001, 2.0), - random.nextf (0.000001, 2.0)); + V3f h ( + float(random.nextf (0.000001, 2.0)), + float(random.nextf (0.000001, 2.0)), + float(random.nextf (0.000001, 2.0))); for (int j = 0; j < 3; j++) if (random.nextf (0.0, 1.0) >= 0.5) @@ -296,9 +302,10 @@ testRandomAngles44() // Scale M. // - V3f s (random.nextf (0.000001, 2.0), - random.nextf (0.000001, 2.0), - random.nextf (0.000001, 2.0)); + V3f s ( + float(random.nextf (0.000001, 2.0)), + float(random.nextf (0.000001, 2.0)), + float(random.nextf (0.000001, 2.0))); for (int j = 0; j < 3; j++) if (random.nextf (0.0, 1.0) >= 0.5) @@ -312,7 +319,7 @@ testRandomAngles44() for (int j = 0; j < 4; ++j) for (int k = 0; k < 3; ++k) - M[j][k] += random.nextf (-1e-7, 1e-7); + M[j][k] += float(random.nextf (-1e-7, 1e-7)); debug (("Scale : %f %f %f\n", s[0], s[1], s[2])); debug (("Shear : %f %f %f\n", h[0], h[1], h[2])); @@ -382,7 +389,7 @@ test() for (int i = 0; i < 360; i += 90) for (int j = 0; j < 360; j += 90) for (int k = 0; k < 360; k += 90) - testAngles44 (V3f (i, j, k)); + testAngles44 (V3f (float(i), float(j), float(k))); } } // namespace diff --git a/src/ImathTest/testFrustum.cpp b/src/ImathTest/testFrustum.cpp index c6d39805..3bc6dfc9 100644 --- a/src/ImathTest/testFrustum.cpp +++ b/src/ImathTest/testFrustum.cpp @@ -28,7 +28,7 @@ testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf& frustum) { bool ortho = frustum.orthographic(); IMATH_INTERNAL_NAMESPACE::V3f o (0.0f, 0.0f, 0.0f); - float eps = 5.0e-4; + float eps = 5.0e-4f; for (auto xRo : { 0.0f, 100.0f, 200.0f }) { @@ -159,12 +159,12 @@ testFrustum() cout << "\nperspective "; - float n = 1.7; - float f = 567.0; - float l = -3.5; - float r = 2.0; - float b = -1.3; - float t = 0.9; + float n = 1.7f; + float f = 567.0f; + float l = -3.5f; + float r = 2.0f; + float b = -1.3f; + float t = 0.9f; IMATH_INTERNAL_NAMESPACE::Frustum frustum (n, f, l, r, t, b, false); @@ -178,40 +178,54 @@ testFrustum() 1e-6); cout << "2"; - IMATH_INTERNAL_NAMESPACE::M44f m = frustum.projectionMatrixExc(); - assert (IMATH_INTERNAL_NAMESPACE::abs (m[0][0] - ((2 * n) / (r - l))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[0][1]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[0][2]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[0][3]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][0]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][1] - ((2 * n) / (t - b))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][2]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][3]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][0] - ((r + l) / (r - l))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][1] - ((t + b) / (t - b))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][2] - (-(f + n) / (f - n))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][3] - -1.0) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][0]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][1]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][2] - ((-2 * f * n) / (f - n))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][3]) < 1e-6); - m = frustum.projectionMatrix(); - assert (IMATH_INTERNAL_NAMESPACE::abs (m[0][0] - ((2 * n) / (r - l))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[0][1]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[0][2]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[0][3]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][0]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][1] - ((2 * n) / (t - b))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][2]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][3]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][0] - ((r + l) / (r - l))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][1] - ((t + b) / (t - b))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][2] - (-(f + n) / (f - n))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][3] - -1.0) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][0]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][1]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][2] - ((-2 * f * n) / (f - n))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][3]) < 1e-6); + IMATH_INTERNAL_NAMESPACE::M44f m = frustum.projectionMatrixExc (); + assert ( + IMATH_INTERNAL_NAMESPACE::abs (m[0][0] - ((2 * n) / (r - l))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[0][1]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[0][2]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[0][3]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][0]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][1] - ((2 * n) / (t - b))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][2]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][3]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][0] - ((r + l) / (r - l))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][1] - ((t + b) / (t - b))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][2] - (-(f + n) / (f - n))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][3] - -1.0f) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][0]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][1]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs ( + m[3][2] - ((-2 * f * n) / (f - n))) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][3]) < 1e-6f); + m = frustum.projectionMatrix (); + assert ( + IMATH_INTERNAL_NAMESPACE::abs (m[0][0] - ((2 * n) / (r - l))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[0][1]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[0][2]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[0][3]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][0]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][1] - ((2 * n) / (t - b))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][2]) < 1e-6 && + IMATH_INTERNAL_NAMESPACE::abs (m[1][3]) < 1e-6 && + IMATH_INTERNAL_NAMESPACE::abs (m[2][0] - ((r + l) / (r - l))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][1] - ((t + b) / (t - b))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][2] - (-(f + n) / (f - n))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][3] - -1.0f) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][0]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][1]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs ( + m[3][2] - ((-2 * f * n) / (f - n))) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][3]) < 1e-6f); cout << "3"; cout << "\nplanes "; @@ -268,23 +282,28 @@ testFrustum() frustum.setOrthographic (true); - m = frustum.projectionMatrix(); - assert (IMATH_INTERNAL_NAMESPACE::abs (m[0][0] - (2 / (r - l))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[0][1]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[0][2]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[0][3]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][0]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][1] - (2 / (t - b))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][2]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[1][3]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][0]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][1]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][2] - (-2 / (f - n))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[2][3]) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][0] - (-(r + l) / (r - l))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][1] - (-(t + b) / (t - b))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][2] - (-(f + n) / (f - n))) < 1e-6 && - IMATH_INTERNAL_NAMESPACE::abs (m[3][3] - 1.0) < 1e-6); + m = frustum.projectionMatrix (); + assert ( + IMATH_INTERNAL_NAMESPACE::abs (m[0][0] - (2 / (r - l))) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[0][1]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[0][2]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[0][3]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][0]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][1] - (2 / (t - b))) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][2]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[1][3]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][0]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][1]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][2] - (-2 / (f - n))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[2][3]) < 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][0] - (-(r + l) / (r - l))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][1] - (-(t + b) / (t - b))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][2] - (-(f + n) / (f - n))) < + 1e-6f && + IMATH_INTERNAL_NAMESPACE::abs (m[3][3] - 1.0f) < 1e-6f); cout << "1"; cout << "\nplanes "; @@ -297,17 +316,17 @@ testFrustum() IMATH_INTERNAL_NAMESPACE::Frustum f1 (n, f, l, r, t, b, false); IMATH_INTERNAL_NAMESPACE::Frustum f2 (n, f, l, r, t, b, true); assert (f1 != f2); - f2.set (n + 0.1, f, l, r, t, b, false); + f2.set (n + 0.1f, f, l, r, t, b, false); assert (f1 != f2); - f2.set (n, f + 0.1, l, r, t, b, false); + f2.set (n, f + 0.1f, l, r, t, b, false); assert (f1 != f2); - f2.set (n, f, l + 0.1, r, t, b, false); + f2.set (n, f, l + 0.1f, r, t, b, false); assert (f1 != f2); - f2.set (n, f, l, r + 0.1, t, b, false); + f2.set (n, f, l, r + 0.1f, t, b, false); assert (f1 != f2); - f2.set (n, f, l, r, t + 0.1, b, false); + f2.set (n, f, l, r, t + 0.1f, b, false); assert (f1 != f2); - f2.set (n, f, l, r, t, b + 0.1, false); + f2.set (n, f, l, r, t, b + 0.1f, false); assert (f1 != f2); cout << "\npassed inequality test"; @@ -326,8 +345,9 @@ testFrustum() assert (f1 == f2); - assert (f1.ZToDepth (zMin, zMin, zMax) == f1.ZToDepthExc (zMin, zMin, zMax)); - assert (f1.normalizedZToDepth (zMin) == f1.normalizedZToDepthExc (zMin)); + assert ( + f1.ZToDepth (zMin, zMin, zMax) == f1.ZToDepthExc (zMin, zMin, zMax)); + assert (f1.normalizedZToDepth (float(zMin)) == f1.normalizedZToDepthExc (float(zMin))); assert (f1.DepthToZ (n, zMin, zMax) == f1.DepthToZExc (n, zMin, zMax)); assert (f1.worldRadius (v3, one) == f1.worldRadiusExc (v3, one)); assert (f1.screenRadius (v3, one) == f1.screenRadiusExc (v3, one)); diff --git a/src/ImathTest/testFrustumTest.cpp b/src/ImathTest/testFrustumTest.cpp index 721b9ef4..d2bc88e9 100644 --- a/src/ImathTest/testFrustumTest.cpp +++ b/src/ImathTest/testFrustumTest.cpp @@ -27,12 +27,12 @@ testFrustumTest() cout << "\nisVisible(Vec3) "; - float n = 1.7; - float f = 567.0; - float l = -3.5; - float r = 2.0; - float b = -1.3; - float t = 0.9; + float n = 1.7f; + float f = 567.0f; + float l = -3.5f; + float r = 2.0f; + float b = -1.3f; + float t = 0.9f; IMATH_INTERNAL_NAMESPACE::Frustum frustum (n, f, l, r, t, b, false); diff --git a/src/ImathTest/testFun.cpp b/src/ImathTest/testFun.cpp index 91f25ae8..cd0c4b1c 100644 --- a/src/ImathTest/testFun.cpp +++ b/src/ImathTest/testFun.cpp @@ -87,11 +87,11 @@ testd (double d, bool changeExpected = true) double spd = IMATH_INTERNAL_NAMESPACE::succd (IMATH_INTERNAL_NAMESPACE::predd (d)); double psd = IMATH_INTERNAL_NAMESPACE::predd (IMATH_INTERNAL_NAMESPACE::succd (d)); - printf ("d %0.18lg %lx\n", d, bit_cast(d)); - printf ("sd %0.18lg %lx\n", sd, bit_cast(sd)); - printf ("pd %0.18lg %lx\n", pd, bit_cast(pd)); - printf ("spd %0.18lg %lx\n", spd, bit_cast(spd)); - printf ("psd %0.18lg %lx\n", psd, bit_cast(psd)); + printf ("d %0.18lg %llx\n", d, bit_cast (d)); + printf ("sd %0.18lg %llx\n", sd, bit_cast (sd)); + printf ("pd %0.18lg %llx\n", pd, bit_cast (pd)); + printf ("spd %0.18lg %llx\n", spd, bit_cast (spd)); + printf ("psd %0.18lg %llx\n", psd, bit_cast (psd)); fflush (stdout); @@ -252,12 +252,12 @@ testFun() cout << "successor, predecessor" << endl; testf (0); - testf (0.0 * -1.0); + testf (0.0f * -1.0f); testf (1); testf (-1); testf (16); testf (7); - testf (0.7); + testf (0.7f); union {float f; uint32_t i;} u; u.i = 0x7f800000; // inf diff --git a/src/ImathTest/testInterop.cpp b/src/ImathTest/testInterop.cpp index f26680e2..29f223fe 100644 --- a/src/ImathTest/testInterop.cpp +++ b/src/ImathTest/testInterop.cpp @@ -584,9 +584,10 @@ testInteropMx2() Matrix22 ref; SimpleMx s; for (int j = 0; j < 2; ++j) - for (int i = 0; i < 2; ++i) { - s[j][i] = i + j * 2; - ref[j][i] = i + j * 2; + for (int i = 0; i < 2; ++i) + { + s[j][i] = float(i + j * 2); + ref[j][i] = float(i + j * 2); } Matrix22 v(s); assert(v[0][0] == 0 && v[0][1] == 1 && @@ -627,9 +628,10 @@ testInteropMx3() Matrix33 ref; SimpleMx s; for (int j = 0; j < 3; ++j) - for (int i = 0; i < 3; ++i) { - s[j][i] = i + j * 3; - ref[j][i] = i + j * 3; + for (int i = 0; i < 3; ++i) + { + s[j][i] = float(i + j * 3); + ref[j][i] = float(i + j * 3); } Matrix33 v(s); assert(v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && @@ -672,9 +674,10 @@ testInteropMx4() Matrix44 ref; SimpleMx s; for (int j = 0; j < 4; ++j) - for (int i = 0; i < 4; ++i) { - s[j][i] = i + j * 4; - ref[j][i] = i + j * 4; + for (int i = 0; i < 4; ++i) + { + s[j][i] = float(i + j * 4); + ref[j][i] = float(i + j * 4); } Matrix44 v(s); assert(v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && v[0][3] == 3 && diff --git a/src/ImathTest/testInterval.cpp b/src/ImathTest/testInterval.cpp index ae8d58fe..582e8ab2 100644 --- a/src/ImathTest/testInterval.cpp +++ b/src/ImathTest/testInterval.cpp @@ -154,7 +154,7 @@ testExtendByPoint (const char* type) // for (unsigned int i = 0; i < iters; i++) { - T p (rand.nextf (-12345, 12345)); + T p (static_cast(rand.nextf (-12345, 12345))); IMATH_INTERNAL_NAMESPACE::Interval b; b.extendBy (p); assert (b.min == p && b.max == p); @@ -173,7 +173,7 @@ testExtendByPoint (const char* type) for (unsigned int j = 0; j < i; j++) { - T p (rand.nextf (-12345, 12345)); + T p (static_cast(rand.nextf (-12345, 12345))); if (j == 0) { @@ -234,8 +234,8 @@ testExtendByInterval (const char* type) for (unsigned int i = 1; i < iters; i++) { - T p0 (rand.nextf (0, 999)); - T p1 (rand.nextf (1000, 1999)); + T p0 (static_cast(rand.nextf (0, 999))); + T p1 (static_cast(rand.nextf (1000, 1999))); min = b.min; max = b.max; diff --git a/src/ImathTest/testInvert.cpp b/src/ImathTest/testInvert.cpp index 4b8fbdfb..cf352605 100644 --- a/src/ImathTest/testInvert.cpp +++ b/src/ImathTest/testInvert.cpp @@ -81,23 +81,23 @@ testInvert () 0, 0, 0, -1, 0, 0, 1, 0); - M44f m4 ( 4.683281e-01, -8.749647e-01, 1.229049e-01, 0.000000e+00, - 1.251189e-02, 1.456563e-01, 9.892561e-01, 0.000000e+00, - -8.834660e-01, -4.617587e-01, 7.916244e-02, 0.000000e+00, - -4.726541e+00, 3.044795e+00, -6.737138e+00, 1.000000e+00); + M44f m4 ( 4.683281e-01f, -8.749647e-01f, 1.229049e-01f, 0.000000e+00f, + 1.251189e-02f, 1.456563e-01f, 9.892561e-01f, 0.000000e+00f, + -8.834660e-01f, -4.617587e-01f, 7.916244e-02f, 0.000000e+00f, + -4.726541e+00f, 3.044795e+00f, -6.737138e+00f, 1.000000e+00f); - M44f m5 ( 4.683281e-01, -8.749647e-01, 1.229049e-01, 1.000000e+00, - 1.251189e-02, 1.456563e-01, 9.892561e-01, 2.000000e+00, - -8.834660e-01, -4.617587e-01, 7.916244e-02, 3.000000e+00, - -4.726541e+00, 3.044795e+00, -6.737138e+00, 4.000000e+00); + M44f m5 ( 4.683281e-01f, -8.749647e-01f, 1.229049e-01f, 1.000000e+00f, + 1.251189e-02f, 1.456563e-01f, 9.892561e-01f, 2.000000e+00f, + -8.834660e-01f, -4.617587e-01f, 7.916244e-02f, 3.000000e+00f, + -4.726541e+00f, 3.044795e+00f, -6.737138e+00f, 4.000000e+00f); // clang-format on - invertM44f (m1, 0); - invertM44f (m2, 0); - invertM44f (m3, 0); - invertM44f (m4, 1e-6); - invertM44f (m5, 1e-6); + invertM44f (m1, 0); + invertM44f (m2, 0); + invertM44f (m3, 0); + invertM44f (m4, 1e-6f); + invertM44f (m5, 1e-6f); } { @@ -117,21 +117,21 @@ testInvert () 0, 0, -1, 0, 1, 0); - M33f m4 ( 4.683281e-01, -8.749647e-01, 0.000000e+00, - 1.251189e-02, 1.456563e-01, 0.000000e+00, - 0.000000e+00, 0.000000e+00, 1.000000e+00); + M33f m4 ( 4.683281e-01f, -8.749647e-01f, 0.000000e+00f, + 1.251189e-02f, 1.456563e-01f, 0.000000e+00f, + 0.000000e+00f, 0.000000e+00f, 1.000000e+00f); - M33f m5 ( 4.683281e-01, -8.749647e-01, 1.229049e-01, - 1.251189e-02, 1.456563e-01, 9.892561e-01, - -8.834660e-01, -4.617587e-01, 7.916244e-02); + M33f m5 ( 4.683281e-01f, -8.749647e-01f, 1.229049e-01f, + 1.251189e-02f, 1.456563e-01f, 9.892561e-01f, + -8.834660e-01f, -4.617587e-01f, 7.916244e-02f); // clang-format on - invertM33f (m1, 0); - invertM33f (m2, 0); - invertM33f (m3, 0); - invertM33f (m4, 1e-6); - invertM33f (m5, 1e-6); + invertM33f (m1, 0); + invertM33f (m2, 0); + invertM33f (m3, 0); + invertM33f (m4, 1e-6f); + invertM33f (m5, 1e-6f); } cout << "ok\n" << endl; diff --git a/src/ImathTest/testJacobiEigenSolver.cpp b/src/ImathTest/testJacobiEigenSolver.cpp index 9fef124c..b7d5d1b4 100644 --- a/src/ImathTest/testJacobiEigenSolver.cpp +++ b/src/ImathTest/testJacobiEigenSolver.cpp @@ -62,10 +62,10 @@ template void verifyOrthonormal (const TM& A, const typename TM::BaseType threshold) { - const TM prod = A * A.transposed(); - for (size_t i = 0; i < TM::dimensions(); ++i) - for (size_t j = 0; j < TM::dimensions(); ++j) - if (i == j) + const TM prod = A * A.transposed (); + for (unsigned int i = 0; i < TM::dimensions (); ++i) + for (unsigned int j = 0; j < TM::dimensions (); ++j) + if (i == j) assert (std::abs (prod[i][j] - 1) < threshold); else assert (std::abs (prod[i][j]) < threshold); @@ -78,9 +78,9 @@ computeThreshold(const TM& A) typedef typename TM::BaseType T; T maxAbsEntry(0); - for (size_t i = 0; i < TM::dimensions(); ++i) - for (size_t j = 0; j < TM::dimensions(); ++j) - maxAbsEntry = std::max (maxAbsEntry, std::abs(A[i][j])); + for (unsigned int i = 0; i < TM::dimensions (); ++i) + for (unsigned int j = 0; j < TM::dimensions (); ++j) + maxAbsEntry = std::max (maxAbsEntry, std::abs (A[i][j])); const T eps = std::numeric_limits::epsilon(); maxAbsEntry = std::max(maxAbsEntry, eps); @@ -113,9 +113,9 @@ testJacobiEigenSolver(const TM& A) // Determinant of A and S TM MS; - for (size_t i = 0; i < TM::dimensions(); ++i) - for (size_t j = 0; j < TM::dimensions(); ++j) - if(i == j) + for (unsigned int i = 0; i < TM::dimensions (); ++i) + for (unsigned int j = 0; j < TM::dimensions (); ++j) + if (i == j) MS[i][j] = S[i]; else MS[i][j] = 0; @@ -125,9 +125,9 @@ testJacobiEigenSolver(const TM& A) // A = V * S * V^T TM MA = V * MS * V.transposed(); - for (size_t i = 0; i < TM::dimensions(); ++i) - for (size_t j =0; j < TM::dimensions(); ++j) - assert(abs(A[i][j]-MA[i][j]) < threshold); + for (unsigned int i = 0; i < TM::dimensions (); ++i) + for (unsigned int j = 0; j < TM::dimensions (); ++j) + assert (abs (A[i][j] - MA[i][j]) < threshold); } template diff --git a/src/ImathTest/testLineAlgo.cpp b/src/ImathTest/testLineAlgo.cpp index 9872ac97..36b3bae0 100644 --- a/src/ImathTest/testLineAlgo.cpp +++ b/src/ImathTest/testLineAlgo.cpp @@ -342,8 +342,8 @@ testIntersect() do { - b.x = rand.nextf (0.001, 0.999); - b.y = rand.nextf (0.001, 0.999); + b.x = float(rand.nextf (0.001, 0.999)); + b.y = float(rand.nextf (0.001, 0.999)); b.z = 1 - b.x - b.y; } while (b.x + b.y > 0.999); @@ -384,8 +384,8 @@ testIntersect() do { - b.x = rand.nextf (-3, 3); - b.y = rand.nextf (-3, 3); + b.x = float(rand.nextf (-3, 3)); + b.y = float(rand.nextf (-3, 3)); b.z = 1 - b.x - b.y; } while (b.x > -0.001 && b.y > -0.001 && b.z > -0.001); diff --git a/src/ImathTest/testMiscMatrixAlgo.cpp b/src/ImathTest/testMiscMatrixAlgo.cpp index 675a2188..e9155478 100644 --- a/src/ImathTest/testMiscMatrixAlgo.cpp +++ b/src/ImathTest/testMiscMatrixAlgo.cpp @@ -30,26 +30,35 @@ namespace float rad (float deg) { - return deg * (M_PI / 180); + return deg * float(M_PI / 180); } void testComputeLocalFrame() { - float eps = 0.00005; + float eps = 0.00005f; Rand48 random (0); for (int i = 0; i < 100000; ++i) { debug (("iteration: %d\n", i)); // Random pos - V3f p (random.nextf (-10, 10), random.nextf (-10, 10), random.nextf (-10, 10)); + V3f p ( + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10))); // Random xDir - V3f xDir (random.nextf (-10, 10), random.nextf (-10, 10), random.nextf (-10, 10)); + V3f xDir ( + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10))); // Random normalDir - V3f normalDir (random.nextf (-10, 10), random.nextf (-10, 10), random.nextf (-10, 10)); + V3f normalDir ( + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10))); // Run computeLocalFrame we want to test M44f L = computeLocalFrame (p, xDir, normalDir); @@ -96,16 +105,21 @@ void getRandTRS (Rand48& random, V3f& trans, V3f& rot, V3f& scale) { // Translate - trans = V3f (random.nextf (-10, 10), random.nextf (-10, 10), random.nextf (-10, 10)); + trans = V3f ( + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10)), + float(random.nextf (-10, 10))); // Rotate - rot = V3f (rad (random.nextf (-180, 180)), - rad (random.nextf (-180, 180)), - rad (random.nextf (-180, 180))); + rot = V3f ( + rad (float(random.nextf (-180, 180))), + rad (float(random.nextf (-180, 180))), + rad (float(random.nextf (-180, 180)))); // Scale - V3f s (random.nextf (0.000001, 2.0), - random.nextf (0.000001, 2.0), - random.nextf (0.000001, 2.0)); + V3f s ( + float(random.nextf (0.000001, 2.0)), + float(random.nextf (0.000001, 2.0)), + float(random.nextf (0.000001, 2.0))); for (int j = 0; j < 3; j++) if (random.nextf (0.0, 1.0) >= 0.5) s[j] *= -1; @@ -124,9 +138,10 @@ createRandomMat (Rand48& random, V3f& trans, V3f& rot, V3f& scale) M.rotate (r); // Shear M. - V3f h (random.nextf (0.000001, 2.0), - random.nextf (0.000001, 2.0), - random.nextf (0.000001, 2.0)); + V3f h ( + float(random.nextf (0.000001, 2.0)), + float(random.nextf (0.000001, 2.0)), + float(random.nextf (0.000001, 2.0))); for (int j = 0; j < 3; j++) if (random.nextf (0.0, 1.0) >= 0.5) @@ -140,7 +155,7 @@ createRandomMat (Rand48& random, V3f& trans, V3f& rot, V3f& scale) // for (int j = 0; j < 4; ++j) for (int k = 0; k < 3; ++k) - M[j][k] += random.nextf (-1e-7, 1e-7); + M[j][k] += float(random.nextf (-1e-7, 1e-7)); V3f sh; extractSHRT (M, scale, sh, rot, trans); @@ -156,7 +171,7 @@ createRandomMat (Rand48& random, V3f& trans, V3f& rot, V3f& scale) void compareMat (M44f& M, M44f& N) { - float eps = 0.0001; + float eps = 0.0001f; /// Verify that the entries in M and N do not // differ too much. diff --git a/src/ImathTest/testProcrustes.cpp b/src/ImathTest/testProcrustes.cpp index ff1c032a..6aecb456 100644 --- a/src/ImathTest/testProcrustes.cpp +++ b/src/ImathTest/testProcrustes.cpp @@ -47,7 +47,7 @@ testTranslationRotationMatrix (const IMATH_INTERNAL_NAMESPACE::M44d& mat) const IMATH_INTERNAL_NAMESPACE::M44d m2 = procrustesRotationAndTranslation (&from[0], &to[0], numPoints); - const T eps = sizeof (T) == 8 ? 1e-8 : 1e-4; + const T eps = sizeof (T) == 8 ? T(1e-8) : T(1e-4); for (size_t i = 0; i < numPoints; ++i) { const IMATH_INTERNAL_NAMESPACE::V3d a = from[i]; @@ -74,13 +74,16 @@ testWithTranslateRotateAndScale (const IMATH_INTERNAL_NAMESPACE::M44d& m) std::vector from; std::vector weights; - const float eps = 1e-4; + const float eps = 1e-4f; std::cout << "numPoints: " << std::flush; for (size_t numPoints = 1; numPoints < 10; ++numPoints) { - from.push_back (V3 (rand.nextf(), rand.nextf(), rand.nextf())); - weights.push_back (rand.nextf()); - std::cout << from.size() << " "; + from.push_back (V3( + static_cast(rand.nextf()), + static_cast(rand.nextf()), + static_cast(rand.nextf()))); + weights.push_back(static_cast(rand.nextf())); + std::cout << from.size () << " "; std::vector to; for (size_t i = 0; i < from.size(); ++i) @@ -155,8 +158,8 @@ verifyProcrustes (const std::vector>& from, assert (std::abs (m1[i][j] - m2[i][j]) < eps); // Now try the weighted version: - for (size_t i = 0; i < weights.size(); ++i) - weights[i] = i + 1; + for (size_t i = 0; i < weights.size (); ++i) + weights[i] = static_cast(i + 1); IMATH_INTERNAL_NAMESPACE::M44d m = procrustesRotationAndTranslation (&from[0], &to[0], &weights[0], n); @@ -166,7 +169,7 @@ verifyProcrustes (const std::vector>& from, procrustesRotationAndTranslation (&from[0], &to[0], &weights[0], n, true); // Verify that it's orthonormal w/ positive determinant. - const T det = m.determinant(); + const T det = static_cast(m.determinant ()); assert (std::abs (det - T (1)) < eps); // Verify orthonormal: @@ -209,16 +212,16 @@ verifyProcrustes (const std::vector>& from, } // Try a small scale: - IMATH_INTERNAL_NAMESPACE::M44d newMat = ms; - const double scaleDiff = delta; - for (size_t i = 0; i < 3; ++i) - for (size_t j = 0; j < 3; ++j) + IMATH_INTERNAL_NAMESPACE::M44d newMat = ms; + const double scaleDiff = delta; + for (int i = 0; i < 3; ++i) + for (int j = 0; j < 3; ++j) newMat[i][j] = ms[i][j] * (1.0 + scaleDiff); assert (procrustesError (&from[0], &to[0], &weights[0], n, newMat) > procrustesError (&from[0], &to[0], &weights[0], n, ms)); - for (size_t i = 0; i < 3; ++i) - for (size_t j = 0; j < 3; ++j) + for (int i = 0; i < 3; ++i) + for (int j = 0; j < 3; ++j) newMat[i][j] = ms[i][j] * (1.0 - scaleDiff); assert (procrustesError (&from[0], &to[0], &weights[0], n, newMat) > procrustesError (&from[0], &to[0], &weights[0], n, ms)); @@ -342,10 +345,11 @@ testProcrustesImp() for (size_t i = 0; i < 4; ++i) { const T theta = T (2 * i) / T (M_PI); - fromPoints.push_back (IMATH_INTERNAL_NAMESPACE::Vec3 (cos (theta), sin (theta), 0)); - toPoints.push_back (IMATH_INTERNAL_NAMESPACE::Vec3 (cos (theta + M_PI / 3.0), - sin (theta + M_PI / 3.0), - 0)); + const T offset = T(M_PI / 3.0); + fromPoints.push_back ( + IMATH_INTERNAL_NAMESPACE::Vec3 (cos (theta), sin (theta), 0)); + toPoints.push_back (IMATH_INTERNAL_NAMESPACE::Vec3 ( + cos (theta + offset), sin (theta + offset), 0)); } verifyProcrustes (fromPoints, toPoints); @@ -356,10 +360,14 @@ testProcrustesImp() toPoints.clear(); for (size_t i = 0; i < numPoints; ++i) { - fromPoints.push_back ( - IMATH_INTERNAL_NAMESPACE::Vec3 (random.nextf(), random.nextf(), random.nextf())); - toPoints.push_back ( - IMATH_INTERNAL_NAMESPACE::Vec3 (random.nextf(), random.nextf(), random.nextf())); + fromPoints.push_back (IMATH_INTERNAL_NAMESPACE::Vec3 ( + static_cast(random.nextf ()), + static_cast(random.nextf ()), + static_cast(random.nextf ()))); + toPoints.push_back (IMATH_INTERNAL_NAMESPACE::Vec3 ( + static_cast(random.nextf ()), + static_cast(random.nextf ()), + static_cast(random.nextf ()))); } } verifyProcrustes (fromPoints, toPoints); @@ -377,7 +385,7 @@ testProcrustesImp() m = m * rot.toMatrix44(); testProcrustesWithMatrix (m); - m.scale (IMATH_INTERNAL_NAMESPACE::Vec3 (1.5, 6.4, 2.0)); + m.scale (IMATH_INTERNAL_NAMESPACE::Vec3 (T(1.5), T(6.4), T(2.0))); testProcrustesWithMatrix (m); IMATH_INTERNAL_NAMESPACE::Eulerd rot2 (1.0, M_PI, M_PI / 3.0); @@ -386,7 +394,7 @@ testProcrustesImp() m.scale (IMATH_INTERNAL_NAMESPACE::Vec3 (-1, 1, 1)); testProcrustesWithMatrix (m); - m.scale (IMATH_INTERNAL_NAMESPACE::Vec3 (1, 0.001, 1)); + m.scale (IMATH_INTERNAL_NAMESPACE::Vec3 (1, T(0.001), 1)); testProcrustesWithMatrix (m); m.scale (IMATH_INTERNAL_NAMESPACE::Vec3 (1, 1, 0)); diff --git a/src/ImathTest/testQuat.cpp b/src/ImathTest/testQuat.cpp index c513e789..db011879 100644 --- a/src/ImathTest/testQuat.cpp +++ b/src/ImathTest/testQuat.cpp @@ -94,12 +94,12 @@ testQuatT () // { - Quat q; - q.setAxisAngle (Vec3 (0, 0, 1), M_PI_2); - Vec3 v = q.axis(); - T a = q.angle(); - assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); - assert (IMATH_INTERNAL_NAMESPACE::equal (a, T (M_PI_2), e)); + Quat q; + q.setAxisAngle (Vec3 (0, 0, 1), T(M_PI_2)); + Vec3 v = q.axis (); + T a = q.angle (); + assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); + assert (IMATH_INTERNAL_NAMESPACE::equal (a, T (M_PI_2), e)); } // @@ -108,39 +108,39 @@ testQuatT () // { - T t = 10 * std::sqrt (s); - - Quat q; - q.setAxisAngle (Vec3 (0, 0, 1), t); - Vec3 v = q.axis(); - T a = q.angle(); - assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); - assert (IMATH_INTERNAL_NAMESPACE::equal (a, t, t * e)); - - q.r *= 1.1; - q.v *= 1.1; - v = q.axis(); - a = q.angle(); - assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); - assert (IMATH_INTERNAL_NAMESPACE::equal (a, t, t * e)); + T t = 10 * std::sqrt (s); + + Quat q; + q.setAxisAngle (Vec3 (0, 0, 1), t); + Vec3 v = q.axis (); + T a = q.angle (); + assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); + assert (IMATH_INTERNAL_NAMESPACE::equal (a, t, t * e)); + + q.r *= T(1.1); + q.v *= T(1.1); + v = q.axis (); + a = q.angle (); + assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); + assert (IMATH_INTERNAL_NAMESPACE::equal (a, t, t * e)); } { - T t = 0.001 * std::sqrt (s); - - Quat q; - q.setAxisAngle (Vec3 (0, 0, 1), t); - Vec3 v = q.axis(); - T a = q.angle(); - assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); - assert (IMATH_INTERNAL_NAMESPACE::equal (a, t, t * e)); - - q.r *= 1.1; - q.v *= 1.1; - v = q.axis(); - a = q.angle(); - assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); - assert (IMATH_INTERNAL_NAMESPACE::equal (a, t, t * e)); + T t = T(0.001) * std::sqrt (s); + + Quat q; + q.setAxisAngle (Vec3 (0, 0, 1), t); + Vec3 v = q.axis (); + T a = q.angle (); + assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); + assert (IMATH_INTERNAL_NAMESPACE::equal (a, t, t * e)); + + q.r *= T(1.1); + q.v *= T(1.1); + v = q.axis (); + a = q.angle (); + assert (v.equalWithAbsError (Vec3 (0, 0, 1), e)); + assert (IMATH_INTERNAL_NAMESPACE::equal (a, t, t * e)); } // diff --git a/src/ImathTest/testQuatSetRotation.cpp b/src/ImathTest/testQuatSetRotation.cpp index 23c64bad..7b226a4c 100644 --- a/src/ImathTest/testQuatSetRotation.cpp +++ b/src/ImathTest/testQuatSetRotation.cpp @@ -116,8 +116,8 @@ randomVectors() for (int i = 0; i < 500000; ++i) { - V3f from = hollowSphereRand (rand) * rand.nextf (0.1, 10.0); - V3f to = hollowSphereRand (rand) * rand.nextf (0.1, 10.0); + V3f from = hollowSphereRand (rand) * float(rand.nextf (0.1, 10.0)); + V3f to = hollowSphereRand (rand) * float(rand.nextf (0.1, 10.0)); testRotation (from, to); } } diff --git a/src/ImathTest/testQuatSlerp.cpp b/src/ImathTest/testQuatSlerp.cpp index 0822bf6a..b1c47f86 100644 --- a/src/ImathTest/testQuatSlerp.cpp +++ b/src/ImathTest/testQuatSlerp.cpp @@ -93,7 +93,7 @@ specificRotations() for (int n1 = 0; n1 < 4; ++n1) { - float angle1 = n1 * M_PI / 2; + float angle1 = n1 * float(M_PI / 2); Quatf q1; q1.setAxisAngle (axis1, angle1); @@ -105,7 +105,7 @@ specificRotations() for (int n2 = 0; n2 < 4; ++n2) { - float angle2 = n2 * M_PI / 2; + float angle2 = n2 * float(M_PI / 2); Quatf q2; q2.setAxisAngle (axis2, angle2); @@ -133,10 +133,10 @@ randomRotations() for (int i = 0; i < 10000; ++i) { - V3f axis1 = hollowSphereRand (rand); - V3f axis2 = hollowSphereRand (rand); - float angle1 = rand.nextf (0, M_PI); - float angle2 = rand.nextf (0, M_PI); + V3f axis1 = hollowSphereRand (rand); + V3f axis2 = hollowSphereRand (rand); + float angle1 = float(rand.nextf (0, M_PI)); + float angle2 = float(rand.nextf (0, M_PI)); Quatf q1, q2; q1.setAxisAngle (axis1, angle1); diff --git a/src/ImathTest/testRandom.cpp b/src/ImathTest/testRandom.cpp index e0c06e9d..0720d1dc 100644 --- a/src/ImathTest/testRandom.cpp +++ b/src/ImathTest/testRandom.cpp @@ -90,7 +90,7 @@ testGenerator() for (int i = 0; i < M * N; ++i) { - float r = rand.nextf (0.0, 1.0); + float r = float(rand.nextf (0.0, 1.0)); float diff = r - previous; previous = r; diff --git a/src/ImathTest/testTinySVD.cpp b/src/ImathTest/testTinySVD.cpp index 4c3be663..b2f1911c 100644 --- a/src/ImathTest/testTinySVD.cpp +++ b/src/ImathTest/testTinySVD.cpp @@ -262,75 +262,85 @@ testTinySVDImp() testTinySVD_3x3 (0, 0, 0, 0, 0, 0, 0, 0, 1); testTinySVD_3x3 (1, 0, 0, 0, 1, 0, 0, 0, 0); testTinySVD_3x3 (1, 0, 0, 0, 0, 0, 0, 0, 0); - testTinySVD_3x3 (1, 0, 0, 1e-10, 0, 0, 0, 0, 0); - testTinySVD_3x3 (1, 0, 0, 1e-10, 0, 0, 0, 0, 100000); + testTinySVD_3x3 (1, 0, 0, T(1e-10), 0, 0, 0, 0, 0); + testTinySVD_3x3 (1, 0, 0, T(1e-10), 0, 0, 0, 0, 100000); testTinySVD_3x3 (1, 2, 3, 4, 5, 6, 7, 8, 9); testTinySVD_3x3 (1, 2, 3, 4, 5, 6, 7, 8, 9); - testTinySVD_3x3 (outerProduct (IMATH_INTERNAL_NAMESPACE::Vec3 (100, 1e-5, 0), - IMATH_INTERNAL_NAMESPACE::Vec3 (100, 1e-5, 0))); - testTinySVD_3x3 (outerProduct (IMATH_INTERNAL_NAMESPACE::Vec3 (245, 20, 1), - IMATH_INTERNAL_NAMESPACE::Vec3 (256, 300, 20))); - testTinySVD_3x3 (outerProduct (IMATH_INTERNAL_NAMESPACE::Vec3 (245, 20, 1), - IMATH_INTERNAL_NAMESPACE::Vec3 (245, 20, 1)) + - outerProduct (IMATH_INTERNAL_NAMESPACE::Vec3 (1, 2, 3), - IMATH_INTERNAL_NAMESPACE::Vec3 (1, 2, 3))); + testTinySVD_3x3 (outerProduct ( + IMATH_INTERNAL_NAMESPACE::Vec3 (100, T(1e-5), 0), + IMATH_INTERNAL_NAMESPACE::Vec3 (100, T(1e-5), 0))); + testTinySVD_3x3 (outerProduct ( + IMATH_INTERNAL_NAMESPACE::Vec3 (245, 20, 1), + IMATH_INTERNAL_NAMESPACE::Vec3 (256, 300, 20))); + testTinySVD_3x3 ( + outerProduct ( + IMATH_INTERNAL_NAMESPACE::Vec3 (245, 20, 1), + IMATH_INTERNAL_NAMESPACE::Vec3 (245, 20, 1)) + + outerProduct ( + IMATH_INTERNAL_NAMESPACE::Vec3 (1, 2, 3), + IMATH_INTERNAL_NAMESPACE::Vec3 (1, 2, 3))); // Some problematic matrices from SVDTest: - testTinySVD_3x3 (0.0023588321752040036, - -0.0096558131480729038, - 0.0010959850449366493, - 0.0088671829608044754, - 0.0016771794267033666, - -0.0043081475729438235, - 0.003976050440932701, - 0.0019880497026345716, - 0.0089576046614601966); - testTinySVD_3x3 (2.3588321752040035e-09, - -9.6558131480729038e-09, - 1.0959850449366498e-09, - 8.8671829608044748e-09, - 1.6771794267033661e-09, - -4.3081475729438225e-09, - 3.9760504409327016e-09, - 1.9880497026345722e-09, - 8.9576046614601957e-09); - testTinySVD_3x3 (-0.46673855799602715, - 0.67466260360310948, - 0.97646986796448998, - -0.032460753747103721, - 0.046584527749418278, - 0.067431228641151142, - -0.088885055229687815, - 0.1280389179308779, - 0.18532617511453064); - testTinySVD_3x3 (1e-8, 0, 0, 0, 1e-8, 0, 0, 0, 1e-8); - testTinySVD_3x3 (1, 0, 0, 0, .00036, 0, 1e-18, 0, .00018); - testTinySVD_3x3 (1.3, 0, 0, 0, .0003, 0, 1e-17, 0, 0); - testTinySVD_3x3 (1, 0, 0, 0, 1e-2, 0, 0, 0, 1e-2); + testTinySVD_3x3 ( + T(0.0023588321752040036), + T(-0.0096558131480729038), + T(0.0010959850449366493), + T(0.0088671829608044754), + T(0.0016771794267033666), + T(-0.0043081475729438235), + T(0.003976050440932701), + T(0.0019880497026345716), + T(0.0089576046614601966)); + testTinySVD_3x3 ( + T(2.3588321752040035e-09), + T(-9.6558131480729038e-09), + T(1.0959850449366498e-09), + T(8.8671829608044748e-09), + T(1.6771794267033661e-09), + T(-4.3081475729438225e-09), + T(3.9760504409327016e-09), + T(1.9880497026345722e-09), + T(8.9576046614601957e-09)); + testTinySVD_3x3 ( + T(-0.46673855799602715), + T(0.67466260360310948), + T(0.97646986796448998), + T(-0.032460753747103721), + T(0.046584527749418278), + T(0.067431228641151142), + T(-0.088885055229687815), + T(0.1280389179308779), + T(0.18532617511453064)); + testTinySVD_3x3 (T(1e-8), 0, 0, 0, T(1e-8), 0, 0, 0, T(1e-8)); + testTinySVD_3x3 (1, 0, 0, 0, T(.00036), 0, T(1e-18), 0, T(.00018)); + testTinySVD_3x3 (T(1.3), 0, 0, 0, T(.0003), 0, T(1e-17), 0, 0); + testTinySVD_3x3 (1, 0, 0, 0, T(1e-2), 0, 0, 0, T(1e-2)); testTinySVD_3x3 (1, 0, 0, 0, 1, 0, 0, 0, 0); - testTinySVD_3x3 (1, 0, 0, 0, 1e-3, 0, 0, 0, 1e-6); - testTinySVD_3x3 (0.59588638570136332, - -0.79761234126107794, - -1, - 0.39194500425202045, - 0.91763115383440363, - -0.341818175044664, - -0.45056075218951946, - -0.71259057727425101, - 0.47125008216720271); - testTinySVD_3x3 (4.38805348e-09, - -2.53189691e-09, - -4.65678607e-09, - -3.23000099e-10, - 1.86370294e-10, - 3.42781192e-10, - -4.61572824e-09, - 2.6632645e-09, - 4.89840346e-09); + testTinySVD_3x3 (1, 0, 0, 0, T(1e-3), 0, 0, 0, T(1e-6)); + testTinySVD_3x3 ( + T(0.59588638570136332), + T(-0.79761234126107794), + -1, + T(0.39194500425202045), + T(0.91763115383440363), + T(-0.341818175044664), + T(-0.45056075218951946), + T(-0.71259057727425101), + T(0.47125008216720271)); + testTinySVD_3x3 ( + T(4.38805348e-09), + T(-2.53189691e-09), + T(-4.65678607e-09), + T(-3.23000099e-10), + T(1.86370294e-10), + T(3.42781192e-10), + T(-4.61572824e-09), + T(2.6632645e-09), + T(4.89840346e-09)); // problematic 2x2 one for lapack on suse (see below), padded with 0's - testTinySVD_3x3 (0, -1.00000003e-22, 0, 1.00000001e-07, 0, 0, 0, 0, 0); + testTinySVD_3x3 (0, T(-1.00000003e-22), 0, T(1.00000001e-07), 0, 0, 0, 0, 0); // problematic 2x2 one for lapack on suse (see below), padded with 0's and 1 - testTinySVD_3x3 (0, -1.00000003e-22, 0, 1.00000001e-07, 0, 0, 0, 0, 1); + testTinySVD_3x3 (0, T(-1.00000003e-22), 0, T(1.00000001e-07), 0, 0, 0, 0, 1); // Now, 4x4 matrices: testTinySVD_4x4 (1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); @@ -340,15 +350,36 @@ testTinySVDImp() testTinySVD_4x4 (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); testTinySVD_4x4 (1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); testTinySVD_4x4 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); - testTinySVD_4x4 (0, -1.00000003e-22, 0, 0, 00000001e-07, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); - testTinySVD_4x4 (outerProduct (IMATH_INTERNAL_NAMESPACE::Vec4 (100, 1e-5, 0, 0), - IMATH_INTERNAL_NAMESPACE::Vec4 (100, 1e-5, 0, 0))); - testTinySVD_4x4 (outerProduct (IMATH_INTERNAL_NAMESPACE::Vec4 (245, 20, 1, 0.5), - IMATH_INTERNAL_NAMESPACE::Vec4 (256, 300, 20, 10))); - testTinySVD_4x4 (outerProduct (IMATH_INTERNAL_NAMESPACE::Vec4 (245, 20, 1, 0.5), - IMATH_INTERNAL_NAMESPACE::Vec4 (256, 300, 20, 10)) + - outerProduct (IMATH_INTERNAL_NAMESPACE::Vec4 (30, 10, 10, 10), - IMATH_INTERNAL_NAMESPACE::Vec4 (1, 2, 3, 3))); + testTinySVD_4x4 ( + 0, + T(-1.00000003e-22), + 0, + 0, + T(00000001e-07), + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1); + testTinySVD_4x4 (outerProduct ( + IMATH_INTERNAL_NAMESPACE::Vec4 (100, T(1e-5), 0, 0), + IMATH_INTERNAL_NAMESPACE::Vec4 (100, T(1e-5), 0, 0))); + testTinySVD_4x4 (outerProduct ( + IMATH_INTERNAL_NAMESPACE::Vec4 (245, 20, 1, T(0.5)), + IMATH_INTERNAL_NAMESPACE::Vec4 (256, 300, 20, 10))); + testTinySVD_4x4 ( + outerProduct ( + IMATH_INTERNAL_NAMESPACE::Vec4 (245, 20, 1, T(0.5)), + IMATH_INTERNAL_NAMESPACE::Vec4 (256, 300, 20, 10)) + + outerProduct ( + IMATH_INTERNAL_NAMESPACE::Vec4 (30, 10, 10, 10), + IMATH_INTERNAL_NAMESPACE::Vec4 (1, 2, 3, 3))); } void