From 2113299f5493456449fae7e0968be0bcc9d90622 Mon Sep 17 00:00:00 2001 From: cao-fei8 Date: Thu, 5 Jan 2023 20:41:39 +0800 Subject: [PATCH] Run clang-format over repository Signed-off-by: cao-fei8 --- ...mat-Run-clang-format-over-repository.patch | 28280 ++++++++++++++++ Imath.spec | 6 +- 2 files changed, 28285 insertions(+), 1 deletion(-) create mode 100644 0001-reformat-Run-clang-format-over-repository.patch diff --git a/0001-reformat-Run-clang-format-over-repository.patch b/0001-reformat-Run-clang-format-over-repository.patch new file mode 100644 index 0000000..158af3b --- /dev/null +++ b/0001-reformat-Run-clang-format-over-repository.patch @@ -0,0 +1,28280 @@ +From 338c9a051c5b7569bbb06f200618feaba59a14c6 Mon Sep 17 00:00:00 2001 +From: Kimball Thurston +Date: Sat, 12 Feb 2022 16:25:26 +1300 +Subject: [PATCH] [reformat] Run clang-format over repository + +Signed-off-by: Kimball Thurston +--- + .clang-format | 45 +- + config/ImathConfig.h.in | 66 +- + docs/examples/Box.cpp | 24 +- + docs/examples/Color3.cpp | 12 +- + docs/examples/Color4.cpp | 12 +- + docs/examples/Euler.cpp | 7 +- + docs/examples/Frustum.cpp | 14 +- + docs/examples/Interval.cpp | 14 +- + docs/examples/Line3.cpp | 17 +- + docs/examples/Matrix22.cpp | 10 +- + docs/examples/Matrix33.cpp | 13 +- + docs/examples/Matrix44.cpp | 16 +- + docs/examples/Plane3.cpp | 8 +- + docs/examples/Quat.cpp | 4 +- + docs/examples/Shear6.cpp | 4 +- + docs/examples/Sphere3.cpp | 15 +- + docs/examples/Vec2.cpp | 12 +- + docs/examples/Vec3.cpp | 12 +- + docs/examples/Vec4.cpp | 12 +- + docs/examples/gl.cpp | 3 +- + docs/examples/half.c | 7 +- + docs/examples/half.cpp | 5 +- + docs/examples/main.cpp | 72 +- + src/Imath/ImathBox.h | 418 +++-- + src/Imath/ImathBoxAlgo.h | 119 +- + src/Imath/ImathColor.h | 234 ++- + src/Imath/ImathColorAlgo.cpp | 136 +- + src/Imath/ImathColorAlgo.h | 98 +- + src/Imath/ImathEuler.h | 341 ++-- + src/Imath/ImathExport.h | 55 +- + src/Imath/ImathForward.h | 2 +- + src/Imath/ImathFrame.h | 74 +- + src/Imath/ImathFrustum.h | 353 ++-- + src/Imath/ImathFrustumTest.h | 183 ++- + src/Imath/ImathFun.cpp | 14 +- + src/Imath/ImathFun.h | 14 +- + src/Imath/ImathGL.h | 30 +- + src/Imath/ImathGLU.h | 18 +- + src/Imath/ImathInt64.h | 12 +- + src/Imath/ImathInterval.h | 95 +- + src/Imath/ImathLine.h | 52 +- + src/Imath/ImathLineAlgo.h | 81 +- + src/Imath/ImathMath.h | 45 +- + src/Imath/ImathMatrix.h | 2008 ++++++++++++++--------- + src/Imath/ImathMatrixAlgo.cpp | 506 +++--- + src/Imath/ImathMatrixAlgo.h | 547 +++--- + src/Imath/ImathNamespace.h | 16 +- + src/Imath/ImathPlane.h | 97 +- + src/Imath/ImathPlatform.h | 37 +- + src/Imath/ImathQuat.h | 353 ++-- + src/Imath/ImathRandom.cpp | 14 +- + src/Imath/ImathRandom.h | 71 +- + src/Imath/ImathRoots.h | 45 +- + src/Imath/ImathShear.h | 158 +- + src/Imath/ImathSphere.h | 31 +- + src/Imath/ImathTypeTraits.h | 164 +- + src/Imath/ImathVec.h | 1109 ++++++++----- + src/Imath/ImathVecAlgo.h | 28 +- + src/Imath/half.cpp | 16 +- + src/Imath/half.h | 148 +- + src/Imath/halfFunction.h | 46 +- + src/Imath/halfLimits.h | 79 +- + src/Imath/toFloat.cpp | 5 +- + src/ImathTest/half_c_main.c | 59 +- + src/ImathTest/half_perf_test.cpp | 96 +- + src/ImathTest/main.cpp | 17 +- + src/ImathTest/testArithmetic.cpp | 10 +- + src/ImathTest/testArithmetic.h | 2 +- + src/ImathTest/testBitPatterns.cpp | 566 ++++--- + src/ImathTest/testBitPatterns.h | 2 +- + src/ImathTest/testBox.cpp | 228 +-- + src/ImathTest/testBox.h | 2 +- + src/ImathTest/testBoxAlgo.cpp | 337 ++-- + src/ImathTest/testBoxAlgo.h | 2 +- + src/ImathTest/testClassification.cpp | 95 +- + src/ImathTest/testClassification.h | 2 +- + src/ImathTest/testColor.cpp | 129 +- + src/ImathTest/testColor.h | 2 +- + src/ImathTest/testError.cpp | 78 +- + src/ImathTest/testError.h | 6 +- + src/ImathTest/testExtractEuler.cpp | 45 +- + src/ImathTest/testExtractEuler.h | 2 +- + src/ImathTest/testExtractSHRT.cpp | 76 +- + src/ImathTest/testExtractSHRT.h | 2 +- + src/ImathTest/testFrustum.cpp | 238 +-- + src/ImathTest/testFrustum.h | 2 +- + src/ImathTest/testFrustumTest.cpp | 80 +- + src/ImathTest/testFrustumTest.h | 2 +- + src/ImathTest/testFun.cpp | 311 ++-- + src/ImathTest/testFun.h | 2 +- + src/ImathTest/testFunction.cpp | 37 +- + src/ImathTest/testFunction.h | 2 +- + src/ImathTest/testInterop.cpp | 632 +++---- + src/ImathTest/testInterop.h | 2 +- + src/ImathTest/testInterval.cpp | 148 +- + src/ImathTest/testInterval.h | 2 +- + src/ImathTest/testInvert.cpp | 41 +- + src/ImathTest/testInvert.h | 2 +- + src/ImathTest/testJacobiEigenSolver.cpp | 259 +-- + src/ImathTest/testJacobiEigenSolver.h | 2 +- + src/ImathTest/testLimits.cpp | 147 +- + src/ImathTest/testLimits.h | 4 +- + src/ImathTest/testLineAlgo.cpp | 456 ++--- + src/ImathTest/testLineAlgo.h | 2 +- + src/ImathTest/testMatrix.cpp | 552 ++++--- + src/ImathTest/testMatrix.h | 2 +- + src/ImathTest/testMiscMatrixAlgo.cpp | 108 +- + src/ImathTest/testMiscMatrixAlgo.h | 2 +- + src/ImathTest/testProcrustes.cpp | 222 +-- + src/ImathTest/testProcrustes.h | 2 +- + src/ImathTest/testQuat.cpp | 183 ++- + src/ImathTest/testQuat.h | 2 +- + src/ImathTest/testQuatSetRotation.cpp | 38 +- + src/ImathTest/testQuatSetRotation.h | 2 +- + src/ImathTest/testQuatSlerp.cpp | 22 +- + src/ImathTest/testQuatSlerp.h | 2 +- + src/ImathTest/testRandom.cpp | 63 +- + src/ImathTest/testRandom.h | 2 +- + src/ImathTest/testRoots.cpp | 84 +- + src/ImathTest/testRoots.h | 2 +- + src/ImathTest/testShear.cpp | 187 ++- + src/ImathTest/testShear.h | 2 +- + src/ImathTest/testSize.cpp | 6 +- + src/ImathTest/testSize.h | 2 +- + src/ImathTest/testTinySVD.cpp | 282 ++-- + src/ImathTest/testTinySVD.h | 2 +- + src/ImathTest/testToFloat.cpp | 12 +- + src/ImathTest/testToFloat.h | 2 +- + src/ImathTest/testVec.cpp | 238 +-- + src/ImathTest/testVec.h | 2 +- + src/python/config/PyImathConfig.h.in | 1 - + 131 files changed, 7991 insertions(+), 6418 deletions(-) + +diff --git a/.clang-format b/.clang-format +index 1f6f585..df4ff7b 100644 +--- a/.clang-format ++++ b/.clang-format +@@ -1,21 +1,23 @@ + --- + Language: Cpp +-BasedOnStyle: LLVM +-AccessModifierOffset: -2 +-AlignAfterOpenBracket: Align ++# BasedOnStyle: LLVM ++AccessModifierOffset: -4 ++AlignAfterOpenBracket: AlwaysBreak + AlignConsecutiveAssignments: true +-AlignConsecutiveDeclarations: false ++AlignConsecutiveDeclarations: true + AlignEscapedNewlines: Right + AlignOperands: true + AlignTrailingComments: true +-AllowAllArgumentsOnNextLine: false +-AllowAllConstructorInitializersOnNextLine: true +-AllowAllParametersOfDeclarationOnNextLine: false +-AllowShortBlocksOnASingleLine: false +-AllowShortCaseLabelsOnASingleLine: false ++# AllowAllArgumentsOnNextLine: true ++AllowAllParametersOfDeclarationOnNextLine: true ++# AllowAllConstructorInitializersOnNextLine: true ++AllowShortBlocksOnASingleLine: true ++AllowShortCaseLabelsOnASingleLine: true + AllowShortFunctionsOnASingleLine: InlineOnly +-AllowShortIfStatementsOnASingleLine: false ++AllowShortIfStatementsOnASingleLine: true + AllowShortLoopsOnASingleLine: false ++# AllowShortLambdasOnASingleLine: true ++# ArrayInitializerAlignmentStyle: Left + AlwaysBreakAfterDefinitionReturnType: TopLevel + AlwaysBreakAfterReturnType: None + AlwaysBreakBeforeMultilineStrings: false +@@ -23,7 +25,6 @@ AlwaysBreakTemplateDeclarations: MultiLine + BinPackArguments: false + BinPackParameters: false + BraceWrapping: +- AfterCaseLabel: true + AfterClass: true + AfterControlStatement: true + AfterEnum: true +@@ -44,16 +45,17 @@ BreakBeforeBraces: Custom + BreakBeforeInheritanceComma: false + BreakInheritanceList: BeforeColon + BreakBeforeTernaryOperators: true +-BreakConstructorInitializers: BeforeColon ++BreakConstructorInitializersBeforeComma: true ++BreakConstructorInitializers: BeforeComma + BreakAfterJavaFieldAnnotations: false + BreakStringLiterals: false +-ColumnLimit: 100 ++ColumnLimit: 80 + CommentPragmas: '^ IWYU pragma:' + CompactNamespaces: false + ConstructorInitializerAllOnOneLineOrOnePerLine: true + ConstructorInitializerIndentWidth: 4 + ContinuationIndentWidth: 4 +-Cpp11BracedListStyle: false ++Cpp11BracedListStyle: true + DerivePointerAlignment: false + DisableFormat: false + FixNamespaceComments: true +@@ -70,7 +72,7 @@ IncludeCategories: + - Regex: '.*' + Priority: 1 + IncludeIsMainRegex: '(Test|_test)?$' +-IndentCaseLabels: false ++IndentCaseLabels: true + IndentPPDirectives: AfterHash + IndentWidth: 4 + IndentWrappedFunctionNames: false +@@ -85,7 +87,7 @@ ObjCBinPackProtocolList: Auto + ObjCBlockIndentWidth: 4 + ObjCSpaceAfterProperty: true + ObjCSpaceBeforeProtocolList: true +-PenaltyBreakAssignment: 8 ++PenaltyBreakAssignment: 4 + PenaltyBreakBeforeFirstCallParameter: 8 + PenaltyBreakComment: 1000 + PenaltyBreakFirstLessLess: 120 +@@ -100,12 +102,11 @@ SortUsingDeclarations: true + SpaceAfterCStyleCast: true + SpaceAfterTemplateKeyword: true + SpaceBeforeAssignmentOperators: true +-SpaceBeforeCpp11BracedList: true ++SpaceBeforeCpp11BracedList: false + SpaceBeforeCtorInitializerColon: true + SpaceBeforeInheritanceColon: true +-SpaceBeforeParens: NonEmptyParentheses +-SpaceBeforeRangeBasedForLoopColon: true +-SpaceInEmptyBlock: false ++SpaceBeforeParens: Always ++SpaceBeforeRangeBasedForLoopColon: false + SpaceInEmptyParentheses: false + SpacesBeforeTrailingComments: 1 + SpacesInAngles: false +@@ -113,8 +114,8 @@ SpacesInContainerLiterals: true + SpacesInCStyleCastParentheses: false + SpacesInParentheses: false + SpacesInSquareBrackets: false +-SpacesInConditionalStatement: false + Standard: Cpp11 +-TabWidth: 4 ++TabWidth: 8 ++#UseTab: ForIndentation + UseTab: Never + ... +diff --git a/config/ImathConfig.h.in b/config/ImathConfig.h.in +index ec29c7f..132f623 100644 +--- a/config/ImathConfig.h.in ++++ b/config/ImathConfig.h.in +@@ -12,6 +12,9 @@ + // Options / configuration based on O.S. / compiler + // + ++// automated formatting does not handle the cmake tags well ++// clang-format off ++ + // + // Define whether the half-to-float conversion should use the lookup + // table method. Note that this is overriden by F16C compiler +@@ -51,13 +54,16 @@ + #define IMATH_VERSION_PATCH @Imath_VERSION_PATCH@ + #define IMATH_VERSION_RELEASE_TYPE "@IMATH_VERSION_RELEASE_TYPE@" + +-#define IMATH_VERSION_HEX ((uint32_t(IMATH_VERSION_MAJOR) << 24) | \ +- (uint32_t(IMATH_VERSION_MINOR) << 16) | \ +- (uint32_t(IMATH_VERSION_PATCH) << 8)) ++#define IMATH_VERSION_HEX \ ++ ((uint32_t (IMATH_VERSION_MAJOR) << 24) | \ ++ (uint32_t (IMATH_VERSION_MINOR) << 16) | \ ++ (uint32_t (IMATH_VERSION_PATCH) << 8)) + + // IMATH_LIB_VERSION is the library API version: SOCURRENT.SOAGE.SOREVISION + #define IMATH_LIB_VERSION_STRING "@IMATH_LIB_VERSION@" + ++// clang-format on ++ + // + // Code that depends on the v2 ExcMath mechanism of signal handlers + // that throw exceptions is incompatible with noexcept, since +@@ -69,9 +75,9 @@ + + #cmakedefine01 IMATH_USE_NOEXCEPT + #if IMATH_USE_NOEXCEPT +-#define IMATH_NOEXCEPT noexcept ++# define IMATH_NOEXCEPT noexcept + #else +-#define IMATH_NOEXCEPT ++# define IMATH_NOEXCEPT + #endif + + // +@@ -84,25 +90,23 @@ + // templates from compiling correctly. + // + #ifndef IMATH_FOREIGN_VECTOR_INTEROP +-# if defined(__GNUC__) && __GNUC__ == 4 && !defined(__clang__) +-# define IMATH_FOREIGN_VECTOR_INTEROP 0 +-# else +-# define IMATH_FOREIGN_VECTOR_INTEROP 1 +-# endif ++# if defined(__GNUC__) && __GNUC__ == 4 && !defined(__clang__) ++# define IMATH_FOREIGN_VECTOR_INTEROP 0 ++# else ++# define IMATH_FOREIGN_VECTOR_INTEROP 1 ++# endif + #endif + +- + // + // Decorator that makes a function available for both CPU and GPU, when + // compiling for Cuda. + // + #ifdef __CUDACC__ +- #define IMATH_HOSTDEVICE __host__ __device__ ++# define IMATH_HOSTDEVICE __host__ __device__ + #else +- #define IMATH_HOSTDEVICE ++# define IMATH_HOSTDEVICE + #endif + +- + // + // Some compilers define a special intrinsic to use in conditionals that can + // speed up extremely performance-critical spots if the conditional is +@@ -118,38 +122,37 @@ + // + #if defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER) + # ifdef __cplusplus +-# define IMATH_LIKELY(x) (__builtin_expect(static_cast(x), true)) +-# define IMATH_UNLIKELY(x) (__builtin_expect(static_cast(x), false)) ++# define IMATH_LIKELY(x) (__builtin_expect (static_cast (x), true)) ++# define IMATH_UNLIKELY(x) \ ++ (__builtin_expect (static_cast (x), false)) + # else +-# define IMATH_LIKELY(x) (__builtin_expect((x), 1)) +-# define IMATH_UNLIKELY(x) (__builtin_expect((x), 0)) ++# define IMATH_LIKELY(x) (__builtin_expect ((x), 1)) ++# define IMATH_UNLIKELY(x) (__builtin_expect ((x), 0)) + # endif + #else + # define IMATH_LIKELY(x) (x) + # define IMATH_UNLIKELY(x) (x) + #endif + +- + // On modern versions of gcc & clang, __has_attribute can test support for + // __attribute__((attr)). Make sure it's safe for other compilers. + #ifndef __has_attribute + # define __has_attribute(x) 0 + #endif + +- + // + // Simple way to mark things as deprecated. + // When we are sure that C++14 is our true minimum, then we can just + // directly use [[deprecated(msg)]]. + // + #if defined(_MSC_VER) +-# define IMATH_DEPRECATED(msg) __declspec(deprecated(msg)) ++# define IMATH_DEPRECATED(msg) __declspec(deprecated (msg)) + #elif defined(__cplusplus) && __cplusplus >= 201402L +-# define IMATH_DEPRECATED(msg) [[deprecated(msg)]] ++# define IMATH_DEPRECATED(msg) [[deprecated (msg)]] + #elif defined(__GNUC__) || defined(__clang__) +-# define IMATH_DEPRECATED(msg) __attribute__((deprecated(msg))) ++# define IMATH_DEPRECATED(msg) __attribute__ ((deprecated (msg))) + #else +-# define IMATH_DEPRECATED(msg) /* unsupported on this platform */ ++# define IMATH_DEPRECATED(msg) /* unsupported on this platform */ + #endif + + // Whether the user configured the library to have symbol visibility +@@ -159,13 +162,16 @@ + // MSVC does not do the same visibility attributes, and when we are + // compiling a static library we won't be in DLL mode, but just don't + // define these and the export headers will work out +-#if ! defined(_MSC_VER) && defined(IMATH_ENABLE_API_VISIBILITY) +-# define IMATH_PUBLIC_SYMBOL_ATTRIBUTE __attribute__ ((__visibility__ ("default"))) +-# define IMATH_PRIVATE_SYMBOL_ATTRIBUTE __attribute__ ((__visibility__ ("hidden"))) ++#if !defined(_MSC_VER) && defined(IMATH_ENABLE_API_VISIBILITY) ++# define IMATH_PUBLIC_SYMBOL_ATTRIBUTE \ ++ __attribute__ ((__visibility__ ("default"))) ++# define IMATH_PRIVATE_SYMBOL_ATTRIBUTE \ ++ __attribute__ ((__visibility__ ("hidden"))) + // clang differs from gcc and has type visibility which is needed for enums and templates +-# if __has_attribute(__type_visibility__) +-# define IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE __attribute__ ((__type_visibility__ ("default"))) +-# endif ++# if __has_attribute(__type_visibility__) ++# define IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE \ ++ __attribute__ ((__type_visibility__ ("default"))) ++# endif + #endif + + #endif // INCLUDED_IMATH_CONFIG_H +diff --git a/docs/examples/Box.cpp b/docs/examples/Box.cpp +index 8d2fa28..5f58f48 100644 +--- a/docs/examples/Box.cpp ++++ b/docs/examples/Box.cpp +@@ -1,25 +1,25 @@ + #include +- ++ + void +-box_example() ++box_example () + { +- Imath::V3f a (0, 0, 0); +- Imath::V3f b (1, 1, 1); +- Imath::V3f c (2, 9, 2); ++ Imath::V3f a (0, 0, 0); ++ Imath::V3f b (1, 1, 1); ++ Imath::V3f c (2, 9, 2); + + Imath::Box3f box (a); + +- assert (box.isEmpty()); +- assert (!box.isInfinite()); +- assert (!box.hasVolume()); +- ++ assert (box.isEmpty ()); ++ assert (!box.isInfinite ()); ++ assert (!box.hasVolume ()); ++ + box.extendBy (c); + +- assert (box.size() == (c-a)); ++ assert (box.size () == (c - a)); + assert (box.intersects (b)); + assert (box.max[0] > box.min[0]); + assert (box.max[1] > box.min[1]); + assert (box.max[2] > box.min[2]); +- assert (box.hasVolume()); +- assert (box.majorAxis() == 1); ++ assert (box.hasVolume ()); ++ assert (box.majorAxis () == 1); + } +diff --git a/docs/examples/Color3.cpp b/docs/examples/Color3.cpp +index 493efcb..4eee221 100644 +--- a/docs/examples/Color3.cpp ++++ b/docs/examples/Color3.cpp +@@ -1,13 +1,13 @@ + #include + + void +-color3_example() ++color3_example () + { +- Imath::C3c r (255, 0, 0); +- Imath::C3c g (0, 255, 0); +- Imath::C3c b (0, 0, 255); +- +- Imath::C3c c = r + g + b; ++ Imath::C3c r (255, 0, 0); ++ Imath::C3c g (0, 255, 0); ++ Imath::C3c b (0, 0, 255); ++ ++ Imath::C3c c = r + g + b; + + assert (c.x == 255); + assert (c.x == 255); +diff --git a/docs/examples/Color4.cpp b/docs/examples/Color4.cpp +index e5fb5d3..882cc73 100644 +--- a/docs/examples/Color4.cpp ++++ b/docs/examples/Color4.cpp +@@ -1,13 +1,13 @@ + #include + + void +-color4_example() ++color4_example () + { +- Imath::C4f r (1.0f, 0.0f, 0.0f, 1.0f); +- Imath::C4f g (0.0f, 1.0f, 0.0f, 1.0f); +- Imath::C4f b (0.0f, 0.0f, 1.0f, 1.0f); +- +- Imath::C4f w = r + g + b; ++ Imath::C4f r (1.0f, 0.0f, 0.0f, 1.0f); ++ Imath::C4f g (0.0f, 1.0f, 0.0f, 1.0f); ++ Imath::C4f b (0.0f, 0.0f, 1.0f, 1.0f); ++ ++ Imath::C4f w = r + g + b; + + assert (w.r == 1.0f); + assert (w.g == 1.0f); +diff --git a/docs/examples/Euler.cpp b/docs/examples/Euler.cpp +index 16166f6..80eca97 100644 +--- a/docs/examples/Euler.cpp ++++ b/docs/examples/Euler.cpp +@@ -2,10 +2,10 @@ + #include + + void +-euler_example() ++euler_example () + { + int i, j, k; +- ++ + Imath::Eulerf xyz (Imath::Eulerf::XYZ); + xyz.angleOrder (i, j, k); + assert (i == 0 && j == 1 && k == 2); +@@ -18,7 +18,6 @@ euler_example() + Imath::Eulerf e2 (0.0f, 0.0f, 0.1f); + + e1.makeNear (e2); +- Imath::V3f v = e2.toXYZVector(); ++ Imath::V3f v = e2.toXYZVector (); + assert (v.equalWithAbsError (Imath::V3f (0.0f, 0.0f, 0.1f), 0.00001f)); + } +- +diff --git a/docs/examples/Frustum.cpp b/docs/examples/Frustum.cpp +index f7074a4..a8f0257 100644 +--- a/docs/examples/Frustum.cpp ++++ b/docs/examples/Frustum.cpp +@@ -1,18 +1,18 @@ + #include + + void +-frustum_example() ++frustum_example () + { +- float near = 1.7f; +- float far = 567.0f; +- float left = -3.5f; +- float right = 2.0f; +- float top = 0.9f; ++ float near = 1.7f; ++ float far = 567.0f; ++ float left = -3.5f; ++ float right = 2.0f; ++ float top = 0.9f; + float bottom = -1.3f; + + Imath::Frustumf frustum (near, far, left, right, top, bottom, false); + +- Imath::M44f m = frustum.projectionMatrix(); ++ Imath::M44f m = frustum.projectionMatrix (); + + Imath::V3f p (1.0f, 1.0f, 1.0f); + Imath::V2f s = frustum.projectPointToScreen (p); +diff --git a/docs/examples/Interval.cpp b/docs/examples/Interval.cpp +index da86981..3e79897 100644 +--- a/docs/examples/Interval.cpp ++++ b/docs/examples/Interval.cpp +@@ -1,18 +1,18 @@ + #include + + void +-interval_example() ++interval_example () + { + Imath::Intervalf v; + +- assert (v.isEmpty()); +- assert (!v.hasVolume()); +- assert (!v.isInfinite()); ++ assert (v.isEmpty ()); ++ assert (!v.hasVolume ()); ++ assert (!v.isInfinite ()); + + v.extendBy (1.0f); +- assert (!v.isEmpty()); +- ++ assert (!v.isEmpty ()); ++ + v.extendBy (2.0f); +- assert (v.hasVolume()); ++ assert (v.hasVolume ()); + assert (v.intersects (1.5f)); + } +diff --git a/docs/examples/Line3.cpp b/docs/examples/Line3.cpp +index 4827b08..15d9a9b 100644 +--- a/docs/examples/Line3.cpp ++++ b/docs/examples/Line3.cpp +@@ -1,22 +1,23 @@ + #include + + void +-line3_example() ++line3_example () + { +- Imath::V3f a (0.0f, 0.0f, 0.0f); +- Imath::V3f b (1.0f, 1.0f, 1.0f); ++ Imath::V3f a (0.0f, 0.0f, 0.0f); ++ Imath::V3f b (1.0f, 1.0f, 1.0f); + + Imath::Line3f line (a, b); +- ++ + assert (line.pos == a); +- assert (line.dir == (b-a).normalized()); +- +- Imath::V3f c (0.5f, 0.5f, 0.5f); ++ assert (line.dir == (b - a).normalized ()); ++ ++ Imath::V3f c (0.5f, 0.5f, 0.5f); + + float f = line.distanceTo (c); + assert (Imath::equalWithAbsError (f, 0.0f, 0.0001f)); + + Imath::V3f p = line (0.5f); // midpoint, i.e. 0.5 units from a along (b-a) + +- assert (p.equalWithAbsError (Imath::V3f (0.288675f, 0.288675f, 0.288675f), 0.0001f)); ++ assert (p.equalWithAbsError ( ++ Imath::V3f (0.288675f, 0.288675f, 0.288675f), 0.0001f)); + } +diff --git a/docs/examples/Matrix22.cpp b/docs/examples/Matrix22.cpp +index f48c4a4..44fb5d8 100644 +--- a/docs/examples/Matrix22.cpp ++++ b/docs/examples/Matrix22.cpp +@@ -2,21 +2,21 @@ + #include + + void +-matrix22_example() ++matrix22_example () + { + Imath::M22f M (Imath::UNINITIALIZED); // uninitialized + +- M.makeIdentity(); ++ M.makeIdentity (); + assert (M[0][0] == 1.0f); + assert (M[0][1] == 0.0f); + +- Imath::M22f Minv = M.inverse(); ++ Imath::M22f Minv = M.inverse (); + + Imath::M22f R; + assert (R == Imath::identity22f); + +- R.rotate (M_PI/4); +- ++ R.rotate (M_PI / 4); ++ + M = R * M; + + Imath::V2f v2 (1.0f, 0.0f); +diff --git a/docs/examples/Matrix33.cpp b/docs/examples/Matrix33.cpp +index 92b6998..989af48 100644 +--- a/docs/examples/Matrix33.cpp ++++ b/docs/examples/Matrix33.cpp +@@ -2,25 +2,26 @@ + #include + + void +-matrix33_example() ++matrix33_example () + { + Imath::M33f M (Imath::UNINITIALIZED); // uninitialized + +- M.makeIdentity(); ++ M.makeIdentity (); + assert (M[0][0] == 1.0f); + assert (M[0][1] == 0.0f); + +- Imath::M33f Minv = M.inverse(); ++ Imath::M33f Minv = M.inverse (); + + Imath::M33f R; + assert (R == Imath::identity33f); + +- R.rotate (M_PI/4); +- ++ R.rotate (M_PI / 4); ++ + M = R * M; + + Imath::V3f v3 (1.0f, 0.0f, 0.0f); + Imath::V3f r3 = v3 * M; + +- assert (r3.equalWithAbsError (Imath::V3f (0.707107f, 0.7071070f, 0.0f), 1e-6f)); ++ assert ( ++ r3.equalWithAbsError (Imath::V3f (0.707107f, 0.7071070f, 0.0f), 1e-6f)); + } +diff --git a/docs/examples/Matrix44.cpp b/docs/examples/Matrix44.cpp +index 76fbf7b..b68f8a4 100644 +--- a/docs/examples/Matrix44.cpp ++++ b/docs/examples/Matrix44.cpp +@@ -2,29 +2,31 @@ + #include + + void +-matrix44_example() ++matrix44_example () + { + Imath::M44f M (Imath::UNINITIALIZED); // uninitialized + +- M.makeIdentity(); ++ M.makeIdentity (); + assert (M[0][0] == 1.0f); + assert (M[0][1] == 0.0f); + +- Imath::M44f Minv = M.inverse(); ++ Imath::M44f Minv = M.inverse (); + + Imath::M44f R; + assert (R == Imath::identity44f); + +- R.rotate (Imath::V3f (0.02f, M_PI/4, 0.0f)); +- ++ R.rotate (Imath::V3f (0.02f, M_PI / 4, 0.0f)); ++ + M = R * M; + + Imath::V3f v3 (1.0f, 0.0f, 0.0f); + Imath::V4f v4 (1.0f, 0.0f, 0.0f, 1.0f); + + Imath::V3f r3 = v3 * M; +- assert (r3.equalWithAbsError (Imath::V3f (0.707107f, 0.0f, -0.7071070f), 1e-6f)); ++ assert (r3.equalWithAbsError ( ++ Imath::V3f (0.707107f, 0.0f, -0.7071070f), 1e-6f)); + + Imath::V4f r4 = v4 * M; +- assert (r4.equalWithAbsError (Imath::V4f (0.707107f, 0.0f, -0.7071070f, 1.0f), 1e-6f)); ++ assert (r4.equalWithAbsError ( ++ Imath::V4f (0.707107f, 0.0f, -0.7071070f, 1.0f), 1e-6f)); + } +diff --git a/docs/examples/Plane3.cpp b/docs/examples/Plane3.cpp +index c17a881..b4771ea 100644 +--- a/docs/examples/Plane3.cpp ++++ b/docs/examples/Plane3.cpp +@@ -1,7 +1,7 @@ + #include + + void +-plane3_example() ++plane3_example () + { + Imath::V3f a (1.0f, 0.0f, 0.0f); + Imath::V3f b (0.0f, 1.0f, 0.0f); +@@ -9,12 +9,12 @@ plane3_example() + + Imath::Plane3f p (a, b, c); + +- Imath::V3f n (1.0f, 1.0f, 1.0f); +- n.normalize(); ++ Imath::V3f n (1.0f, 1.0f, 1.0f); ++ n.normalize (); + + assert (p.normal == n); + + Imath::V3f o (0.0f, 0.0f, 0.0f); +- float d = p.distanceTo (o); ++ float d = p.distanceTo (o); + assert (Imath::equalWithAbsError (d, -0.57735f, 1e-6f)); + } +diff --git a/docs/examples/Quat.cpp b/docs/examples/Quat.cpp +index f79d821..719936c 100644 +--- a/docs/examples/Quat.cpp ++++ b/docs/examples/Quat.cpp +@@ -1,11 +1,11 @@ + #include + + void +-quat_example() ++quat_example () + { + Imath::Quatf q (2.0f, 3.0f, 4.0f, 5.0f); + assert (q.r == 2.0f && q.v == Imath::V3f (3.0f, 4.0f, 5.0f)); + + Imath::Quatf r (1.0f, 0.0f, 0.0f, 1.0f); +- assert (r.inverse() == Imath::Quatf (0.5f, 0.0f, 0.0f, -0.5f)); ++ assert (r.inverse () == Imath::Quatf (0.5f, 0.0f, 0.0f, -0.5f)); + } +diff --git a/docs/examples/Shear6.cpp b/docs/examples/Shear6.cpp +index ba97bd2..33edd44 100644 +--- a/docs/examples/Shear6.cpp ++++ b/docs/examples/Shear6.cpp +@@ -1,8 +1,8 @@ +-#include + #include ++#include + + void +-shear6_example() ++shear6_example () + { + Imath::Shear6f s (0.330f, 0.710f, 0.010f, 0.999f, -0.531f, -0.012f); + +diff --git a/docs/examples/Sphere3.cpp b/docs/examples/Sphere3.cpp +index 83d2bce..717adb9 100644 +--- a/docs/examples/Sphere3.cpp ++++ b/docs/examples/Sphere3.cpp +@@ -1,20 +1,21 @@ + #include + + void +-sphere3_example() ++sphere3_example () + { +- Imath::V3f center (1.0f, 1.0f, 1.0f); +- float radius = 2.0f; ++ Imath::V3f center (1.0f, 1.0f, 1.0f); ++ float radius = 2.0f; + Imath::Sphere3f s (center, radius); + + assert (s.center == center); + assert (s.radius == radius); +- +- Imath::Line3f line (Imath::V3f (0.0f, 0.0f, 0.0f), +- Imath::V3f (1.0f, 1.0f, 1.0f)); ++ ++ Imath::Line3f line ( ++ Imath::V3f (0.0f, 0.0f, 0.0f), Imath::V3f (1.0f, 1.0f, 1.0f)); + + Imath::V3f v; + assert (s.intersect (line, v)); + +- assert (v.equalWithAbsError (Imath::V3f(2.1547f, 2.1547f, 2.1547f), 1e-6f)); ++ assert ( ++ v.equalWithAbsError (Imath::V3f (2.1547f, 2.1547f, 2.1547f), 1e-6f)); + } +diff --git a/docs/examples/Vec2.cpp b/docs/examples/Vec2.cpp +index 8246427..1b2e5ec 100644 +--- a/docs/examples/Vec2.cpp ++++ b/docs/examples/Vec2.cpp +@@ -1,18 +1,18 @@ + #include + + void +-vec2_example() ++vec2_example () + { +- Imath::V2f a (1.0f, 2.0f); +- Imath::V2f b; // b is uninitialized ++ Imath::V2f a (1.0f, 2.0f); ++ Imath::V2f b; // b is uninitialized + + b.x = a[0]; + b.y = a[1]; + + assert (a == b); + +- assert (a.length() == sqrt (a ^ a)); ++ assert (a.length () == sqrt (a ^ a)); + +- a.normalize(); +- assert (Imath::equalWithAbsError (a.length(), 1.0f, 1e-6f)); ++ a.normalize (); ++ assert (Imath::equalWithAbsError (a.length (), 1.0f, 1e-6f)); + } +diff --git a/docs/examples/Vec3.cpp b/docs/examples/Vec3.cpp +index ac3ae99..9925bd3 100644 +--- a/docs/examples/Vec3.cpp ++++ b/docs/examples/Vec3.cpp +@@ -1,10 +1,10 @@ + #include + + void +-vec3_example() ++vec3_example () + { +- Imath::V3f a (1.0f, 2.0f, 3.0f); +- Imath::V3f b; // b is uninitialized ++ Imath::V3f a (1.0f, 2.0f, 3.0f); ++ Imath::V3f b; // b is uninitialized + + b.x = a[0]; + b.y = a[1]; +@@ -12,8 +12,8 @@ vec3_example() + + assert (a == b); + +- assert (a.length() == sqrt (a ^ a)); ++ assert (a.length () == sqrt (a ^ a)); + +- a.normalize(); +- assert (Imath::equalWithAbsError (a.length(), 1.0f, 1e-6f)); ++ a.normalize (); ++ assert (Imath::equalWithAbsError (a.length (), 1.0f, 1e-6f)); + } +diff --git a/docs/examples/Vec4.cpp b/docs/examples/Vec4.cpp +index c5a9a8d..f459ede 100644 +--- a/docs/examples/Vec4.cpp ++++ b/docs/examples/Vec4.cpp +@@ -1,10 +1,10 @@ + #include + + void +-vec4_example() ++vec4_example () + { +- Imath::V4f a (1.0f, 2.0f, 3.0f, 4.0f); +- Imath::V4f b; // b is uninitialized ++ Imath::V4f a (1.0f, 2.0f, 3.0f, 4.0f); ++ Imath::V4f b; // b is uninitialized + + b.x = a[0]; + b.y = a[1]; +@@ -13,8 +13,8 @@ vec4_example() + + assert (a == b); + +- assert (a.length() == sqrt (a ^ a)); ++ assert (a.length () == sqrt (a ^ a)); + +- a.normalize(); +- assert (Imath::equalWithAbsError (a.length(), 1.0f, 1e-6f)); ++ a.normalize (); ++ assert (Imath::equalWithAbsError (a.length (), 1.0f, 1e-6f)); + } +diff --git a/docs/examples/gl.cpp b/docs/examples/gl.cpp +index ce0150d..f1e5229 100644 +--- a/docs/examples/gl.cpp ++++ b/docs/examples/gl.cpp +@@ -1,7 +1,7 @@ + #include + + void +-gl_example() ++gl_example () + { + Imath::M44f M; + glPushMatrix (M); +@@ -9,4 +9,3 @@ gl_example() + Imath::V3f v (0.0f, 1.0f, 2.0f); + glVertex (v); + } +- +diff --git a/docs/examples/half.c b/docs/examples/half.c +index b7a65b0..420d8b9 100644 +--- a/docs/examples/half.c ++++ b/docs/examples/half.c +@@ -1,12 +1,11 @@ + #include + + void +-half_example() ++half_example () + { + float f = 3.5f; +- ++ + half h = imath_float_to_half (f) + +- float hh = imath_half_to_float (h) ++ float hh = imath_half_to_float (h) + } +- +diff --git a/docs/examples/half.cpp b/docs/examples/half.cpp +index 266a868..98eb119 100644 +--- a/docs/examples/half.cpp ++++ b/docs/examples/half.cpp +@@ -2,12 +2,11 @@ + #include + + void +-half_example() ++half_example () + { +- half a (3.5); ++ half a (3.5); + float b (a + sqrt (a)); + a += b; + b += a; + b = a + 7; + } +- +diff --git a/docs/examples/main.cpp b/docs/examples/main.cpp +index 0578441..e64f4dc 100644 +--- a/docs/examples/main.cpp ++++ b/docs/examples/main.cpp +@@ -3,48 +3,48 @@ + + #include + +-void color3_example(); +-void color4_example(); +-void euler_example(); +-void frustum_example(); +-void interval_example(); +-void line3_example(); +-void matrix22_example(); +-void matrix33_example(); +-void matrix44_example(); +-void plane3_example(); +-void quat_example(); +-void shear6_example(); +-void sphere3_example(); +-void vec2_example(); +-void vec3_example(); +-void vec4_example(); +-void half_example(); ++void color3_example (); ++void color4_example (); ++void euler_example (); ++void frustum_example (); ++void interval_example (); ++void line3_example (); ++void matrix22_example (); ++void matrix33_example (); ++void matrix44_example (); ++void plane3_example (); ++void quat_example (); ++void shear6_example (); ++void sphere3_example (); ++void vec2_example (); ++void vec3_example (); ++void vec4_example (); ++void half_example (); + + int + main (int argc, char* argv[]) + { + std::cout << "imath examples..." << std::endl; + +- color3_example(); +- color4_example(); +- euler_example(); +- frustum_example(); +- interval_example(); +- line3_example(); +- matrix22_example(); +- matrix33_example(); +- matrix44_example(); +- plane3_example(); +- quat_example(); +- shear6_example(); +- sphere3_example(); +- vec2_example(); +- vec3_example(); +- vec4_example(); +- half_example(); +- ++ color3_example (); ++ color4_example (); ++ euler_example (); ++ frustum_example (); ++ interval_example (); ++ line3_example (); ++ matrix22_example (); ++ matrix33_example (); ++ matrix44_example (); ++ plane3_example (); ++ quat_example (); ++ shear6_example (); ++ sphere3_example (); ++ vec2_example (); ++ vec3_example (); ++ vec4_example (); ++ half_example (); ++ + std::cout << "done." << std::endl; +- ++ + return 0; + } +diff --git a/src/Imath/ImathBox.h b/src/Imath/ImathBox.h +index 7391dd7..0ab65b7 100644 +--- a/src/Imath/ImathBox.h ++++ b/src/Imath/ImathBox.h +@@ -36,11 +36,10 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class IMATH_EXPORT_TEMPLATE_TYPE Box + { +- public: +- ++public: + /// @{ + /// @name Direct access to bounds +- ++ + /// The minimum value of the box. + V min; + +@@ -55,24 +54,27 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Box + /// Construct an empty bounding box. This initializes the mimimum to + /// std::numeric_limits::max() and the maximum to + /// std::numeric_limits::lowest(). +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box () IMATH_NOEXCEPT; + + /// Construct a bounding box that contains a single point. + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const V& point) IMATH_NOEXCEPT; + + /// Construct a bounding box with the given minimum and maximum values. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const V& minV, const V& maxV) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const V& minV, const V& maxV) ++ IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Comparison +- ++ + /// Equality +- IMATH_HOSTDEVICE constexpr bool operator== (const Box& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Box& src) const IMATH_NOEXCEPT; + + /// Inequality +- IMATH_HOSTDEVICE constexpr bool operator!= (const Box& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Box& src) const IMATH_NOEXCEPT; + + /// @} + +@@ -82,7 +84,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Box + /// Set the box to be empty. A box is empty if the mimimum is greater + /// than the maximum. makeEmpty() sets the mimimum to `V::baseTypeMax()` + /// and the maximum to `V::baseTypeLowest()`. +- IMATH_HOSTDEVICE void makeEmpty() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeEmpty () IMATH_NOEXCEPT; + + /// Extend the box to include the given point. + IMATH_HOSTDEVICE void extendBy (const V& point) IMATH_NOEXCEPT; +@@ -91,43 +93,46 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Box + IMATH_HOSTDEVICE void extendBy (const Box& box) IMATH_NOEXCEPT; + + /// Make the box include the entire range of `V`. +- IMATH_HOSTDEVICE void makeInfinite() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeInfinite () IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Query +- ++ + /// Return the size of the box. The size is of type `V`, defined + /// as `(max-min)`. An empty box has a size of `V(0)`, i.e. 0 in + /// each dimension. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 V size() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 V size () const IMATH_NOEXCEPT; + + /// Return the center of the box. The center is defined as + /// `(max+min)/2`. The center of an empty box is undefined. +- IMATH_HOSTDEVICE constexpr V center() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr V center () const IMATH_NOEXCEPT; + + /// Return true if the given point is inside the box, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects (const V& point) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersects (const V& point) const IMATH_NOEXCEPT; + + /// Return true if the given box is inside the box, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects (const Box& box) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersects (const Box& box) const IMATH_NOEXCEPT; + + /// Return the major axis of the box. The major axis is the dimension with + /// the greatest difference between maximum and minimum. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 unsigned int majorAxis() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 unsigned int ++ majorAxis () const IMATH_NOEXCEPT; + + /// Return true if the box is empty, false otherwise. An empty box's + /// minimum is greater than its maximum. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isEmpty() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isEmpty () const IMATH_NOEXCEPT; + + /// Return true if the box is larger than a single point, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool hasVolume() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool hasVolume () const IMATH_NOEXCEPT; + + /// Return true if the box contains all points, false otherwise. + /// An infinite box has a mimimum of`V::baseTypeLowest()` + /// and a maximum of `V::baseTypeMax()`. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isInfinite() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isInfinite () const IMATH_NOEXCEPT; + + /// @} + }; +@@ -167,20 +172,22 @@ typedef Box Box3f; + typedef Box Box3d; + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box::Box() IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box::Box () IMATH_NOEXCEPT + { +- makeEmpty(); ++ makeEmpty (); + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box::Box (const V& point) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE ++ IMATH_CONSTEXPR14 inline Box::Box (const V& point) IMATH_NOEXCEPT + { + min = point; + max = point; + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box::Box (const V& minV, const V& maxV) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box::Box ( ++ const V& minV, const V& maxV) IMATH_NOEXCEPT + { + min = minV; + max = maxV; +@@ -202,31 +209,29 @@ Box::operator!= (const Box& src) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline void +-Box::makeEmpty() IMATH_NOEXCEPT ++Box::makeEmpty () IMATH_NOEXCEPT + { +- min = V (V::baseTypeMax()); +- max = V (V::baseTypeLowest()); ++ min = V (V::baseTypeMax ()); ++ max = V (V::baseTypeLowest ()); + } + + template + IMATH_HOSTDEVICE inline void +-Box::makeInfinite() IMATH_NOEXCEPT ++Box::makeInfinite () IMATH_NOEXCEPT + { +- min = V (V::baseTypeLowest()); +- max = V (V::baseTypeMax()); ++ min = V (V::baseTypeLowest ()); ++ max = V (V::baseTypeMax ()); + } + + template + IMATH_HOSTDEVICE inline void + Box::extendBy (const V& point) IMATH_NOEXCEPT + { +- for (unsigned int i = 0; i < min.dimensions(); i++) ++ for (unsigned int i = 0; i < min.dimensions (); i++) + { +- if (point[i] < min[i]) +- min[i] = point[i]; ++ if (point[i] < min[i]) min[i] = point[i]; + +- if (point[i] > max[i]) +- max[i] = point[i]; ++ if (point[i] > max[i]) max[i] = point[i]; + } + } + +@@ -234,13 +239,11 @@ template + IMATH_HOSTDEVICE inline void + Box::extendBy (const Box& box) IMATH_NOEXCEPT + { +- for (unsigned int i = 0; i < min.dimensions(); i++) ++ for (unsigned int i = 0; i < min.dimensions (); i++) + { +- if (box.min[i] < min[i]) +- min[i] = box.min[i]; ++ if (box.min[i] < min[i]) min[i] = box.min[i]; + +- if (box.max[i] > max[i]) +- max[i] = box.max[i]; ++ if (box.max[i] > max[i]) max[i] = box.max[i]; + } + } + +@@ -248,10 +251,9 @@ template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool + Box::intersects (const V& point) const IMATH_NOEXCEPT + { +- for (unsigned int i = 0; i < min.dimensions(); i++) ++ for (unsigned int i = 0; i < min.dimensions (); i++) + { +- if (point[i] < min[i] || point[i] > max[i]) +- return false; ++ if (point[i] < min[i] || point[i] > max[i]) return false; + } + + return true; +@@ -261,10 +263,9 @@ template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool + Box::intersects (const Box& box) const IMATH_NOEXCEPT + { +- for (unsigned int i = 0; i < min.dimensions(); i++) ++ for (unsigned int i = 0; i < min.dimensions (); i++) + { +- if (box.max[i] < min[i] || box.min[i] > max[i]) +- return false; ++ if (box.max[i] < min[i] || box.min[i] > max[i]) return false; + } + + return true; +@@ -272,29 +273,27 @@ Box::intersects (const Box& box) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline V +-Box::size() const IMATH_NOEXCEPT ++Box::size () const IMATH_NOEXCEPT + { +- if (isEmpty()) +- return V (0); ++ if (isEmpty ()) return V (0); + + return max - min; + } + + template + IMATH_HOSTDEVICE constexpr inline V +-Box::center() const IMATH_NOEXCEPT ++Box::center () const IMATH_NOEXCEPT + { + return (max + min) / 2; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Box::isEmpty() const IMATH_NOEXCEPT ++Box::isEmpty () const IMATH_NOEXCEPT + { +- for (unsigned int i = 0; i < min.dimensions(); i++) ++ for (unsigned int i = 0; i < min.dimensions (); i++) + { +- if (max[i] < min[i]) +- return true; ++ if (max[i] < min[i]) return true; + } + + return false; +@@ -302,11 +301,11 @@ Box::isEmpty() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Box::isInfinite() const IMATH_NOEXCEPT ++Box::isInfinite () const IMATH_NOEXCEPT + { +- for (unsigned int i = 0; i < min.dimensions(); i++) ++ for (unsigned int i = 0; i < min.dimensions (); i++) + { +- if (min[i] != V::baseTypeLowest() || max[i] != V::baseTypeMax()) ++ if (min[i] != V::baseTypeLowest () || max[i] != V::baseTypeMax ()) + return false; + } + +@@ -315,12 +314,11 @@ Box::isInfinite() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Box::hasVolume() const IMATH_NOEXCEPT ++Box::hasVolume () const IMATH_NOEXCEPT + { +- for (unsigned int i = 0; i < min.dimensions(); i++) ++ for (unsigned int i = 0; i < min.dimensions (); i++) + { +- if (max[i] <= min[i]) +- return false; ++ if (max[i] <= min[i]) return false; + } + + return true; +@@ -328,15 +326,14 @@ Box::hasVolume() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline unsigned int +-Box::majorAxis() const IMATH_NOEXCEPT ++Box::majorAxis () const IMATH_NOEXCEPT + { + unsigned int major = 0; +- V s = size(); ++ V s = size (); + +- for (unsigned int i = 1; i < min.dimensions(); i++) ++ for (unsigned int i = 1; i < min.dimensions (); i++) + { +- if (s[i] > s[major]) +- major = i; ++ if (s[i] > s[major]) major = i; + } + + return major; +@@ -358,11 +355,10 @@ template class Box; + + template class IMATH_EXPORT_TEMPLATE_TYPE Box> + { +- public: +- ++public: + /// @{ + /// @name Direct access to bounds +- ++ + /// The minimum value of the box. + Vec2 min; + +@@ -370,29 +366,33 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Box> + Vec2 max; + + /// @} +- ++ + /// @{ + /// @name Constructors and Assignment + + /// Empty by default +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box () IMATH_NOEXCEPT; + + /// Construct a bounding box that contains a single point. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const Vec2& point) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const Vec2& point) ++ IMATH_NOEXCEPT; + + /// Construct a bounding box with the given minimum and maximum points +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const Vec2& minT, const Vec2& maxT) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Box (const Vec2& minT, const Vec2& maxT) IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Comparison +- ++ + /// Equality +- IMATH_HOSTDEVICE constexpr bool operator== (const Box>& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Box>& src) const IMATH_NOEXCEPT; + + /// Inequality +- IMATH_HOSTDEVICE constexpr bool operator!= (const Box>& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Box>& src) const IMATH_NOEXCEPT; + + /// @} + +@@ -403,7 +403,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Box> + /// greater than the maximum. makeEmpty() sets the mimimum to + /// std::numeric_limits::max() and the maximum to + /// std::numeric_limits::lowest(). +- IMATH_HOSTDEVICE void makeEmpty() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeEmpty () IMATH_NOEXCEPT; + + /// Extend the Box to include the given point. + IMATH_HOSTDEVICE void extendBy (const Vec2& point) IMATH_NOEXCEPT; +@@ -412,42 +412,45 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Box> + IMATH_HOSTDEVICE void extendBy (const Box>& box) IMATH_NOEXCEPT; + + /// Make the box include the entire range of T. +- IMATH_HOSTDEVICE void makeInfinite() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeInfinite () IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Query +- ++ + /// Return the size of the box. The size is of type `V`, defined as + /// `(max-min)`. An empty box has a size of `V(0)`, i.e. 0 in each dimension. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec2 size() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec2 size () const IMATH_NOEXCEPT; + + /// Return the center of the box. The center is defined as + /// `(max+min)/2`. The center of an empty box is undefined. +- IMATH_HOSTDEVICE constexpr Vec2 center() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec2 center () const IMATH_NOEXCEPT; + + /// Return true if the given point is inside the box, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects (const Vec2& point) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersects (const Vec2& point) const IMATH_NOEXCEPT; + + /// Return true if the given box is inside the box, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects (const Box>& box) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersects (const Box>& box) const IMATH_NOEXCEPT; + + /// Return the major axis of the box. The major axis is the dimension with + /// the greatest difference between maximum and minimum. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 unsigned int majorAxis() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 unsigned int ++ majorAxis () const IMATH_NOEXCEPT; + + /// Return true if the box is empty, false otherwise. An empty box's + /// minimum is greater than its maximum. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isEmpty() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isEmpty () const IMATH_NOEXCEPT; + + /// Return true if the box is larger than a single point, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool hasVolume() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool hasVolume () const IMATH_NOEXCEPT; + + /// Return true if the box contains all points, false otherwise. + /// An infinite box has a mimimum of `V::baseTypeMin()` + /// and a maximum of `V::baseTypeMax()`. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isInfinite() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isInfinite () const IMATH_NOEXCEPT; + + /// @} + }; +@@ -456,19 +459,23 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Box> + // Implementation + //---------------- + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box() IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box () IMATH_NOEXCEPT + { +- makeEmpty(); ++ makeEmpty (); + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box (const Vec2& point) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box ( ++ const Vec2& point) IMATH_NOEXCEPT + { + min = point; + max = point; + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box (const Vec2& minT, const Vec2& maxT) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box ( ++ const Vec2& minT, const Vec2& maxT) IMATH_NOEXCEPT + { + min = minT; + max = maxT; +@@ -490,59 +497,52 @@ Box>::operator!= (const Box>& src) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline void +-Box>::makeEmpty() IMATH_NOEXCEPT ++Box>::makeEmpty () IMATH_NOEXCEPT + { +- min = Vec2 (Vec2::baseTypeMax()); +- max = Vec2 (Vec2::baseTypeLowest()); ++ min = Vec2 (Vec2::baseTypeMax ()); ++ max = Vec2 (Vec2::baseTypeLowest ()); + } + + template + IMATH_HOSTDEVICE inline void +-Box>::makeInfinite() IMATH_NOEXCEPT ++Box>::makeInfinite () IMATH_NOEXCEPT + { +- min = Vec2 (Vec2::baseTypeLowest()); +- max = Vec2 (Vec2::baseTypeMax()); ++ min = Vec2 (Vec2::baseTypeLowest ()); ++ max = Vec2 (Vec2::baseTypeMax ()); + } + + template + IMATH_HOSTDEVICE inline void + Box>::extendBy (const Vec2& point) IMATH_NOEXCEPT + { +- if (point[0] < min[0]) +- min[0] = point[0]; ++ if (point[0] < min[0]) min[0] = point[0]; + +- if (point[0] > max[0]) +- max[0] = point[0]; ++ if (point[0] > max[0]) max[0] = point[0]; + +- if (point[1] < min[1]) +- min[1] = point[1]; ++ if (point[1] < min[1]) min[1] = point[1]; + +- if (point[1] > max[1]) +- max[1] = point[1]; ++ if (point[1] > max[1]) max[1] = point[1]; + } + + template + IMATH_HOSTDEVICE inline void + Box>::extendBy (const Box>& box) IMATH_NOEXCEPT + { +- if (box.min[0] < min[0]) +- min[0] = box.min[0]; ++ if (box.min[0] < min[0]) min[0] = box.min[0]; + +- if (box.max[0] > max[0]) +- max[0] = box.max[0]; ++ if (box.max[0] > max[0]) max[0] = box.max[0]; + +- if (box.min[1] < min[1]) +- min[1] = box.min[1]; ++ if (box.min[1] < min[1]) min[1] = box.min[1]; + +- if (box.max[1] > max[1]) +- max[1] = box.max[1]; ++ if (box.max[1] > max[1]) max[1] = box.max[1]; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool + Box>::intersects (const Vec2& point) const IMATH_NOEXCEPT + { +- if (point[0] < min[0] || point[0] > max[0] || point[1] < min[1] || point[1] > max[1]) ++ if (point[0] < min[0] || point[0] > max[0] || point[1] < min[1] || ++ point[1] > max[1]) + return false; + + return true; +@@ -552,7 +552,8 @@ template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool + Box>::intersects (const Box>& box) const IMATH_NOEXCEPT + { +- if (box.max[0] < min[0] || box.min[0] > max[0] || box.max[1] < min[1] || box.min[1] > max[1]) ++ if (box.max[0] < min[0] || box.min[0] > max[0] || box.max[1] < min[1] || ++ box.min[1] > max[1]) + return false; + + return true; +@@ -560,39 +561,37 @@ Box>::intersects (const Box>& box) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Vec2 +-Box>::size() const IMATH_NOEXCEPT ++ Box>::size () const IMATH_NOEXCEPT + { +- if (isEmpty()) +- return Vec2 (0); ++ if (isEmpty ()) return Vec2 (0); + + return max - min; + } + + template + IMATH_HOSTDEVICE constexpr inline Vec2 +-Box>::center() const IMATH_NOEXCEPT ++Box>::center () const IMATH_NOEXCEPT + { + return (max + min) / 2; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Box>::isEmpty() const IMATH_NOEXCEPT ++Box>::isEmpty () const IMATH_NOEXCEPT + { +- if (max[0] < min[0] || max[1] < min[1]) +- return true; ++ if (max[0] < min[0] || max[1] < min[1]) return true; + + return false; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Box>::isInfinite() const IMATH_NOEXCEPT ++Box>::isInfinite () const IMATH_NOEXCEPT + { +- if (min[0] != std::numeric_limits::lowest() || +- max[0] != std::numeric_limits::max() || +- min[1] != std::numeric_limits::lowest() || +- max[1] != std::numeric_limits::max()) ++ if (min[0] != std::numeric_limits::lowest () || ++ max[0] != std::numeric_limits::max () || ++ min[1] != std::numeric_limits::lowest () || ++ max[1] != std::numeric_limits::max ()) + return false; + + return true; +@@ -600,38 +599,35 @@ Box>::isInfinite() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Box>::hasVolume() const IMATH_NOEXCEPT ++Box>::hasVolume () const IMATH_NOEXCEPT + { +- if (max[0] <= min[0] || max[1] <= min[1]) +- return false; ++ if (max[0] <= min[0] || max[1] <= min[1]) return false; + + return true; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline unsigned int +-Box>::majorAxis() const IMATH_NOEXCEPT ++Box>::majorAxis () const IMATH_NOEXCEPT + { + unsigned int major = 0; +- Vec2 s = size(); ++ Vec2 s = size (); + +- if (s[1] > s[major]) +- major = 1; ++ if (s[1] > s[major]) major = 1; + + return major; + } + + /// + /// The Box template represents a 3D bounding box defined by +-/// minimum and maximum values of type Vec3. ++/// minimum and maximum values of type Vec3. + /// + template class IMATH_EXPORT_TEMPLATE_TYPE Box> + { +- public: +- ++public: + /// @{ + /// @name Direct access to bounds +- ++ + /// The minimum value of the box. + Vec3 min; + +@@ -644,27 +640,31 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Box> + /// @name Constructors + + /// Empty by default +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box () IMATH_NOEXCEPT; + + /// Construct a bounding box that contains a single point. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const Vec3& point) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const Vec3& point) ++ IMATH_NOEXCEPT; + + /// Construct a bounding box with the given minimum and maximum points +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box (const Vec3& minT, const Vec3& maxT) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Box (const Vec3& minT, const Vec3& maxT) IMATH_NOEXCEPT; + + /// @} + + /// Equality +- IMATH_HOSTDEVICE constexpr bool operator== (const Box>& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Box>& src) const IMATH_NOEXCEPT; + + /// Inequality +- IMATH_HOSTDEVICE constexpr bool operator!= (const Box>& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Box>& src) const IMATH_NOEXCEPT; + + /// Set the Box to be empty. A Box is empty if the mimimum is + /// greater than the maximum. makeEmpty() sets the mimimum to + /// std::numeric_limits::max() and the maximum to + /// std::numeric_limits::lowest(). +- IMATH_HOSTDEVICE void makeEmpty() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeEmpty () IMATH_NOEXCEPT; + + /// Extend the Box to include the given point. + IMATH_HOSTDEVICE void extendBy (const Vec3& point) IMATH_NOEXCEPT; +@@ -673,56 +673,63 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Box> + IMATH_HOSTDEVICE void extendBy (const Box>& box) IMATH_NOEXCEPT; + + /// Make the box include the entire range of T. +- IMATH_HOSTDEVICE void makeInfinite() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeInfinite () IMATH_NOEXCEPT; + + /// Return the size of the box. The size is of type `V`, defined as + /// (max-min). An empty box has a size of V(0), i.e. 0 in each dimension. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 size() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 size () const IMATH_NOEXCEPT; + + /// Return the center of the box. The center is defined as + /// (max+min)/2. The center of an empty box is undefined. +- IMATH_HOSTDEVICE constexpr Vec3 center() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 center () const IMATH_NOEXCEPT; + + /// Return true if the given point is inside the box, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects (const Vec3& point) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersects (const Vec3& point) const IMATH_NOEXCEPT; + + /// Return true if the given box is inside the box, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects (const Box>& box) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersects (const Box>& box) const IMATH_NOEXCEPT; + + /// Return the major axis of the box. The major axis is the dimension with + /// the greatest difference between maximum and minimum. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 unsigned int majorAxis() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 unsigned int ++ majorAxis () const IMATH_NOEXCEPT; + + /// Return true if the box is empty, false otherwise. An empty box's + /// minimum is greater than its maximum. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isEmpty() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isEmpty () const IMATH_NOEXCEPT; + + /// Return true if the box is larger than a single point, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool hasVolume() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool hasVolume () const IMATH_NOEXCEPT; + + /// Return true if the box contains all points, false otherwise. + /// An infinite box has a mimimum of`V::baseTypeMin()` + /// and a maximum of `V::baseTypeMax()`. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isInfinite() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isInfinite () const IMATH_NOEXCEPT; + }; + + //---------------- + // Implementation + //---------------- + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box() IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box () IMATH_NOEXCEPT + { +- makeEmpty(); ++ makeEmpty (); + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box (const Vec3& point) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box ( ++ const Vec3& point) IMATH_NOEXCEPT + { + min = point; + max = point; + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box (const Vec3& minT, const Vec3& maxT) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Box>::Box ( ++ const Vec3& minT, const Vec3& maxT) IMATH_NOEXCEPT + { + min = minT; + max = maxT; +@@ -744,72 +751,60 @@ Box>::operator!= (const Box>& src) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline void +-Box>::makeEmpty() IMATH_NOEXCEPT ++Box>::makeEmpty () IMATH_NOEXCEPT + { +- min = Vec3 (Vec3::baseTypeMax()); +- max = Vec3 (Vec3::baseTypeLowest()); ++ min = Vec3 (Vec3::baseTypeMax ()); ++ max = Vec3 (Vec3::baseTypeLowest ()); + } + + template + IMATH_HOSTDEVICE inline void +-Box>::makeInfinite() IMATH_NOEXCEPT ++Box>::makeInfinite () IMATH_NOEXCEPT + { +- min = Vec3 (Vec3::baseTypeLowest()); +- max = Vec3 (Vec3::baseTypeMax()); ++ min = Vec3 (Vec3::baseTypeLowest ()); ++ max = Vec3 (Vec3::baseTypeMax ()); + } + + template + IMATH_HOSTDEVICE inline void + Box>::extendBy (const Vec3& point) IMATH_NOEXCEPT + { +- if (point[0] < min[0]) +- min[0] = point[0]; ++ if (point[0] < min[0]) min[0] = point[0]; + +- if (point[0] > max[0]) +- max[0] = point[0]; ++ if (point[0] > max[0]) max[0] = point[0]; + +- if (point[1] < min[1]) +- min[1] = point[1]; ++ if (point[1] < min[1]) min[1] = point[1]; + +- if (point[1] > max[1]) +- max[1] = point[1]; ++ if (point[1] > max[1]) max[1] = point[1]; + +- if (point[2] < min[2]) +- min[2] = point[2]; ++ if (point[2] < min[2]) min[2] = point[2]; + +- if (point[2] > max[2]) +- max[2] = point[2]; ++ if (point[2] > max[2]) max[2] = point[2]; + } + + template + IMATH_HOSTDEVICE inline void + Box>::extendBy (const Box>& box) IMATH_NOEXCEPT + { +- if (box.min[0] < min[0]) +- min[0] = box.min[0]; ++ if (box.min[0] < min[0]) min[0] = box.min[0]; + +- if (box.max[0] > max[0]) +- max[0] = box.max[0]; ++ if (box.max[0] > max[0]) max[0] = box.max[0]; + +- if (box.min[1] < min[1]) +- min[1] = box.min[1]; ++ if (box.min[1] < min[1]) min[1] = box.min[1]; + +- if (box.max[1] > max[1]) +- max[1] = box.max[1]; ++ if (box.max[1] > max[1]) max[1] = box.max[1]; + +- if (box.min[2] < min[2]) +- min[2] = box.min[2]; ++ if (box.min[2] < min[2]) min[2] = box.min[2]; + +- if (box.max[2] > max[2]) +- max[2] = box.max[2]; ++ if (box.max[2] > max[2]) max[2] = box.max[2]; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool + Box>::intersects (const Vec3& point) const IMATH_NOEXCEPT + { +- if (point[0] < min[0] || point[0] > max[0] || point[1] < min[1] || point[1] > max[1] || +- point[2] < min[2] || point[2] > max[2]) ++ if (point[0] < min[0] || point[0] > max[0] || point[1] < min[1] || ++ point[1] > max[1] || point[2] < min[2] || point[2] > max[2]) + return false; + + return true; +@@ -819,8 +814,8 @@ template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool + Box>::intersects (const Box>& box) const IMATH_NOEXCEPT + { +- if (box.max[0] < min[0] || box.min[0] > max[0] || box.max[1] < min[1] || box.min[1] > max[1] || +- box.max[2] < min[2] || box.min[2] > max[2]) ++ if (box.max[0] < min[0] || box.min[0] > max[0] || box.max[1] < min[1] || ++ box.min[1] > max[1] || box.max[2] < min[2] || box.min[2] > max[2]) + return false; + + return true; +@@ -828,41 +823,39 @@ Box>::intersects (const Box>& box) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Vec3 +-Box>::size() const IMATH_NOEXCEPT ++ Box>::size () const IMATH_NOEXCEPT + { +- if (isEmpty()) +- return Vec3 (0); ++ if (isEmpty ()) return Vec3 (0); + + return max - min; + } + + template + IMATH_HOSTDEVICE constexpr inline Vec3 +-Box>::center() const IMATH_NOEXCEPT ++Box>::center () const IMATH_NOEXCEPT + { + return (max + min) / 2; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Box>::isEmpty() const IMATH_NOEXCEPT ++Box>::isEmpty () const IMATH_NOEXCEPT + { +- if (max[0] < min[0] || max[1] < min[1] || max[2] < min[2]) +- return true; ++ if (max[0] < min[0] || max[1] < min[1] || max[2] < min[2]) return true; + + return false; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Box>::isInfinite() const IMATH_NOEXCEPT +-{ +- if (min[0] != std::numeric_limits::lowest() || +- max[0] != std::numeric_limits::max() || +- min[1] != std::numeric_limits::lowest() || +- max[1] != std::numeric_limits::max() || +- min[2] != std::numeric_limits::lowest() || +- max[2] != std::numeric_limits::max()) ++Box>::isInfinite () const IMATH_NOEXCEPT ++{ ++ if (min[0] != std::numeric_limits::lowest () || ++ max[0] != std::numeric_limits::max () || ++ min[1] != std::numeric_limits::lowest () || ++ max[1] != std::numeric_limits::max () || ++ min[2] != std::numeric_limits::lowest () || ++ max[2] != std::numeric_limits::max ()) + return false; + + return true; +@@ -870,26 +863,23 @@ Box>::isInfinite() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Box>::hasVolume() const IMATH_NOEXCEPT ++Box>::hasVolume () const IMATH_NOEXCEPT + { +- if (max[0] <= min[0] || max[1] <= min[1] || max[2] <= min[2]) +- return false; ++ if (max[0] <= min[0] || max[1] <= min[1] || max[2] <= min[2]) return false; + + return true; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline unsigned int +-Box>::majorAxis() const IMATH_NOEXCEPT ++Box>::majorAxis () const IMATH_NOEXCEPT + { + unsigned int major = 0; +- Vec3 s = size(); ++ Vec3 s = size (); + +- if (s[1] > s[major]) +- major = 1; ++ if (s[1] > s[major]) major = 1; + +- if (s[2] > s[major]) +- major = 2; ++ if (s[2] > s[major]) major = 2; + + return major; + } +diff --git a/src/Imath/ImathBoxAlgo.h b/src/Imath/ImathBoxAlgo.h +index 97e6edb..3ad5e12 100644 +--- a/src/Imath/ImathBoxAlgo.h ++++ b/src/Imath/ImathBoxAlgo.h +@@ -30,7 +30,7 @@ clip (const T& p, const Box& box) IMATH_NOEXCEPT + { + T q; + +- for (int i = 0; i < int (box.min.dimensions()); i++) ++ for (int i = 0; i < int (box.min.dimensions ()); i++) + { + if (p[i] < box.min[i]) + q[i] = box.min[i]; +@@ -66,8 +66,7 @@ template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 + closestPointOnBox (const Vec3& p, const Box>& box) IMATH_NOEXCEPT + { +- if (box.isEmpty()) +- return p; ++ if (box.isEmpty ()) return p; + + Vec3 q = closestPointInBox (p, box); + +@@ -76,9 +75,10 @@ closestPointOnBox (const Vec3& p, const Box>& box) IMATH_NOEXCEPT + Vec3 d1 = p - box.min; + Vec3 d2 = box.max - p; + +- Vec3 d ((d1.x < d2.x) ? d1.x : d2.x, +- (d1.y < d2.y) ? d1.y : d2.y, +- (d1.z < d2.z) ? d1.z : d2.z); ++ Vec3 d ( ++ (d1.x < d2.x) ? d1.x : d2.x, ++ (d1.y < d2.y) ? d1.y : d2.y, ++ (d1.z < d2.z) ? d1.z : d2.z); + + if (d.x < d.y && d.x < d.z) + { +@@ -113,8 +113,7 @@ template + IMATH_HOSTDEVICE Box> + transform (const Box>& box, const Matrix44& m) IMATH_NOEXCEPT + { +- if (box.isEmpty() || box.isInfinite()) +- return box; ++ if (box.isEmpty () || box.isInfinite ()) return box; + + // + // If the last column of m is (0 0 0 1) then m is an affine +@@ -192,12 +191,10 @@ transform (const Box>& box, const Matrix44& m) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE void +-transform (const Box>& box, const Matrix44& m, Box>& result) IMATH_NOEXCEPT ++transform (const Box>& box, const Matrix44& m, Box>& result) ++ IMATH_NOEXCEPT + { +- if (box.isEmpty() || box.isInfinite()) +- { +- return; +- } ++ if (box.isEmpty () || box.isInfinite ()) { return; } + + // + // If the last column of m is (0 0 0 1) then m is an affine +@@ -269,8 +266,7 @@ template + IMATH_HOSTDEVICE Box> + affineTransform (const Box>& box, const Matrix44& m) IMATH_NOEXCEPT + { +- if (box.isEmpty() || box.isInfinite()) +- return box; ++ if (box.isEmpty () || box.isInfinite ()) return box; + + Box> newBox; + +@@ -303,7 +299,7 @@ affineTransform (const Box>& box, const Matrix44& m) IMATH_NOEXCEPT + + /// + /// Transform a 3D box by a matrix whose rightmost column is +-/// `(0 0 0 1)`, and compute a new box that tightly encloses ++/// `(0 0 0 1)`, and compute a new box that tightly encloses + /// the transformed box. Return the transformed box in the `result` + /// argument. + /// +@@ -315,17 +311,20 @@ affineTransform (const Box>& box, const Matrix44& m) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE void +-affineTransform (const Box>& box, const Matrix44& m, Box>& result) IMATH_NOEXCEPT ++affineTransform ( ++ const Box>& box, ++ const Matrix44& m, ++ Box>& result) IMATH_NOEXCEPT + { +- if (box.isEmpty()) ++ if (box.isEmpty ()) + { +- result.makeEmpty(); ++ result.makeEmpty (); + return; + } + +- if (box.isInfinite()) ++ if (box.isInfinite ()) + { +- result.makeInfinite(); ++ result.makeInfinite (); + return; + } + +@@ -369,9 +368,11 @@ affineTransform (const Box>& box, const Matrix44& m, Box>& re + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool +-findEntryAndExitPoints (const Line3& r, const Box>& b, Vec3& entry, Vec3& exit) IMATH_NOEXCEPT ++findEntryAndExitPoints ( ++ const Line3& r, const Box>& b, Vec3& entry, Vec3& exit) ++ IMATH_NOEXCEPT + { +- if (b.isEmpty()) ++ if (b.isEmpty ()) + { + // + // No ray intersects an empty box +@@ -398,7 +399,7 @@ findEntryAndExitPoints (const Line3& r, const Box>& b, Vec3& entry + // exit point. + // + +- const T TMAX = std::numeric_limits::max(); ++ const T TMAX = std::numeric_limits::max (); + + T tFrontMax = -TMAX; + T tBackMin = TMAX; +@@ -412,7 +413,8 @@ findEntryAndExitPoints (const Line3& r, const Box>& b, Vec3& entry + T d1 = b.max.x - r.pos.x; + T d2 = b.min.x - r.pos.x; + +- if (r.dir.x > 1 || (abs (d1) < TMAX * r.dir.x && abs (d2) < TMAX * r.dir.x)) ++ if (r.dir.x > 1 || ++ (abs (d1) < TMAX * r.dir.x && abs (d2) < TMAX * r.dir.x)) + { + T t1 = d1 / r.dir.x; + T t2 = d2 / r.dir.x; +@@ -445,7 +447,8 @@ findEntryAndExitPoints (const Line3& r, const Box>& b, Vec3& entry + T d1 = b.min.x - r.pos.x; + T d2 = b.max.x - r.pos.x; + +- if (r.dir.x < -1 || (abs (d1) < -TMAX * r.dir.x && abs (d2) < -TMAX * r.dir.x)) ++ if (r.dir.x < -1 || ++ (abs (d1) < -TMAX * r.dir.x && abs (d2) < -TMAX * r.dir.x)) + { + T t1 = d1 / r.dir.x; + T t2 = d2 / r.dir.x; +@@ -483,7 +486,8 @@ findEntryAndExitPoints (const Line3& r, const Box>& b, Vec3& entry + T d1 = b.max.y - r.pos.y; + T d2 = b.min.y - r.pos.y; + +- if (r.dir.y > 1 || (abs (d1) < TMAX * r.dir.y && abs (d2) < TMAX * r.dir.y)) ++ if (r.dir.y > 1 || ++ (abs (d1) < TMAX * r.dir.y && abs (d2) < TMAX * r.dir.y)) + { + T t1 = d1 / r.dir.y; + T t2 = d2 / r.dir.y; +@@ -516,7 +520,8 @@ findEntryAndExitPoints (const Line3& r, const Box>& b, Vec3& entry + T d1 = b.min.y - r.pos.y; + T d2 = b.max.y - r.pos.y; + +- if (r.dir.y < -1 || (abs (d1) < -TMAX * r.dir.y && abs (d2) < -TMAX * r.dir.y)) ++ if (r.dir.y < -1 || ++ (abs (d1) < -TMAX * r.dir.y && abs (d2) < -TMAX * r.dir.y)) + { + T t1 = d1 / r.dir.y; + T t2 = d2 / r.dir.y; +@@ -554,7 +559,8 @@ findEntryAndExitPoints (const Line3& r, const Box>& b, Vec3& entry + T d1 = b.max.z - r.pos.z; + T d2 = b.min.z - r.pos.z; + +- if (r.dir.z > 1 || (abs (d1) < TMAX * r.dir.z && abs (d2) < TMAX * r.dir.z)) ++ if (r.dir.z > 1 || ++ (abs (d1) < TMAX * r.dir.z && abs (d2) < TMAX * r.dir.z)) + { + T t1 = d1 / r.dir.z; + T t2 = d2 / r.dir.z; +@@ -587,7 +593,8 @@ findEntryAndExitPoints (const Line3& r, const Box>& b, Vec3& entry + T d1 = b.min.z - r.pos.z; + T d2 = b.max.z - r.pos.z; + +- if (r.dir.z < -1 || (abs (d1) < -TMAX * r.dir.z && abs (d2) < -TMAX * r.dir.z)) ++ if (r.dir.z < -1 || ++ (abs (d1) < -TMAX * r.dir.z && abs (d2) < -TMAX * r.dir.z)) + { + T t1 = d1 / r.dir.z; + T t2 = d2 / r.dir.z; +@@ -639,9 +646,10 @@ findEntryAndExitPoints (const Line3& r, const Box>& b, Vec3& entry + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool +-intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEPT ++intersects (const Box>& b, const Line3& r, Vec3& ip) ++ IMATH_NOEXCEPT + { +- if (b.isEmpty()) ++ if (b.isEmpty ()) + { + // + // No ray intersects an empty box +@@ -673,7 +681,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + // intersection is the ray-box intersection. + // + +- const T TMAX = std::numeric_limits::max(); ++ const T TMAX = std::numeric_limits::max (); + + T tFrontMax = -1; + T tBackMin = TMAX; +@@ -684,8 +692,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + + if (r.dir.x > 0) + { +- if (r.pos.x > b.max.x) +- return false; ++ if (r.pos.x > b.max.x) return false; + + T d = b.max.x - r.pos.x; + +@@ -693,8 +700,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + { + T t = d / r.dir.x; + +- if (tBackMin > t) +- tBackMin = t; ++ if (tBackMin > t) tBackMin = t; + } + + if (r.pos.x <= b.min.x) +@@ -714,8 +720,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + } + else if (r.dir.x < 0) + { +- if (r.pos.x < b.min.x) +- return false; ++ if (r.pos.x < b.min.x) return false; + + T d = b.min.x - r.pos.x; + +@@ -723,8 +728,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + { + T t = d / r.dir.x; + +- if (tBackMin > t) +- tBackMin = t; ++ if (tBackMin > t) tBackMin = t; + } + + if (r.pos.x >= b.max.x) +@@ -744,8 +748,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + } + else // r.dir.x == 0 + { +- if (r.pos.x < b.min.x || r.pos.x > b.max.x) +- return false; ++ if (r.pos.x < b.min.x || r.pos.x > b.max.x) return false; + } + + // +@@ -754,8 +757,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + + if (r.dir.y > 0) + { +- if (r.pos.y > b.max.y) +- return false; ++ if (r.pos.y > b.max.y) return false; + + T d = b.max.y - r.pos.y; + +@@ -763,8 +765,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + { + T t = d / r.dir.y; + +- if (tBackMin > t) +- tBackMin = t; ++ if (tBackMin > t) tBackMin = t; + } + + if (r.pos.y <= b.min.y) +@@ -784,8 +785,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + } + else if (r.dir.y < 0) + { +- if (r.pos.y < b.min.y) +- return false; ++ if (r.pos.y < b.min.y) return false; + + T d = b.min.y - r.pos.y; + +@@ -793,8 +793,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + { + T t = d / r.dir.y; + +- if (tBackMin > t) +- tBackMin = t; ++ if (tBackMin > t) tBackMin = t; + } + + if (r.pos.y >= b.max.y) +@@ -814,8 +813,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + } + else // r.dir.y == 0 + { +- if (r.pos.y < b.min.y || r.pos.y > b.max.y) +- return false; ++ if (r.pos.y < b.min.y || r.pos.y > b.max.y) return false; + } + + // +@@ -824,8 +822,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + + if (r.dir.z > 0) + { +- if (r.pos.z > b.max.z) +- return false; ++ if (r.pos.z > b.max.z) return false; + + T d = b.max.z - r.pos.z; + +@@ -833,8 +830,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + { + T t = d / r.dir.z; + +- if (tBackMin > t) +- tBackMin = t; ++ if (tBackMin > t) tBackMin = t; + } + + if (r.pos.z <= b.min.z) +@@ -854,8 +850,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + } + else if (r.dir.z < 0) + { +- if (r.pos.z < b.min.z) +- return false; ++ if (r.pos.z < b.min.z) return false; + + T d = b.min.z - r.pos.z; + +@@ -863,8 +858,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + { + T t = d / r.dir.z; + +- if (tBackMin > t) +- tBackMin = t; ++ if (tBackMin > t) tBackMin = t; + } + + if (r.pos.z >= b.max.z) +@@ -884,8 +878,7 @@ intersects (const Box>& b, const Line3& r, Vec3& ip) IMATH_NOEXCEP + } + else // r.dir.z == 0 + { +- if (r.pos.z < b.min.z || r.pos.z > b.max.z) +- return false; ++ if (r.pos.z < b.min.z || r.pos.z > b.max.z) return false; + } + + return tFrontMax <= tBackMin; +diff --git a/src/Imath/ImathColor.h b/src/Imath/ImathColor.h +index f4f7a9a..3674dee 100644 +--- a/src/Imath/ImathColor.h ++++ b/src/Imath/ImathColor.h +@@ -29,84 +29,95 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class IMATH_EXPORT_TEMPLATE_TYPE Color3 : public Vec3 + { +- public: +- ++public: + /// @{ + /// @name Constructors and Assignemt + + /// No initialization by default +- IMATH_HOSTDEVICE Color3() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Color3 () IMATH_NOEXCEPT; + + /// Initialize to (a a a) +- IMATH_HOSTDEVICE constexpr explicit Color3 (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr explicit Color3 (T a) IMATH_NOEXCEPT; + + /// Initialize to (a b c) +- IMATH_HOSTDEVICE constexpr Color3 (T a, T b, T c) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color3 (T a, T b, T c) IMATH_NOEXCEPT; + + /// Construct from Color3 +- IMATH_HOSTDEVICE constexpr Color3 (const Color3& c) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color3 (const Color3& c) IMATH_NOEXCEPT; + + /// Construct from Vec3 +- template IMATH_HOSTDEVICE constexpr Color3 (const Vec3& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr Color3 (const Vec3& v) IMATH_NOEXCEPT; + + /// Destructor +- IMATH_HOSTDEVICE ~Color3() = default; ++ IMATH_HOSTDEVICE ~Color3 () = default; + + /// Component-wise assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator= (const Color3& c) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& ++ operator= (const Color3& c) IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Arithmetic +- ++ + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator+= (const Color3& c) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& ++ operator+= (const Color3& c) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE constexpr Color3 operator+ (const Color3& c) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color3 ++ operator+ (const Color3& c) const IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator-= (const Color3& c) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& ++ operator-= (const Color3& c) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE constexpr Color3 operator- (const Color3& c) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color3 ++ operator- (const Color3& c) const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE constexpr Color3 operator-() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color3 operator- () const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& negate() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& negate () IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator*= (const Color3& c) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& ++ operator*= (const Color3& c) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator*= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& ++ operator*= (T a) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE constexpr Color3 operator* (const Color3& c) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color3 ++ operator* (const Color3& c) const IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE constexpr Color3 operator* (T a) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color3 operator* (T a) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator/= (const Color3& c) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& ++ operator/= (const Color3& c) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& operator/= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3& ++ operator/= (T a) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE constexpr Color3 operator/ (const Color3& c) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color3 ++ operator/ (const Color3& c) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE constexpr Color3 operator/ (T a) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color3 operator/ (T a) const IMATH_NOEXCEPT; + + /// @} + }; + + /// +-/// A 4-channel color class: 3 channels plus alpha. ++/// A 4-channel color class: 3 channels plus alpha. + /// + /// For convenience, the fields are named `r`, `g`, and `b`, although + /// this class does not impose interpretation on the channels, which +@@ -115,8 +126,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Color3 : public Vec3 + + template class IMATH_EXPORT_TEMPLATE_TYPE Color4 + { +- public: +- ++public: + /// @{ + /// @name Direct access to elements + +@@ -128,107 +138,140 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Color4 + /// @name Constructors and Assignment + + /// No initialization by default +- IMATH_HOSTDEVICE Color4() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Color4 () IMATH_NOEXCEPT; + + /// Initialize to `(a a a a)` +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 explicit Color4 (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 explicit Color4 (T a) IMATH_NOEXCEPT; + + /// Initialize to `(a b c d)` +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (T a, T b, T c, T d) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (T a, T b, T c, T d) ++ IMATH_NOEXCEPT; + + /// Construct from Color4 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (const Color4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (const Color4& v) IMATH_NOEXCEPT; + + /// Construct from Color4 +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (const Color4& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 (const Color4& v) ++ IMATH_NOEXCEPT; + + /// Destructor +- IMATH_HOSTDEVICE ~Color4() = default; ++ IMATH_HOSTDEVICE ~Color4 () = default; + + /// Assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator= (const Color4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& ++ operator= (const Color4& v) IMATH_NOEXCEPT; + + /// Component-wise value +- IMATH_HOSTDEVICE T& operator[] (int i) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T& operator[] (int i) IMATH_NOEXCEPT; + + /// Component-wise value +- IMATH_HOSTDEVICE const T& operator[] (int i) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const T& operator[] (int i) const IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Arithmetic and Comparison +- ++ + /// Equality +- template IMATH_HOSTDEVICE constexpr bool operator== (const Color4& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Color4& v) const IMATH_NOEXCEPT; + + /// Inequality +- template IMATH_HOSTDEVICE constexpr bool operator!= (const Color4& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Color4& v) const IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator+= (const Color4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& ++ operator+= (const Color4& v) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE constexpr Color4 operator+ (const Color4& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color4 ++ operator+ (const Color4& v) const IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator-= (const Color4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& ++ operator-= (const Color4& v) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE constexpr Color4 operator- (const Color4& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color4 ++ operator- (const Color4& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE constexpr Color4 operator-() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color4 operator- () const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& negate() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& negate () IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator*= (const Color4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& ++ operator*= (const Color4& v) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator*= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& ++ operator*= (T a) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE constexpr Color4 operator* (const Color4& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color4 ++ operator* (const Color4& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE constexpr Color4 operator* (T a) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color4 operator* (T a) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator/= (const Color4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& ++ operator/= (const Color4& v) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& operator/= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color4& ++ operator/= (T a) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE constexpr Color4 operator/ (const Color4& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color4 ++ operator/ (const Color4& v) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE constexpr Color4 operator/ (T a) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Color4 operator/ (T a) const IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Numeric Limits +- ++ + /// Number of dimensions (channels), i.e. 4 for a Color4 +- IMATH_HOSTDEVICE constexpr static unsigned int dimensions() IMATH_NOEXCEPT { return 4; } ++ IMATH_HOSTDEVICE constexpr static unsigned int dimensions () IMATH_NOEXCEPT ++ { ++ return 4; ++ } + + /// Largest possible negative value +- IMATH_HOSTDEVICE constexpr static T baseTypeLowest() IMATH_NOEXCEPT { return std::numeric_limits::lowest(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeLowest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::lowest (); ++ } + + /// Largest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeMax() IMATH_NOEXCEPT { return std::numeric_limits::max(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeMax () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::max (); ++ } + + /// Smallest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeSmallest() IMATH_NOEXCEPT { return std::numeric_limits::min(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeSmallest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::min (); ++ } + + /// Smallest possible e for which 1+e != 1 +- IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon() IMATH_NOEXCEPT { return std::numeric_limits::epsilon(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::epsilon (); ++ } + + /// @} +- ++ + /// The base type: In templates that accept a parameter `V` (could + /// be a Color4), you can refer to `T` as `V::BaseType` + typedef T BaseType; +@@ -237,32 +280,39 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Color4 + /// @name Compatibilty with Sb + + /// Set the value +- template IMATH_HOSTDEVICE void setValue (S a, S b, S c, S d) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void setValue (S a, S b, S c, S d) IMATH_NOEXCEPT; + + /// Set the value +- template IMATH_HOSTDEVICE void setValue (const Color4& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void setValue (const Color4& v) IMATH_NOEXCEPT; + + /// Return the value +- template IMATH_HOSTDEVICE void getValue (S& a, S& b, S& c, S& d) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void ++ getValue (S& a, S& b, S& c, S& d) const IMATH_NOEXCEPT; + + /// Return the value +- template IMATH_HOSTDEVICE void getValue (Color4& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void getValue (Color4& v) const IMATH_NOEXCEPT; + + /// Return raw pointer to the value +- IMATH_HOSTDEVICE T* getValue() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T* getValue () IMATH_NOEXCEPT; + + /// Return raw pointer to the value +- IMATH_HOSTDEVICE const T* getValue() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const T* getValue () const IMATH_NOEXCEPT; + + /// @} + }; + + /// Stream output, as "(r g b a)" +-template std::ostream& operator<< (std::ostream& s, const Color4& v); ++template ++std::ostream& operator<< (std::ostream& s, const Color4& v); + + /// Reverse multiplication: S * Color4 + template +-IMATH_HOSTDEVICE constexpr Color4 operator* (S a, const Color4& v) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Color4 ++operator* (S a, const Color4& v) IMATH_NOEXCEPT; + + /// 3 float channels + typedef Color3 Color3f; +@@ -307,29 +357,37 @@ typedef unsigned int PackedColor; + // Implementation of Color3 + // + +-template IMATH_HOSTDEVICE inline Color3::Color3() IMATH_NOEXCEPT : Vec3() ++template ++IMATH_HOSTDEVICE inline Color3::Color3 () IMATH_NOEXCEPT : Vec3 () + { + // empty + } + +-template IMATH_HOSTDEVICE constexpr inline Color3::Color3 (T a) IMATH_NOEXCEPT : Vec3 (a) ++template ++IMATH_HOSTDEVICE constexpr inline Color3::Color3 (T a) IMATH_NOEXCEPT ++ : Vec3 (a) + { + // empty + } + +-template IMATH_HOSTDEVICE constexpr inline Color3::Color3 (T a, T b, T c) IMATH_NOEXCEPT : Vec3 (a, b, c) ++template ++IMATH_HOSTDEVICE constexpr inline Color3::Color3 (T a, T b, T c) ++ IMATH_NOEXCEPT : Vec3 (a, b, c) + { + // empty + } + +-template IMATH_HOSTDEVICE constexpr inline Color3::Color3 (const Color3& c) IMATH_NOEXCEPT : Vec3 (c) ++template ++IMATH_HOSTDEVICE constexpr inline Color3::Color3 (const Color3& c) ++ IMATH_NOEXCEPT : Vec3 (c) + { + // empty + } + + template + template +-IMATH_HOSTDEVICE constexpr inline Color3::Color3 (const Vec3& v) IMATH_NOEXCEPT : Vec3 (v) ++IMATH_HOSTDEVICE constexpr inline Color3::Color3 (const Vec3& v) ++ IMATH_NOEXCEPT : Vec3 (v) + { + //empty + } +@@ -374,16 +432,16 @@ Color3::operator- (const Color3& c) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline Color3 +-Color3::operator-() const IMATH_NOEXCEPT ++Color3::operator- () const IMATH_NOEXCEPT + { + return Color3 (-(*(Vec3*) this)); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color3& +-Color3::negate() IMATH_NOEXCEPT ++ Color3::negate () IMATH_NOEXCEPT + { +- ((Vec3*) this)->negate(); ++ ((Vec3*) this)->negate (); + return *this; + } + +@@ -465,8 +523,7 @@ Color4::operator[] (int i) const IMATH_NOEXCEPT + return (&r)[i]; + } + +-template +-IMATH_HOSTDEVICE inline Color4::Color4() IMATH_NOEXCEPT ++template IMATH_HOSTDEVICE inline Color4::Color4 () IMATH_NOEXCEPT + { + // empty + } +@@ -478,7 +535,8 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4::Color4 (T x) IMATH_NOEXCEPT + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4::Color4 (T x, T y, T z, T w) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4::Color4 (T x, T y, T z, T w) ++ IMATH_NOEXCEPT + { + r = x; + g = y; +@@ -487,7 +545,8 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4::Color4 (T x, T y, T z, T w) + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4::Color4 (const Color4& v) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE ++ IMATH_CONSTEXPR14 inline Color4::Color4 (const Color4& v) IMATH_NOEXCEPT + { + r = v.r; + g = v.g; +@@ -497,7 +556,8 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4::Color4 (const Color4& v) IM + + template + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4::Color4 (const Color4& v) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Color4::Color4 (const Color4& v) ++ IMATH_NOEXCEPT + { + r = T (v.r); + g = T (v.g); +@@ -562,14 +622,14 @@ Color4::getValue (Color4& v) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline T* +-Color4::getValue() IMATH_NOEXCEPT ++Color4::getValue () IMATH_NOEXCEPT + { + return (T*) &r; + } + + template + IMATH_HOSTDEVICE inline const T* +-Color4::getValue() const IMATH_NOEXCEPT ++Color4::getValue () const IMATH_NOEXCEPT + { + return (const T*) &r; + } +@@ -628,14 +688,14 @@ Color4::operator- (const Color4& v) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline Color4 +-Color4::operator-() const IMATH_NOEXCEPT ++Color4::operator- () const IMATH_NOEXCEPT + { + return Color4 (-r, -g, -b, -a); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Color4& +-Color4::negate() IMATH_NOEXCEPT ++ Color4::negate () IMATH_NOEXCEPT + { + r = -r; + g = -g; +diff --git a/src/Imath/ImathColorAlgo.cpp b/src/Imath/ImathColorAlgo.cpp +index ddc26ef..4ccb62a 100644 +--- a/src/Imath/ImathColorAlgo.cpp ++++ b/src/Imath/ImathColorAlgo.cpp +@@ -27,7 +27,7 @@ hsv2rgb_d (const Vec3& hsv) IMATH_NOEXCEPT + else + hue *= 6; + +- int i = int (std::floor (hue)); ++ int i = int (std::floor (hue)); + double f = hue - i; + double p = val * (1 - sat); + double q = val * (1 - (sat * f)); +@@ -35,36 +35,36 @@ hsv2rgb_d (const Vec3& hsv) IMATH_NOEXCEPT + + switch (i) + { +- case 0: +- x = val; +- y = t; +- z = p; +- break; +- case 1: +- x = q; +- y = val; +- z = p; +- break; +- case 2: +- x = p; +- y = val; +- z = t; +- break; +- case 3: +- x = p; +- y = q; +- z = val; +- break; +- case 4: +- x = t; +- y = p; +- z = val; +- break; +- case 5: +- x = val; +- y = p; +- z = q; +- break; ++ case 0: ++ x = val; ++ y = t; ++ z = p; ++ break; ++ case 1: ++ x = q; ++ y = val; ++ z = p; ++ break; ++ case 2: ++ x = p; ++ y = val; ++ z = t; ++ break; ++ case 3: ++ x = p; ++ y = q; ++ z = val; ++ break; ++ case 4: ++ x = t; ++ y = p; ++ z = val; ++ break; ++ case 5: ++ x = val; ++ y = p; ++ z = q; ++ break; + } + + return Vec3 (x, y, z); +@@ -84,7 +84,7 @@ hsv2rgb_d (const Color4& hsv) IMATH_NOEXCEPT + else + hue *= 6; + +- int i = int (std::floor (hue)); ++ int i = int (std::floor (hue)); + double f = hue - i; + double p = val * (1 - sat); + double q = val * (1 - (sat * f)); +@@ -92,36 +92,36 @@ hsv2rgb_d (const Color4& hsv) IMATH_NOEXCEPT + + switch (i) + { +- case 0: +- r = val; +- g = t; +- b = p; +- break; +- case 1: +- r = q; +- g = val; +- b = p; +- break; +- case 2: +- r = p; +- g = val; +- b = t; +- break; +- case 3: +- r = p; +- g = q; +- b = val; +- break; +- case 4: +- r = t; +- g = p; +- b = val; +- break; +- case 5: +- r = val; +- g = p; +- b = q; +- break; ++ case 0: ++ r = val; ++ g = t; ++ b = p; ++ break; ++ case 1: ++ r = q; ++ g = val; ++ b = p; ++ break; ++ case 2: ++ r = p; ++ g = val; ++ b = t; ++ break; ++ case 3: ++ r = p; ++ g = q; ++ b = val; ++ break; ++ case 4: ++ r = t; ++ g = p; ++ b = val; ++ break; ++ case 5: ++ r = val; ++ g = p; ++ b = q; ++ break; + } + + return Color4 (r, g, b, hsv.a); +@@ -141,8 +141,7 @@ rgb2hsv_d (const Vec3& c) IMATH_NOEXCEPT + double sat = 0; + double hue = 0; + +- if (max != 0) +- sat = range / max; ++ if (max != 0) sat = range / max; + + if (sat != 0) + { +@@ -157,8 +156,7 @@ rgb2hsv_d (const Vec3& c) IMATH_NOEXCEPT + + hue = h / 6.; + +- if (hue < 0.) +- hue += 1.0; ++ if (hue < 0.) hue += 1.0; + } + return Vec3 (hue, sat, val); + } +@@ -177,8 +175,7 @@ rgb2hsv_d (const Color4& c) IMATH_NOEXCEPT + double sat = 0; + double hue = 0; + +- if (max != 0) +- sat = range / max; ++ if (max != 0) sat = range / max; + + if (sat != 0) + { +@@ -193,8 +190,7 @@ rgb2hsv_d (const Color4& c) IMATH_NOEXCEPT + + hue = h / 6.; + +- if (hue < 0.) +- hue += 1.0; ++ if (hue < 0.) hue += 1.0; + } + return Color4 (hue, sat, val, c.a); + } +diff --git a/src/Imath/ImathColorAlgo.h b/src/Imath/ImathColorAlgo.h +index cfb08c5..cb56fff 100644 +--- a/src/Imath/ImathColorAlgo.h ++++ b/src/Imath/ImathColorAlgo.h +@@ -10,8 +10,8 @@ + #ifndef INCLUDED_IMATHCOLORALGO_H + #define INCLUDED_IMATHCOLORALGO_H + +-#include "ImathNamespace.h" + #include "ImathExport.h" ++#include "ImathNamespace.h" + + #include "ImathColor.h" + #include "ImathMath.h" +@@ -29,7 +29,8 @@ IMATH_EXPORT Vec3 hsv2rgb_d (const Vec3& hsv) IMATH_NOEXCEPT; + + /// + /// Convert 4-channel hsv to rgb (with alpha). Non-templated helper routine. +-IMATH_EXPORT Color4 hsv2rgb_d (const Color4& hsv) IMATH_NOEXCEPT; ++IMATH_EXPORT Color4 ++ hsv2rgb_d (const Color4& hsv) IMATH_NOEXCEPT; + + /// + /// Convert 3-channel rgb to hsv. Non-templated helper routine. +@@ -37,7 +38,8 @@ IMATH_EXPORT Vec3 rgb2hsv_d (const Vec3& rgb) IMATH_NOEXCEPT; + + /// + /// Convert 4-channel rgb to hsv. Non-templated helper routine. +-IMATH_EXPORT Color4 rgb2hsv_d (const Color4& rgb) IMATH_NOEXCEPT; ++IMATH_EXPORT Color4 ++ rgb2hsv_d (const Color4& rgb) IMATH_NOEXCEPT; + + /// + /// Convert 3-channel hsv to rgb. +@@ -45,17 +47,19 @@ IMATH_EXPORT Color4 rgb2hsv_d (const Color4& rgb) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 +-hsv2rgb (const Vec3& hsv) IMATH_NOEXCEPT ++ hsv2rgb (const Vec3& hsv) IMATH_NOEXCEPT + { + if (std::numeric_limits::is_integer) + { +- Vec3 v = Vec3 (hsv.x / double (std::numeric_limits::max()), +- hsv.y / double (std::numeric_limits::max()), +- hsv.z / double (std::numeric_limits::max())); ++ Vec3 v = Vec3 ( ++ hsv.x / double (std::numeric_limits::max ()), ++ hsv.y / double (std::numeric_limits::max ()), ++ hsv.z / double (std::numeric_limits::max ())); + Vec3 c = hsv2rgb_d (v); +- return Vec3 ((T) (c.x * std::numeric_limits::max()), +- (T) (c.y * std::numeric_limits::max()), +- (T) (c.z * std::numeric_limits::max())); ++ return Vec3 ( ++ (T) (c.x * std::numeric_limits::max ()), ++ (T) (c.y * std::numeric_limits::max ()), ++ (T) (c.z * std::numeric_limits::max ())); + } + else + { +@@ -71,19 +75,21 @@ hsv2rgb (const Vec3& hsv) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 +-hsv2rgb (const Color4& hsv) IMATH_NOEXCEPT ++ hsv2rgb (const Color4& hsv) IMATH_NOEXCEPT + { + if (std::numeric_limits::is_integer) + { +- Color4 v = Color4 (hsv.r / float (std::numeric_limits::max()), +- hsv.g / float (std::numeric_limits::max()), +- hsv.b / float (std::numeric_limits::max()), +- hsv.a / float (std::numeric_limits::max())); ++ Color4 v = Color4 ( ++ hsv.r / float (std::numeric_limits::max ()), ++ hsv.g / float (std::numeric_limits::max ()), ++ hsv.b / float (std::numeric_limits::max ()), ++ hsv.a / float (std::numeric_limits::max ())); + Color4 c = hsv2rgb_d (v); +- return Color4 ((T) (c.r * std::numeric_limits::max()), +- (T) (c.g * std::numeric_limits::max()), +- (T) (c.b * std::numeric_limits::max()), +- (T) (c.a * std::numeric_limits::max())); ++ return Color4 ( ++ (T) (c.r * std::numeric_limits::max ()), ++ (T) (c.g * std::numeric_limits::max ()), ++ (T) (c.b * std::numeric_limits::max ()), ++ (T) (c.a * std::numeric_limits::max ())); + } + else + { +@@ -99,17 +105,19 @@ hsv2rgb (const Color4& hsv) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 +-rgb2hsv (const Vec3& rgb) IMATH_NOEXCEPT ++ rgb2hsv (const Vec3& rgb) IMATH_NOEXCEPT + { + if (std::numeric_limits::is_integer) + { +- Vec3 v = Vec3 (rgb.x / double (std::numeric_limits::max()), +- rgb.y / double (std::numeric_limits::max()), +- rgb.z / double (std::numeric_limits::max())); ++ Vec3 v = Vec3 ( ++ rgb.x / double (std::numeric_limits::max ()), ++ rgb.y / double (std::numeric_limits::max ()), ++ rgb.z / double (std::numeric_limits::max ())); + Vec3 c = rgb2hsv_d (v); +- return Vec3 ((T) (c.x * std::numeric_limits::max()), +- (T) (c.y * std::numeric_limits::max()), +- (T) (c.z * std::numeric_limits::max())); ++ return Vec3 ( ++ (T) (c.x * std::numeric_limits::max ()), ++ (T) (c.y * std::numeric_limits::max ()), ++ (T) (c.z * std::numeric_limits::max ())); + } + else + { +@@ -125,19 +133,21 @@ rgb2hsv (const Vec3& rgb) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Color4 +-rgb2hsv (const Color4& rgb) IMATH_NOEXCEPT ++ rgb2hsv (const Color4& rgb) IMATH_NOEXCEPT + { + if (std::numeric_limits::is_integer) + { +- Color4 v = Color4 (rgb.r / float (std::numeric_limits::max()), +- rgb.g / float (std::numeric_limits::max()), +- rgb.b / float (std::numeric_limits::max()), +- rgb.a / float (std::numeric_limits::max())); ++ Color4 v = Color4 ( ++ rgb.r / float (std::numeric_limits::max ()), ++ rgb.g / float (std::numeric_limits::max ()), ++ rgb.b / float (std::numeric_limits::max ()), ++ rgb.a / float (std::numeric_limits::max ())); + Color4 c = rgb2hsv_d (v); +- return Color4 ((T) (c.r * std::numeric_limits::max()), +- (T) (c.g * std::numeric_limits::max()), +- (T) (c.b * std::numeric_limits::max()), +- (T) (c.a * std::numeric_limits::max())); ++ return Color4 ( ++ (T) (c.r * std::numeric_limits::max ()), ++ (T) (c.g * std::numeric_limits::max ()), ++ (T) (c.b * std::numeric_limits::max ()), ++ (T) (c.a * std::numeric_limits::max ())); + } + else + { +@@ -157,9 +167,9 @@ rgb2packed (const Vec3& c) IMATH_NOEXCEPT + { + if (std::numeric_limits::is_integer) + { +- float x = c.x / float (std::numeric_limits::max()); +- float y = c.y / float (std::numeric_limits::max()); +- float z = c.z / float (std::numeric_limits::max()); ++ float x = c.x / float (std::numeric_limits::max ()); ++ float y = c.y / float (std::numeric_limits::max ()); ++ float z = c.z / float (std::numeric_limits::max ()); + return rgb2packed (V3f (x, y, z)); + } + else +@@ -182,10 +192,10 @@ rgb2packed (const Color4& c) IMATH_NOEXCEPT + { + if (std::numeric_limits::is_integer) + { +- float r = c.r / float (std::numeric_limits::max()); +- float g = c.g / float (std::numeric_limits::max()); +- float b = c.b / float (std::numeric_limits::max()); +- float a = c.a / float (std::numeric_limits::max()); ++ float r = c.r / float (std::numeric_limits::max ()); ++ float g = c.g / float (std::numeric_limits::max ()); ++ float b = c.b / float (std::numeric_limits::max ()); ++ float a = c.a / float (std::numeric_limits::max ()); + return rgb2packed (C4f (r, g, b, a)); + } + else +@@ -210,7 +220,7 @@ packed2rgb (PackedColor packed, Vec3& out) IMATH_NOEXCEPT + { + if (std::numeric_limits::is_integer) + { +- T f = std::numeric_limits::max() / ((PackedColor) 0xFF); ++ T f = std::numeric_limits::max () / ((PackedColor) 0xFF); + out.x = (packed & 0xFF) * f; + out.y = ((packed & 0xFF00) >> 8) * f; + out.z = ((packed & 0xFF0000) >> 16) * f; +@@ -235,7 +245,7 @@ packed2rgb (PackedColor packed, Color4& out) IMATH_NOEXCEPT + { + if (std::numeric_limits::is_integer) + { +- T f = std::numeric_limits::max() / ((PackedColor) 0xFF); ++ T f = std::numeric_limits::max () / ((PackedColor) 0xFF); + out.r = (packed & 0xFF) * f; + out.g = ((packed & 0xFF00) >> 8) * f; + out.b = ((packed & 0xFF0000) >> 16) * f; +diff --git a/src/Imath/ImathEuler.h b/src/Imath/ImathEuler.h +index 5160a22..823fc6a 100644 +--- a/src/Imath/ImathEuler.h ++++ b/src/Imath/ImathEuler.h +@@ -119,12 +119,11 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3 + { +- public: ++public: + using Vec3::x; + using Vec3::y; + using Vec3::z; + +- + /// + /// All 24 possible orderings + /// +@@ -160,15 +159,16 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3 + // |||| + // VVVV + // ABCD +- // Legend: ++ // Legend: + // A -> Initial Axis (0==x, 1==y, 2==z) + // B -> Parity Even (1==true) + // C -> Initial Repeated (1==true) + // D -> Frame Static (1==true) + // + +- Legal = XYZ | XZY | YZX | YXZ | ZXY | ZYX | XZX | XYX | YXY | YZY | ZYZ | ZXZ | XYZr | +- XZYr | YZXr | YXZr | ZXYr | ZYXr | XZXr | XYXr | YXYr | YZYr | ZYZr | ZXZr, ++ Legal = XYZ | XZY | YZX | YXZ | ZXY | ZYX | XZX | XYX | YXY | YZY | ++ ZYZ | ZXZ | XYZr | XZYr | YZXr | YXZr | ZXYr | ZYXr | XZXr | ++ XYXr | YXYr | YZYr | ZYZr | ZXZr, + + Min = 0x0000, + Max = 0x2111, +@@ -188,7 +188,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3 + /// + /// Layout + /// +- ++ + enum IMATH_EXPORT_ENUM InputLayout + { + XYZLayout, +@@ -208,7 +208,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3 + /// function, defined in ImathMatrixAlgo.h. + + /// No initialization by default +- IMATH_HOSTDEVICE constexpr Euler() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Euler () IMATH_NOEXCEPT; + + /// Copy constructor + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Euler (const Euler&) IMATH_NOEXCEPT; +@@ -217,59 +217,75 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3 + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Euler (Order p) IMATH_NOEXCEPT; + + /// Construct from vector, order, layout +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Euler (const Vec3& v, +- Order o = Default, +- InputLayout l = IJKLayout) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Euler ( ++ const Vec3& v, ++ Order o = Default, ++ InputLayout l = IJKLayout) IMATH_NOEXCEPT; + /// Construct from explicit axes, order, layout + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 +- Euler (T i, T j, T k, Order o = Default, InputLayout l = IJKLayout) IMATH_NOEXCEPT; ++ Euler (T i, T j, T k, Order o = Default, InputLayout l = IJKLayout) ++ IMATH_NOEXCEPT; + + /// Copy constructor with new Order +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Euler (const Euler& euler, Order newp) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Euler (const Euler& euler, Order newp) ++ IMATH_NOEXCEPT; + + /// Construct from Matrix33 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Euler (const Matrix33&, Order o = Default) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Euler (const Matrix33&, Order o = Default) IMATH_NOEXCEPT; + + /// Construct from Matrix44 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Euler (const Matrix44&, Order o = Default) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Euler (const Matrix44&, Order o = Default) IMATH_NOEXCEPT; + + /// Destructor +- IMATH_HOSTDEVICE ~Euler() = default; ++ IMATH_HOSTDEVICE ~Euler () = default; + + /// @} +- ++ + /// @{ + /// @name Query +- ++ + /// Return whether the given value is a legal Order + IMATH_HOSTDEVICE constexpr static bool legal (Order) IMATH_NOEXCEPT; + + /// Return the order +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Order order() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Order order () const IMATH_NOEXCEPT; + + /// Return frameStatic +- IMATH_HOSTDEVICE constexpr bool frameStatic() const { return _frameStatic; } ++ IMATH_HOSTDEVICE constexpr bool frameStatic () const ++ { ++ return _frameStatic; ++ } + + /// Return intialRepeated +- IMATH_HOSTDEVICE constexpr bool initialRepeated() const { return _initialRepeated; } ++ IMATH_HOSTDEVICE constexpr bool initialRepeated () const ++ { ++ return _initialRepeated; ++ } + + /// Return partityEven +- IMATH_HOSTDEVICE constexpr bool parityEven() const { return _parityEven; } ++ IMATH_HOSTDEVICE constexpr bool parityEven () const { return _parityEven; } + +- /// Return initialAxis +- IMATH_HOSTDEVICE constexpr Axis initialAxis() const { return _initialAxis; } ++ /// Return initialAxis ++ IMATH_HOSTDEVICE constexpr Axis initialAxis () const ++ { ++ return _initialAxis; ++ } + + /// Unpack angles from ijk form +- IMATH_HOSTDEVICE void angleOrder (int& i, int& j, int& k) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ angleOrder (int& i, int& j, int& k) const IMATH_NOEXCEPT; + + /// Determine mapping from xyz to ijk (reshuffle the xyz to match the order) +- IMATH_HOSTDEVICE void angleMapping (int& i, int& j, int& k) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ angleMapping (int& i, int& j, int& k) const IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Set Value +- ++ + /// Set the order. This does NOT convert the angles, but it + /// does reorder the input vector. + IMATH_HOSTDEVICE void setOrder (Order) IMATH_NOEXCEPT; +@@ -279,19 +295,23 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3 + IMATH_HOSTDEVICE void setXYZVector (const Vec3&) IMATH_NOEXCEPT; + + /// Set the value. +- IMATH_HOSTDEVICE void set (Axis initial, bool relative, bool parityEven, bool firstRepeats) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ set (Axis initial, bool relative, bool parityEven, bool firstRepeats) ++ IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Assignments and Conversions + /// + + /// Assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Euler& operator= (const Euler&) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Euler& ++ operator= (const Euler&) IMATH_NOEXCEPT; + + /// Assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Euler& operator= (const Vec3&) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Euler& ++ operator= (const Vec3&) IMATH_NOEXCEPT; + + /// Assign from Matrix33, assumed to be affine + IMATH_HOSTDEVICE void extract (const Matrix33&) IMATH_NOEXCEPT; +@@ -303,21 +323,21 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3 + IMATH_HOSTDEVICE void extract (const Quat&) IMATH_NOEXCEPT; + + /// Convert to Matrix33 +- IMATH_HOSTDEVICE Matrix33 toMatrix33() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Matrix33 toMatrix33 () const IMATH_NOEXCEPT; + + /// Convert to Matrix44 +- IMATH_HOSTDEVICE Matrix44 toMatrix44() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Matrix44 toMatrix44 () const IMATH_NOEXCEPT; + + /// Convert to Quat +- IMATH_HOSTDEVICE Quat toQuat() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Quat toQuat () const IMATH_NOEXCEPT; + + /// Reorder the angles so that the X rotation comes first, + /// followed by the Y and Z in cases like XYX ordering, the + /// repeated angle will be in the "z" component +- IMATH_HOSTDEVICE Vec3 toXYZVector() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Vec3 toXYZVector () const IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Utility Methods + /// +@@ -326,15 +346,19 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3 + /// that is the intent). + + /// Convert an angle to its equivalent in [-PI, PI] +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 static float angleMod (T angle) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 static float ++ angleMod (T angle) IMATH_NOEXCEPT; + + /// Adjust xyzRot so that its components differ from targetXyzRot by no more than +/-PI +- IMATH_HOSTDEVICE static void simpleXYZRotation (Vec3& xyzRot, const Vec3& targetXyzRot) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE static void simpleXYZRotation ( ++ Vec3& xyzRot, const Vec3& targetXyzRot) IMATH_NOEXCEPT; + + /// Adjust xyzRot so that its components differ from targetXyzRot by as little as possible. + /// Note that xyz here really means ijk, because the order must be provided. +- IMATH_HOSTDEVICE static void +- nearestRotation (Vec3& xyzRot, const Vec3& targetXyzRot, Order order = XYZ) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE static void nearestRotation ( ++ Vec3& xyzRot, ++ const Vec3& targetXyzRot, ++ Order order = XYZ) IMATH_NOEXCEPT; + + /// Adjusts "this" Euler so that its components differ from target + /// by as little as possible. This method might not make sense for +@@ -344,23 +368,22 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Euler : public Vec3 + + /// @} + +- protected: +- ++protected: + /// relative or static rotations +- bool _frameStatic : 1; ++ bool _frameStatic : 1; + + /// init axis repeated as last +- bool _initialRepeated : 1; ++ bool _initialRepeated : 1; + + /// "parity of axis permutation" +- bool _parityEven : 1; ++ bool _parityEven : 1; + + #if defined _WIN32 || defined _WIN64 + /// First axis of rotation +- Axis _initialAxis; ++ Axis _initialAxis; + #else + /// First axis of rotation +- Axis _initialAxis : 2; ++ Axis _initialAxis : 2; + #endif + }; + +@@ -415,7 +438,7 @@ Euler::setXYZVector (const Vec3& v) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline Vec3 +-Euler::toXYZVector() const IMATH_NOEXCEPT ++Euler::toXYZVector () const IMATH_NOEXCEPT + { + int i, j, k; + angleMapping (i, j, k); +@@ -423,7 +446,7 @@ Euler::toXYZVector() const IMATH_NOEXCEPT + } + + template +-IMATH_HOSTDEVICE constexpr inline Euler::Euler() IMATH_NOEXCEPT ++IMATH_HOSTDEVICE constexpr inline Euler::Euler () IMATH_NOEXCEPT + : Vec3 (0, 0, 0), + _frameStatic (true), + _initialRepeated (false), +@@ -432,20 +455,21 @@ IMATH_HOSTDEVICE constexpr inline Euler::Euler() IMATH_NOEXCEPT + {} + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler (typename Euler::Order p) IMATH_NOEXCEPT +- : Vec3 (0, 0, 0), +- _frameStatic (true), +- _initialRepeated (false), +- _parityEven (true), +- _initialAxis (X) ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler ( ++ typename Euler::Order p) IMATH_NOEXCEPT : Vec3 (0, 0, 0), ++ _frameStatic (true), ++ _initialRepeated (false), ++ _parityEven (true), ++ _initialAxis (X) + { + setOrder (p); + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler (const Vec3& v, +- typename Euler::Order p, +- typename Euler::InputLayout l) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler ( ++ const Vec3& v, ++ typename Euler::Order p, ++ typename Euler::InputLayout l) IMATH_NOEXCEPT + { + setOrder (p); + if (l == XYZLayout) +@@ -459,23 +483,28 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler (const Vec3& v, + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler (const Euler& euler) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler ( ++ const Euler& euler) IMATH_NOEXCEPT + { + operator= (euler); + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler (const Euler& euler, Order p) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler ( ++ const Euler& euler, Order p) IMATH_NOEXCEPT + { + setOrder (p); +- Matrix33 M = euler.toMatrix33(); ++ Matrix33 M = euler.toMatrix33 (); + extract (M); + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline +-Euler::Euler (T xi, T yi, T zi, typename Euler::Order p, +- typename Euler::InputLayout l) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler ( ++ T xi, ++ T yi, ++ T zi, ++ typename Euler::Order p, ++ typename Euler::InputLayout l) IMATH_NOEXCEPT + { + setOrder (p); + if (l == XYZLayout) +@@ -489,14 +518,16 @@ Euler::Euler (T xi, T yi, T zi, typename Euler::Order p, + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler (const Matrix33& M, typename Euler::Order p) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler ( ++ const Matrix33& M, typename Euler::Order p) IMATH_NOEXCEPT + { + setOrder (p); + extract (M); + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler (const Matrix44& M, typename Euler::Order p) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Euler::Euler ( ++ const Matrix44& M, typename Euler::Order p) IMATH_NOEXCEPT + { + setOrder (p); + extract (M); +@@ -506,7 +537,7 @@ template + IMATH_HOSTDEVICE inline void + Euler::extract (const Quat& q) IMATH_NOEXCEPT + { +- extract (q.toMatrix33()); ++ extract (q.toMatrix33 ()); + } + + template +@@ -536,22 +567,23 @@ Euler::extract (const Matrix33& M) IMATH_NOEXCEPT + Matrix44 N; + N.rotate (r); + +- N = N * Matrix44 (M[0][0], +- M[0][1], +- M[0][2], +- 0, +- M[1][0], +- M[1][1], +- M[1][2], +- 0, +- M[2][0], +- M[2][1], +- M[2][2], +- 0, +- 0, +- 0, +- 0, +- 1); ++ N = N * Matrix44 ( ++ M[0][0], ++ M[0][1], ++ M[0][2], ++ 0, ++ M[1][0], ++ M[1][1], ++ M[1][2], ++ 0, ++ M[2][0], ++ M[2][1], ++ M[2][2], ++ 0, ++ 0, ++ 0, ++ 0, ++ 1); + // + // Extract the other two angles, y and z, from N. + // +@@ -580,22 +612,23 @@ Euler::extract (const Matrix33& M) IMATH_NOEXCEPT + Matrix44 N; + N.rotate (r); + +- N = N * Matrix44 (M[0][0], +- M[0][1], +- M[0][2], +- 0, +- M[1][0], +- M[1][1], +- M[1][2], +- 0, +- M[2][0], +- M[2][1], +- M[2][2], +- 0, +- 0, +- 0, +- 0, +- 1); ++ N = N * Matrix44 ( ++ M[0][0], ++ M[0][1], ++ M[0][2], ++ 0, ++ M[1][0], ++ M[1][1], ++ M[1][2], ++ 0, ++ M[2][0], ++ M[2][1], ++ M[2][2], ++ 0, ++ 0, ++ 0, ++ 0, ++ 1); + // + // Extract the other two angles, y and z, from N. + // +@@ -605,8 +638,7 @@ Euler::extract (const Matrix33& M) IMATH_NOEXCEPT + z = std::atan2 (-N[j][i], N[j][j]); + } + +- if (!_parityEven) +- *this *= -1; ++ if (!_parityEven) *this *= -1; + + if (!_frameStatic) + { +@@ -682,8 +714,7 @@ Euler::extract (const Matrix44& M) IMATH_NOEXCEPT + z = std::atan2 (-N[j][i], N[j][j]); + } + +- if (!_parityEven) +- *this *= -1; ++ if (!_parityEven) *this *= -1; + + if (!_frameStatic) + { +@@ -695,7 +726,7 @@ Euler::extract (const Matrix44& M) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE Matrix33 +-Euler::toMatrix33() const IMATH_NOEXCEPT ++ Euler::toMatrix33 () const IMATH_NOEXCEPT + { + int i, j, k; + angleOrder (i, j, k); +@@ -707,8 +738,7 @@ Euler::toMatrix33() const IMATH_NOEXCEPT + else + angles = Vec3 (z, y, x); + +- if (!_parityEven) +- angles *= -1.0; ++ if (!_parityEven) angles *= -1.0; + + T ci = std::cos (angles.x); + T cj = std::cos (angles.y); +@@ -754,7 +784,7 @@ Euler::toMatrix33() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE Matrix44 +-Euler::toMatrix44() const IMATH_NOEXCEPT ++ Euler::toMatrix44 () const IMATH_NOEXCEPT + { + int i, j, k; + angleOrder (i, j, k); +@@ -766,8 +796,7 @@ Euler::toMatrix44() const IMATH_NOEXCEPT + else + angles = Vec3 (z, y, x); + +- if (!_parityEven) +- angles *= -1.0; ++ if (!_parityEven) angles *= -1.0; + + T ci = std::cos (angles.x); + T cj = std::cos (angles.y); +@@ -813,10 +842,10 @@ Euler::toMatrix44() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE Quat +-Euler::toQuat() const IMATH_NOEXCEPT ++ Euler::toQuat () const IMATH_NOEXCEPT + { + Vec3 angles; +- int i, j, k; ++ int i, j, k; + angleOrder (i, j, k); + + if (_frameStatic) +@@ -824,8 +853,7 @@ Euler::toQuat() const IMATH_NOEXCEPT + else + angles = Vec3 (z, y, x); + +- if (!_parityEven) +- angles.y = -angles.y; ++ if (!_parityEven) angles.y = -angles.y; + + T ti = angles.x * 0.5; + T tj = angles.y * 0.5; +@@ -848,15 +876,17 @@ Euler::toQuat() const IMATH_NOEXCEPT + + if (_initialRepeated) + { +- a[i] = cj * (cs + sc); +- a[j] = sj * (cc + ss) * parity, // NOSONAR - suppress SonarCloud bug report. ++ a[i] = cj * (cs + sc); ++ a[j] = sj * (cc + ss) * ++ parity, // NOSONAR - suppress SonarCloud bug report. + a[k] = sj * (cs - sc); + q.r = cj * (cc - ss); + } + else + { +- a[i] = cj * sc - sj * cs, +- a[j] = (cj * ss + sj * cc) * parity, // NOSONAR - suppress SonarCloud bug report. ++ a[i] = cj * sc - sj * cs, ++ a[j] = (cj * ss + sj * cc) * ++ parity, // NOSONAR - suppress SonarCloud bug report. + a[k] = cj * cs - sj * sc; + q.r = cj * cc + sj * ss; + } +@@ -875,16 +905,13 @@ Euler::legal (typename Euler::Order order) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 typename Euler::Order +-Euler::order() const IMATH_NOEXCEPT ++ Euler::order () const IMATH_NOEXCEPT + { + int foo = (_initialAxis == Z ? 0x2000 : (_initialAxis == Y ? 0x1000 : 0)); + +- if (_parityEven) +- foo |= 0x0100; +- if (_initialRepeated) +- foo |= 0x0010; +- if (_frameStatic) +- foo++; ++ if (_parityEven) foo |= 0x0100; ++ if (_initialRepeated) foo |= 0x0010; ++ if (_frameStatic) foo++; + + return (Order) foo; + } +@@ -893,15 +920,20 @@ template + IMATH_HOSTDEVICE inline void + Euler::setOrder (typename Euler::Order p) IMATH_NOEXCEPT + { +- set (p & 0x2000 ? Z : (p & 0x1000 ? Y : X), // initial axis +- !(p & 0x1), // static? +- !!(p & 0x100), // permutation even? +- !!(p & 0x10)); // initial repeats? ++ set ( ++ p & 0x2000 ? Z : (p & 0x1000 ? Y : X), // initial axis ++ !(p & 0x1), // static? ++ !!(p & 0x100), // permutation even? ++ !!(p & 0x10)); // initial repeats? + } + + template + IMATH_HOSTDEVICE inline void +-Euler::set (typename Euler::Axis axis, bool relative, bool parityEven, bool firstRepeats) IMATH_NOEXCEPT ++Euler::set ( ++ typename Euler::Axis axis, ++ bool relative, ++ bool parityEven, ++ bool firstRepeats) IMATH_NOEXCEPT + { + _initialAxis = axis; + _frameStatic = !relative; +@@ -940,17 +972,16 @@ Euler::angleMod (T angle) IMATH_NOEXCEPT + const T pi = static_cast (M_PI); + angle = fmod (T (angle), T (2 * pi)); + +- if (angle < -pi) +- angle += 2 * pi; +- if (angle > +pi) +- angle -= 2 * pi; ++ if (angle < -pi) angle += 2 * pi; ++ if (angle > +pi) angle -= 2 * pi; + + return angle; + } + + template + IMATH_HOSTDEVICE inline void +-Euler::simpleXYZRotation (Vec3& xyzRot, const Vec3& targetXyzRot) IMATH_NOEXCEPT ++Euler::simpleXYZRotation (Vec3& xyzRot, const Vec3& targetXyzRot) ++ IMATH_NOEXCEPT + { + Vec3 d = xyzRot - targetXyzRot; + xyzRot[0] = targetXyzRot[0] + angleMod (d[0]); +@@ -960,9 +991,10 @@ Euler::simpleXYZRotation (Vec3& xyzRot, const Vec3& targetXyzRot) IMATH + + template + IMATH_HOSTDEVICE void +-Euler::nearestRotation (Vec3& xyzRot, const Vec3& targetXyzRot, Order order) IMATH_NOEXCEPT ++Euler::nearestRotation ( ++ Vec3& xyzRot, const Vec3& targetXyzRot, Order order) IMATH_NOEXCEPT + { +- int i, j, k; ++ int i, j, k; + Euler e (0, 0, 0, order); + e.angleOrder (i, j, k); + +@@ -975,34 +1007,31 @@ Euler::nearestRotation (Vec3& xyzRot, const Vec3& targetXyzRot, Order o + + simpleXYZRotation (otherXyzRot, targetXyzRot); + +- Vec3 d = xyzRot - targetXyzRot; +- Vec3 od = otherXyzRot - targetXyzRot; +- T dMag = d.dot (d); +- T odMag = od.dot (od); ++ Vec3 d = xyzRot - targetXyzRot; ++ Vec3 od = otherXyzRot - targetXyzRot; ++ T dMag = d.dot (d); ++ T odMag = od.dot (od); + +- if (odMag < dMag) +- { +- xyzRot = otherXyzRot; +- } ++ if (odMag < dMag) { xyzRot = otherXyzRot; } + } + + template + IMATH_HOSTDEVICE void + Euler::makeNear (const Euler& target) IMATH_NOEXCEPT + { +- Vec3 xyzRot = toXYZVector(); ++ Vec3 xyzRot = toXYZVector (); + Vec3 targetXyz; +- if (order() != target.order()) ++ if (order () != target.order ()) + { +- Euler targetSameOrder = Euler (target, order()); +- targetXyz = targetSameOrder.toXYZVector(); ++ Euler targetSameOrder = Euler (target, order ()); ++ targetXyz = targetSameOrder.toXYZVector (); + } + else + { +- targetXyz = target.toXYZVector(); ++ targetXyz = target.toXYZVector (); + } + +- nearestRotation (xyzRot, targetXyz, order()); ++ nearestRotation (xyzRot, targetXyz, order ()); + + setXYZVector (xyzRot); + } +@@ -1014,24 +1043,22 @@ template + std::ostream& + operator<< (std::ostream& o, const Euler& euler) + { +- char a[3] = { 'X', 'Y', 'Z' }; ++ char a[3] = {'X', 'Y', 'Z'}; + +- const char* r = euler.frameStatic() ? "" : "r"; +- int i, j, k; ++ const char* r = euler.frameStatic () ? "" : "r"; ++ int i, j, k; + euler.angleOrder (i, j, k); + +- if (euler.initialRepeated()) +- k = i; ++ if (euler.initialRepeated ()) k = i; + +- return o << "(" << euler.x << " " << euler.y << " " << euler.z << " " << a[i] << a[j] << a[k] +- << r << ")"; ++ return o << "(" << euler.x << " " << euler.y << " " << euler.z << " " ++ << a[i] << a[j] << a[k] << r << ")"; + } + + #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER + # pragma warning(pop) + #endif + +- + IMATH_INTERNAL_NAMESPACE_HEADER_EXIT + + #endif // INCLUDED_IMATHEULER_H +diff --git a/src/Imath/ImathExport.h b/src/Imath/ImathExport.h +index 8e7bb6a..846eb65 100644 +--- a/src/Imath/ImathExport.h ++++ b/src/Imath/ImathExport.h +@@ -18,7 +18,7 @@ + /// Imath only needs a couple of the possible macros outlined in the + /// above document, and due to it largely being inline only, does not + /// have much to do. +-/// ++/// + /// @{ + #if defined(IMATH_DLL) + +@@ -28,38 +28,39 @@ + // has some weirdness with DLLs and extern const, so we have to + // provide a macro to handle that. + +-# if defined(IMATH_EXPORTS) +-# define IMATH_EXPORT __declspec(dllexport) +-# define IMATH_EXPORT_CONST extern __declspec(dllexport) +-# else +-# define IMATH_EXPORT __declspec(dllimport) +-# define IMATH_EXPORT_CONST extern __declspec(dllimport) +-# endif ++# if defined(IMATH_EXPORTS) ++# define IMATH_EXPORT __declspec(dllexport) ++# define IMATH_EXPORT_CONST extern __declspec(dllexport) ++# else ++# define IMATH_EXPORT __declspec(dllimport) ++# define IMATH_EXPORT_CONST extern __declspec(dllimport) ++# endif + + // DLLs don't support these types of visibility controls, just leave them as empty +-# define IMATH_EXPORT_TYPE +-# define IMATH_EXPORT_ENUM +-# define IMATH_EXPORT_TEMPLATE_TYPE ++# define IMATH_EXPORT_TYPE ++# define IMATH_EXPORT_ENUM ++# define IMATH_EXPORT_TEMPLATE_TYPE + + #else + +-# ifdef IMATH_PUBLIC_SYMBOL_ATTRIBUTE +-# define IMATH_EXPORT IMATH_PUBLIC_SYMBOL_ATTRIBUTE +-# define IMATH_EXPORT_CONST extern const IMATH_PUBLIC_SYMBOL_ATTRIBUTE +-# else +-# define IMATH_EXPORT +-# define IMATH_EXPORT_CONST extern const +-# endif ++# ifdef IMATH_PUBLIC_SYMBOL_ATTRIBUTE ++# define IMATH_EXPORT IMATH_PUBLIC_SYMBOL_ATTRIBUTE ++# define IMATH_EXPORT_CONST extern const IMATH_PUBLIC_SYMBOL_ATTRIBUTE ++# else ++# define IMATH_EXPORT ++# define IMATH_EXPORT_CONST extern const ++# endif + +-# ifdef IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE +-# define IMATH_EXPORT_ENUM IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE +-# define IMATH_EXPORT_TEMPLATE_TYPE IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE +-# define IMATH_EXPORT_TYPE IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE +-# else +-# define IMATH_EXPORT_ENUM +-# define IMATH_EXPORT_TEMPLATE_TYPE IMATH_EXPORT +-# define IMATH_EXPORT_TYPE IMATH_EXPORT +-# endif ++# ifdef IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE ++# define IMATH_EXPORT_ENUM IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE ++# define IMATH_EXPORT_TEMPLATE_TYPE \ ++ IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE ++# define IMATH_EXPORT_TYPE IMATH_PUBLIC_TYPE_VISIBILITY_ATTRIBUTE ++# else ++# define IMATH_EXPORT_ENUM ++# define IMATH_EXPORT_TEMPLATE_TYPE IMATH_EXPORT ++# define IMATH_EXPORT_TYPE IMATH_EXPORT ++# endif + + #endif // IMATH_DLL + +diff --git a/src/Imath/ImathForward.h b/src/Imath/ImathForward.h +index 8741652..2ba9e7f 100644 +--- a/src/Imath/ImathForward.h ++++ b/src/Imath/ImathForward.h +@@ -6,8 +6,8 @@ + #ifndef INCLUDED_IMATHFORWARD_H + #define INCLUDED_IMATHFORWARD_H + +-#include "ImathNamespace.h" + #include "ImathExport.h" ++#include "ImathNamespace.h" + + IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + +diff --git a/src/Imath/ImathFrame.h b/src/Imath/ImathFrame.h +index 4d547fc..05e7bd7 100644 +--- a/src/Imath/ImathFrame.h ++++ b/src/Imath/ImathFrame.h +@@ -39,23 +39,25 @@ template class Matrix44; + /// + /// See Graphics Gems I for the underlying algorithm. + +- + template +-Matrix44 constexpr firstFrame (const Vec3&, // First point +- const Vec3&, // Second point +- const Vec3&) IMATH_NOEXCEPT; // Third point ++Matrix44 constexpr firstFrame ( ++ const Vec3&, // First point ++ const Vec3&, // Second point ++ const Vec3&) IMATH_NOEXCEPT; // Third point + + template +-Matrix44 constexpr nextFrame (const Matrix44&, // Previous matrix +- const Vec3&, // Previous point +- const Vec3&, // Current point +- Vec3&, // Previous tangent +- Vec3&) IMATH_NOEXCEPT; // Current tangent ++Matrix44 constexpr nextFrame ( ++ const Matrix44&, // Previous matrix ++ const Vec3&, // Previous point ++ const Vec3&, // Current point ++ Vec3&, // Previous tangent ++ Vec3&) IMATH_NOEXCEPT; // Current tangent + + template +-Matrix44 constexpr lastFrame (const Matrix44&, // Previous matrix +- const Vec3&, // Previous point +- const Vec3&) IMATH_NOEXCEPT; // Last point ++Matrix44 constexpr lastFrame ( ++ const Matrix44&, // Previous matrix ++ const Vec3&, // Previous point ++ const Vec3&) IMATH_NOEXCEPT; // Last point + + /// + /// Compute the first reference frame along a curve. +@@ -73,27 +75,27 @@ Matrix44 constexpr lastFrame (const Matrix44&, // Previous matrix + /// Second point + /// @param pk + /// Third point +-/// ++/// + template +-Matrix44 constexpr firstFrame (const Vec3& pi, // first point +- const Vec3& pj, // secont point +- const Vec3& pk) IMATH_NOEXCEPT // third point ++Matrix44 constexpr firstFrame ( ++ const Vec3& pi, // first point ++ const Vec3& pj, // secont point ++ const Vec3& pk) IMATH_NOEXCEPT // third point + { + Vec3 t = pj - pi; +- t.normalizeExc(); ++ t.normalizeExc (); + + Vec3 n = t.cross (pk - pi); +- n.normalize(); +- if (n.length() == 0.0f) ++ n.normalize (); ++ if (n.length () == 0.0f) + { + int i = fabs (t[0]) < fabs (t[1]) ? 0 : 1; +- if (fabs (t[2]) < fabs (t[i])) +- i = 2; ++ if (fabs (t[2]) < fabs (t[i])) i = 2; + + Vec3 v (0.0, 0.0, 0.0); + v[i] = 1.0; + n = t.cross (v); +- n.normalize(); ++ n.normalize (); + } + + Vec3 b = t.cross (n); +@@ -136,19 +138,20 @@ Matrix44 constexpr firstFrame (const Vec3& pi, // first point + /// The current tangent vector + + template +-Matrix44 constexpr nextFrame (const Matrix44& Mi, // Previous matrix +- const Vec3& pi, // Previous point +- const Vec3& pj, // Current point +- Vec3& ti, // Previous tangent vector +- Vec3& tj) IMATH_NOEXCEPT // Current tangent vector ++Matrix44 constexpr nextFrame ( ++ const Matrix44& Mi, // Previous matrix ++ const Vec3& pi, // Previous point ++ const Vec3& pj, // Current point ++ Vec3& ti, // Previous tangent vector ++ Vec3& tj) IMATH_NOEXCEPT // Current tangent vector + { + Vec3 a (0.0, 0.0, 0.0); /// Rotation axis. +- T r = 0.0; // Rotation angle. ++ T r = 0.0; // Rotation angle. + +- if (ti.length() != 0.0 && tj.length() != 0.0) ++ if (ti.length () != 0.0 && tj.length () != 0.0) + { +- ti.normalize(); +- tj.normalize(); ++ ti.normalize (); ++ tj.normalize (); + T dot = ti.dot (tj); + + // +@@ -164,7 +167,7 @@ Matrix44 constexpr nextFrame (const Matrix44& Mi, // Previous matrix + a = ti.cross (tj); + } + +- if (a.length() != 0.0 && r != 0.0) ++ if (a.length () != 0.0 && r != 0.0) + { + Matrix44 R; + R.setAxisAngle (a, r); +@@ -199,9 +202,10 @@ Matrix44 constexpr nextFrame (const Matrix44& Mi, // Previous matrix + /// The last point + + template +-Matrix44 constexpr lastFrame (const Matrix44& Mi, // Previous matrix +- const Vec3& pi, // Previous point +- const Vec3& pj) IMATH_NOEXCEPT // Last point ++Matrix44 constexpr lastFrame ( ++ const Matrix44& Mi, // Previous matrix ++ const Vec3& pi, // Previous point ++ const Vec3& pj) IMATH_NOEXCEPT // Last point + { + Matrix44 Tr; + Tr.translate (pj - pi); +diff --git a/src/Imath/ImathFrustum.h b/src/Imath/ImathFrustum.h +index a5daf0e..5935af1 100644 +--- a/src/Imath/ImathFrustum.h ++++ b/src/Imath/ImathFrustum.h +@@ -38,31 +38,38 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class IMATH_EXPORT_TEMPLATE_TYPE Frustum + { +- public: +- ++public: + /// @{ + /// @name Constructors and Assignment + /// + + /// Initialize with default values: + /// near=0.1, far=1000.0, left=-1.0, right=1.0, top=1.0, bottom=-1.0, ortho=false +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Frustum() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Frustum () IMATH_NOEXCEPT; + + /// Copy constructor + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Frustum (const Frustum&) IMATH_NOEXCEPT; + + /// Initialize to specific values ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Frustum ( ++ T nearPlane, ++ T farPlane, ++ T left, ++ T right, ++ T top, ++ T bottom, ++ bool ortho = false) IMATH_NOEXCEPT; ++ ++ /// Initialize with fov and aspect + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 +- Frustum (T nearPlane, T farPlane, T left, T right, T top, T bottom, bool ortho = false) IMATH_NOEXCEPT; +- +- /// Initialize with fov and aspect +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Frustum (T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCEPT; ++ Frustum (T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCEPT; + + /// Destructor +- virtual ~Frustum() IMATH_NOEXCEPT; ++ virtual ~Frustum () IMATH_NOEXCEPT; + + /// Component-wise assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Frustum& operator= (const Frustum&) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Frustum& ++ operator= (const Frustum&) IMATH_NOEXCEPT; + + /// @} + +@@ -70,78 +77,109 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Frustum + /// @name Comparison + + /// Equality +- IMATH_HOSTDEVICE constexpr bool operator== (const Frustum& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Frustum& src) const IMATH_NOEXCEPT; + + /// Inequality +- IMATH_HOSTDEVICE constexpr bool operator!= (const Frustum& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Frustum& src) const IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Query +- ++ + /// Return true if the frustum is orthographic, false if perspective +- IMATH_HOSTDEVICE constexpr bool orthographic() const IMATH_NOEXCEPT { return _orthographic; } ++ IMATH_HOSTDEVICE constexpr bool orthographic () const IMATH_NOEXCEPT ++ { ++ return _orthographic; ++ } + + /// Return the near clipping plane +- IMATH_HOSTDEVICE constexpr T nearPlane() const IMATH_NOEXCEPT { return _nearPlane; } ++ IMATH_HOSTDEVICE constexpr T nearPlane () const IMATH_NOEXCEPT ++ { ++ return _nearPlane; ++ } + + /// Return the near clipping plane +- IMATH_HOSTDEVICE constexpr T hither() const IMATH_NOEXCEPT { return _nearPlane; } ++ IMATH_HOSTDEVICE constexpr T hither () const IMATH_NOEXCEPT ++ { ++ return _nearPlane; ++ } + + /// Return the far clipping plane +- IMATH_HOSTDEVICE constexpr T farPlane() const IMATH_NOEXCEPT { return _farPlane; } ++ IMATH_HOSTDEVICE constexpr T farPlane () const IMATH_NOEXCEPT ++ { ++ return _farPlane; ++ } + + /// Return the far clipping plane +- IMATH_HOSTDEVICE constexpr T yon() const IMATH_NOEXCEPT { return _farPlane; } ++ IMATH_HOSTDEVICE constexpr T yon () const IMATH_NOEXCEPT ++ { ++ return _farPlane; ++ } + + /// Return the left of the frustum +- IMATH_HOSTDEVICE constexpr T left() const IMATH_NOEXCEPT { return _left; } ++ IMATH_HOSTDEVICE constexpr T left () const IMATH_NOEXCEPT { return _left; } + + /// Return the right of the frustum +- IMATH_HOSTDEVICE constexpr T right() const IMATH_NOEXCEPT { return _right; } ++ IMATH_HOSTDEVICE constexpr T right () const IMATH_NOEXCEPT ++ { ++ return _right; ++ } + + /// Return the bottom of the frustum +- IMATH_HOSTDEVICE constexpr T bottom() const IMATH_NOEXCEPT { return _bottom; } ++ IMATH_HOSTDEVICE constexpr T bottom () const IMATH_NOEXCEPT ++ { ++ return _bottom; ++ } + + /// Return the top of the frustum +- IMATH_HOSTDEVICE constexpr T top() const IMATH_NOEXCEPT { return _top; } ++ IMATH_HOSTDEVICE constexpr T top () const IMATH_NOEXCEPT { return _top; } + + /// Return the field of view in X +- IMATH_HOSTDEVICE constexpr T fovx() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T fovx () const IMATH_NOEXCEPT; + + /// Return the field of view in Y +- IMATH_HOSTDEVICE constexpr T fovy() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T fovy () const IMATH_NOEXCEPT; + + /// Return the aspect ratio +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T aspect() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T aspect () const IMATH_NOEXCEPT; + + /// Return the aspect ratio. Throw an exception if the aspect + /// ratio is undefined. +- IMATH_CONSTEXPR14 T aspectExc() const; ++ IMATH_CONSTEXPR14 T aspectExc () const; + + /// Return the project matrix that the frustum defines +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 projectionMatrix() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 ++ projectionMatrix () const IMATH_NOEXCEPT; + + /// Return the project matrix that the frustum defines. Throw an + /// exception if the frustum is degenerate. +- IMATH_CONSTEXPR14 Matrix44 projectionMatrixExc() const; ++ IMATH_CONSTEXPR14 Matrix44 projectionMatrixExc () const; + + /// Return true if the frustum is degenerate. +- IMATH_HOSTDEVICE constexpr bool degenerate() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool degenerate () const IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Set Value +- ++ + /// Set functions change the entire state of the Frustum +- IMATH_HOSTDEVICE void +- set (T nearPlane, T farPlane, T left, T right, T top, T bottom, bool ortho = false) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void set ( ++ T nearPlane, ++ T farPlane, ++ T left, ++ T right, ++ T top, ++ T bottom, ++ bool ortho = false) IMATH_NOEXCEPT; + + /// Set functions change the entire state of the Frustum using + /// field of view and aspect ratio +- IMATH_HOSTDEVICE void set (T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ set (T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCEPT; + + /// Set functions change the entire state of the Frustum using + /// field of view and aspect ratio. Throw an exception if `fovx` +@@ -149,7 +187,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Frustum + void setExc (T nearPlane, T farPlane, T fovx, T fovy, T aspect); + + /// Set the near and far clipping planes +- IMATH_HOSTDEVICE void modifyNearAndFar (T nearPlane, T farPlane) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ modifyNearAndFar (T nearPlane, T farPlane) IMATH_NOEXCEPT; + + /// Set the ortographic state + IMATH_HOSTDEVICE void setOrthographic (bool) IMATH_NOEXCEPT; +@@ -164,7 +203,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Frustum + /// near, far. Note that the planes have normals that point out + /// of the frustum. Apply the given matrix to transform the + /// frustum before setting the planes. +- IMATH_HOSTDEVICE void planes (Plane3 p[6], const Matrix44& M) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ planes (Plane3 p[6], const Matrix44& M) const IMATH_NOEXCEPT; + + /// Takes a rectangle in the screen space (i.e., -1 <= left <= right <= 1 + /// and -1 <= bottom <= top <= 1) of this Frustum, and returns a new +@@ -177,26 +217,28 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Frustum + + /// @{ + /// @name Utility Methods +- ++ + /// Project a point in screen spaced to 3d ray +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Line3 projectScreenToRay (const Vec2&) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Line3 ++ projectScreenToRay (const Vec2&) const IMATH_NOEXCEPT; + + /// Project a 3D point into screen coordinates +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec2 projectPointToScreen (const Vec3&) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec2 ++ projectPointToScreen (const Vec3&) const IMATH_NOEXCEPT; + + /// Project a 3D point into screen coordinates. Throw an + /// exception if the point cannot be projected. + IMATH_CONSTEXPR14 Vec2 projectPointToScreenExc (const Vec3&) const; + + /// Map a z value to its depth in the frustum. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T ZToDepth (long zval, +- long min, +- long max) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T ++ ZToDepth (long zval, long min, long max) const IMATH_NOEXCEPT; + /// Map a z value to its depth in the frustum. + IMATH_CONSTEXPR14 T ZToDepthExc (long zval, long min, long max) const; + + /// Map a normalized z value to its depth in the frustum. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T normalizedZToDepth (T zval) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T ++ normalizedZToDepth (T zval) const IMATH_NOEXCEPT; + + /// Map a normalized z value to its depth in the frustum. Throw an + /// exception on error. +@@ -210,23 +252,25 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Frustum + IMATH_CONSTEXPR14 long DepthToZExc (T depth, long zmin, long zmax) const; + + /// Compute worldRadius +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T worldRadius (const Vec3& p, T radius) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T ++ worldRadius (const Vec3& p, T radius) const IMATH_NOEXCEPT; + + /// Compute worldRadius. Throw an exception on error. + IMATH_CONSTEXPR14 T worldRadiusExc (const Vec3& p, T radius) const; + + /// Compute screen radius +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T screenRadius (const Vec3& p, T radius) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T ++ screenRadius (const Vec3& p, T radius) const IMATH_NOEXCEPT; + + /// Compute screen radius. Throw an exception on error. + IMATH_CONSTEXPR14 T screenRadiusExc (const Vec3& p, T radius) const; + + /// @} +- +- protected: + ++protected: + /// Map point from screen space to local space +- IMATH_HOSTDEVICE constexpr Vec2 screenToLocal (const Vec2&) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec2 ++ screenToLocal (const Vec2&) const IMATH_NOEXCEPT; + + /// Map point from local space to screen space + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec2 +@@ -236,44 +280,47 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Frustum + /// on error. + IMATH_CONSTEXPR14 Vec2 localToScreenExc (const Vec2&) const; + +- protected: +- ++protected: + /// @cond Doxygen_Suppress + +- T _nearPlane; +- T _farPlane; +- T _left; +- T _right; +- T _top; +- T _bottom; ++ T _nearPlane; ++ T _farPlane; ++ T _left; ++ T _right; ++ T _top; ++ T _bottom; + bool _orthographic; + + /// @endcond + }; + +-template IMATH_CONSTEXPR14 inline Frustum::Frustum() IMATH_NOEXCEPT ++template ++IMATH_CONSTEXPR14 inline Frustum::Frustum () IMATH_NOEXCEPT + { + set (T (0.1), T (1000.0), T (-1.0), T (1.0), T (1.0), T (-1.0), false); + } + +-template IMATH_CONSTEXPR14 inline Frustum::Frustum (const Frustum& f) IMATH_NOEXCEPT ++template ++IMATH_CONSTEXPR14 inline Frustum::Frustum (const Frustum& f) IMATH_NOEXCEPT + { + *this = f; + } + + template +-IMATH_CONSTEXPR14 inline Frustum::Frustum (T n, T f, T l, T r, T t, T b, bool o) IMATH_NOEXCEPT ++IMATH_CONSTEXPR14 inline Frustum::Frustum ( ++ T n, T f, T l, T r, T t, T b, bool o) IMATH_NOEXCEPT + { + set (n, f, l, r, t, b, o); + } + + template +-IMATH_CONSTEXPR14 inline Frustum::Frustum (T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCEPT ++IMATH_CONSTEXPR14 inline Frustum::Frustum ( ++ T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCEPT + { + set (nearPlane, farPlane, fovx, fovy, aspect); + } + +-template Frustum::~Frustum() IMATH_NOEXCEPT ++template Frustum::~Frustum () IMATH_NOEXCEPT + {} + + template +@@ -295,9 +342,9 @@ template + constexpr inline bool + Frustum::operator== (const Frustum& src) const IMATH_NOEXCEPT + { +- return _nearPlane == src._nearPlane && _farPlane == src._farPlane && _left == src._left && +- _right == src._right && _top == src._top && _bottom == src._bottom && +- _orthographic == src._orthographic; ++ return _nearPlane == src._nearPlane && _farPlane == src._farPlane && ++ _left == src._left && _right == src._right && _top == src._top && ++ _bottom == src._bottom && _orthographic == src._orthographic; + } + + template +@@ -324,14 +371,13 @@ template + inline void + Frustum::modifyNearAndFar (T n, T f) IMATH_NOEXCEPT + { +- if (_orthographic) +- { +- _nearPlane = n; +- } ++ if (_orthographic) { _nearPlane = n; } + else + { +- Line3 lowerLeft (Vec3 (0, 0, 0), Vec3 (_left, _bottom, -_nearPlane)); +- Line3 upperRight (Vec3 (0, 0, 0), Vec3 (_right, _top, -_nearPlane)); ++ Line3 lowerLeft ( ++ Vec3 (0, 0, 0), Vec3 (_left, _bottom, -_nearPlane)); ++ Line3 upperRight ( ++ Vec3 (0, 0, 0), Vec3 (_right, _top, -_nearPlane)); + Plane3 nearPlane (Vec3 (0, 0, -1), n); + + Vec3 ll = Vec3 (0, 0, 0); +@@ -387,7 +433,8 @@ Frustum::setExc (T nearPlane, T farPlane, T fovx, T fovy, T aspect) + + template + inline void +-Frustum::set (T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCEPT ++Frustum::set (T nearPlane, T farPlane, T fovx, T fovy, T aspect) ++ IMATH_NOEXCEPT + { + const T two = static_cast (2); + +@@ -412,26 +459,28 @@ Frustum::set (T nearPlane, T farPlane, T fovx, T fovy, T aspect) IMATH_NOEXCE + + template + constexpr inline T +-Frustum::fovx() const IMATH_NOEXCEPT ++Frustum::fovx () const IMATH_NOEXCEPT + { + return std::atan2 (_right, _nearPlane) - std::atan2 (_left, _nearPlane); + } + + template + constexpr inline T +-Frustum::fovy() const IMATH_NOEXCEPT ++Frustum::fovy () const IMATH_NOEXCEPT + { + return std::atan2 (_top, _nearPlane) - std::atan2 (_bottom, _nearPlane); + } + + template + IMATH_CONSTEXPR14 inline T +-Frustum::aspectExc() const ++Frustum::aspectExc () const + { + T rightMinusLeft = _right - _left; + T topMinusBottom = _top - _bottom; + +- if (abs (topMinusBottom) < T (1) && abs (rightMinusLeft) > std::numeric_limits::max() * abs (topMinusBottom)) ++ if (abs (topMinusBottom) < T (1) && ++ abs (rightMinusLeft) > ++ std::numeric_limits::max () * abs (topMinusBottom)) + { + throw std::domain_error ("Bad viewing frustum: " + "aspect ratio cannot be computed."); +@@ -442,7 +491,7 @@ Frustum::aspectExc() const + + template + IMATH_CONSTEXPR14 inline T +-Frustum::aspect() const IMATH_NOEXCEPT ++Frustum::aspect () const IMATH_NOEXCEPT + { + T rightMinusLeft = _right - _left; + T topMinusBottom = _top - _bottom; +@@ -451,7 +500,7 @@ Frustum::aspect() const IMATH_NOEXCEPT + + template + IMATH_CONSTEXPR14 inline Matrix44 +-Frustum::projectionMatrixExc() const ++Frustum::projectionMatrixExc () const + { + T rightPlusLeft = _right + _left; + T rightMinusLeft = _right - _left; +@@ -463,10 +512,14 @@ Frustum::projectionMatrixExc() const + T farMinusNear = _farPlane - _nearPlane; + + if ((abs (rightMinusLeft) < T (1) && +- abs (rightPlusLeft) > std::numeric_limits::max() * abs (rightMinusLeft)) || ++ abs (rightPlusLeft) > ++ std::numeric_limits::max () * abs (rightMinusLeft)) || + (abs (topMinusBottom) < T (1) && +- abs (topPlusBottom) > std::numeric_limits::max() * abs (topMinusBottom)) || +- (abs (farMinusNear) < 1 && abs (farPlusNear) > std::numeric_limits::max() * abs (farMinusNear))) ++ abs (topPlusBottom) > ++ std::numeric_limits::max () * abs (topMinusBottom)) || ++ (abs (farMinusNear) < 1 && ++ abs (farPlusNear) > ++ std::numeric_limits::max () * abs (farMinusNear))) + { + throw std::domain_error ("Bad viewing frustum: " + "projection matrix cannot be computed."); +@@ -478,9 +531,12 @@ Frustum::projectionMatrixExc() const + T ty = -topPlusBottom / topMinusBottom; + T tz = -farPlusNear / farMinusNear; + +- if ((abs (rightMinusLeft) < T (1) && T (2) > std::numeric_limits::max() * abs (rightMinusLeft)) || +- (abs (topMinusBottom) < T (1) && T (2) > std::numeric_limits::max() * abs (topMinusBottom)) || +- (abs (farMinusNear) < T (1) && T (2) > std::numeric_limits::max() * abs (farMinusNear))) ++ if ((abs (rightMinusLeft) < T (1) && ++ T (2) > std::numeric_limits::max () * abs (rightMinusLeft)) || ++ (abs (topMinusBottom) < T (1) && ++ T (2) > std::numeric_limits::max () * abs (topMinusBottom)) || ++ (abs (farMinusNear) < T (1) && ++ T (2) > std::numeric_limits::max () * abs (farMinusNear))) + { + throw std::domain_error ("Bad viewing frustum: " + "projection matrix cannot be computed."); +@@ -490,7 +546,8 @@ Frustum::projectionMatrixExc() const + T B = T (2) / topMinusBottom; + T C = T (-2) / farMinusNear; + +- return Matrix44 (A, 0, 0, 0, 0, B, 0, 0, 0, 0, C, 0, tx, ty, tz, 1.f); ++ return Matrix44 ( ++ A, 0, 0, 0, 0, B, 0, 0, 0, 0, C, 0, tx, ty, tz, 1.f); + } + else + { +@@ -499,7 +556,9 @@ Frustum::projectionMatrixExc() const + T C = -farPlusNear / farMinusNear; + + T farTimesNear = T (-2) * _farPlane * _nearPlane; +- if (abs (farMinusNear) < T (1) && abs (farTimesNear) > std::numeric_limits::max() * abs (farMinusNear)) ++ if (abs (farMinusNear) < T (1) && ++ abs (farTimesNear) > ++ std::numeric_limits::max () * abs (farMinusNear)) + { + throw std::domain_error ("Bad viewing frustum: " + "projection matrix cannot be computed."); +@@ -510,9 +569,11 @@ Frustum::projectionMatrixExc() const + T twoTimesNear = T (2) * _nearPlane; + + if ((abs (rightMinusLeft) < T (1) && +- abs (twoTimesNear) > std::numeric_limits::max() * abs (rightMinusLeft)) || ++ abs (twoTimesNear) > ++ std::numeric_limits::max () * abs (rightMinusLeft)) || + (abs (topMinusBottom) < T (1) && +- abs (twoTimesNear) > std::numeric_limits::max() * abs (topMinusBottom))) ++ abs (twoTimesNear) > ++ std::numeric_limits::max () * abs (topMinusBottom))) + { + throw std::domain_error ("Bad viewing frustum: " + "projection matrix cannot be computed."); +@@ -527,7 +588,7 @@ Frustum::projectionMatrixExc() const + + template + IMATH_CONSTEXPR14 inline Matrix44 +-Frustum::projectionMatrix() const IMATH_NOEXCEPT ++Frustum::projectionMatrix () const IMATH_NOEXCEPT + { + T rightPlusLeft = _right + _left; + T rightMinusLeft = _right - _left; +@@ -548,7 +609,8 @@ Frustum::projectionMatrix() const IMATH_NOEXCEPT + T B = T (2) / topMinusBottom; + T C = T (-2) / farMinusNear; + +- return Matrix44 (A, 0, 0, 0, 0, B, 0, 0, 0, 0, C, 0, tx, ty, tz, 1.f); ++ return Matrix44 ( ++ A, 0, 0, 0, 0, B, 0, 0, 0, 0, C, 0, tx, ty, tz, 1.f); + } + else + { +@@ -571,7 +633,7 @@ Frustum::projectionMatrix() const IMATH_NOEXCEPT + + template + constexpr inline bool +-Frustum::degenerate() const IMATH_NOEXCEPT ++Frustum::degenerate () const IMATH_NOEXCEPT + { + return (_nearPlane == _farPlane) || (_left == _right) || (_top == _bottom); + } +@@ -585,15 +647,17 @@ Frustum::window (T l, T r, T t, T b) const IMATH_NOEXCEPT + Vec2 bl = screenToLocal (Vec2 (l, b)); + Vec2 tr = screenToLocal (Vec2 (r, t)); + +- return Frustum (_nearPlane, _farPlane, bl.x, tr.x, tr.y, bl.y, _orthographic); ++ return Frustum ( ++ _nearPlane, _farPlane, bl.x, tr.x, tr.y, bl.y, _orthographic); + } + + template + constexpr inline Vec2 + Frustum::screenToLocal (const Vec2& s) const IMATH_NOEXCEPT + { +- return Vec2 (_left + (_right - _left) * (1.f + s.x) / 2.f, +- _bottom + (_top - _bottom) * (1.f + s.y) / 2.f); ++ return Vec2 ( ++ _left + (_right - _left) * (1.f + s.x) / 2.f, ++ _bottom + (_top - _bottom) * (1.f + s.y) / 2.f); + } + + template +@@ -606,15 +670,19 @@ Frustum::localToScreenExc (const Vec2& p) const + T bottomMinusTop = _bottom - _top; + + if ((abs (leftMinusRight) < T (1) && +- abs (leftPlusRight) > std::numeric_limits::max() * abs (leftMinusRight)) || ++ abs (leftPlusRight) > ++ std::numeric_limits::max () * abs (leftMinusRight)) || + (abs (bottomMinusTop) < T (1) && +- abs (bottomPlusTop) > std::numeric_limits::max() * abs (bottomMinusTop))) ++ abs (bottomPlusTop) > ++ std::numeric_limits::max () * abs (bottomMinusTop))) + { +- throw std::domain_error ("Bad viewing frustum: " +- "local-to-screen transformation cannot be computed"); ++ throw std::domain_error ( ++ "Bad viewing frustum: " ++ "local-to-screen transformation cannot be computed"); + } + +- return Vec2 (leftPlusRight / leftMinusRight, bottomPlusTop / bottomMinusTop); ++ return Vec2 ( ++ leftPlusRight / leftMinusRight, bottomPlusTop / bottomMinusTop); + } + + template +@@ -626,7 +694,8 @@ Frustum::localToScreen (const Vec2& p) const IMATH_NOEXCEPT + T bottomPlusTop = _bottom - T (2) * p.y + _top; + T bottomMinusTop = _bottom - _top; + +- return Vec2 (leftPlusRight / leftMinusRight, bottomPlusTop / bottomMinusTop); ++ return Vec2 ( ++ leftPlusRight / leftMinusRight, bottomPlusTop / bottomMinusTop); + } + + template +@@ -634,32 +703,34 @@ IMATH_CONSTEXPR14 inline Line3 + Frustum::projectScreenToRay (const Vec2& p) const IMATH_NOEXCEPT + { + Vec2 point = screenToLocal (p); +- if (orthographic()) +- return Line3 (Vec3 (point.x, point.y, 0.0), Vec3 (point.x, point.y, -1.0)); ++ if (orthographic ()) ++ return Line3 ( ++ Vec3 (point.x, point.y, 0.0), Vec3 (point.x, point.y, -1.0)); + else +- return Line3 (Vec3 (0, 0, 0), Vec3 (point.x, point.y, -_nearPlane)); ++ return Line3 ( ++ Vec3 (0, 0, 0), Vec3 (point.x, point.y, -_nearPlane)); + } + + template + IMATH_CONSTEXPR14 Vec2 + Frustum::projectPointToScreenExc (const Vec3& point) const + { +- if (orthographic() || point.z == T (0)) ++ if (orthographic () || point.z == T (0)) + return localToScreenExc (Vec2 (point.x, point.y)); + else +- return localToScreenExc ( +- Vec2 (point.x * _nearPlane / -point.z, point.y * _nearPlane / -point.z)); ++ return localToScreenExc (Vec2 ( ++ point.x * _nearPlane / -point.z, point.y * _nearPlane / -point.z)); + } + + template + IMATH_CONSTEXPR14 Vec2 + Frustum::projectPointToScreen (const Vec3& point) const IMATH_NOEXCEPT + { +- if (orthographic() || point.z == T (0)) ++ if (orthographic () || point.z == T (0)) + return localToScreen (Vec2 (point.x, point.y)); + else +- return localToScreen ( +- Vec2 (point.x * _nearPlane / -point.z, point.y * _nearPlane / -point.z)); ++ return localToScreen (Vec2 ( ++ point.x * _nearPlane / -point.z, point.y * _nearPlane / -point.z)); + } + + template +@@ -673,8 +744,7 @@ Frustum::ZToDepthExc (long zval, long zmin, long zmax) const + throw std::domain_error ("Bad call to Frustum::ZToDepth: zmax == zmin"); + } + +- if (zval > zmax + 1) +- zval -= zdiff; ++ if (zval > zmax + 1) zval -= zdiff; + + T fzval = (T (zval) - T (zmin)) / T (zdiff); + return normalizedZToDepthExc (fzval); +@@ -686,8 +756,7 @@ Frustum::ZToDepth (long zval, long zmin, long zmax) const IMATH_NOEXCEPT + { + int zdiff = zmax - zmin; + +- if (zval > zmax + 1) +- zval -= zdiff; ++ if (zval > zmax + 1) zval -= zdiff; + + T fzval = (T (zval) - T (zmin)) / T (zdiff); + return normalizedZToDepth (fzval); +@@ -701,18 +770,22 @@ Frustum::normalizedZToDepthExc (T zval) const + + if (_orthographic) + { +- return -(Zp * (_farPlane - _nearPlane) + (_farPlane + _nearPlane)) / T (2); ++ return -(Zp * (_farPlane - _nearPlane) + (_farPlane + _nearPlane)) / ++ T (2); + } + else + { + T farTimesNear = 2 * _farPlane * _nearPlane; + T farMinusNear = Zp * (_farPlane - _nearPlane) - _farPlane - _nearPlane; + +- if (abs (farMinusNear) < 1 && abs (farTimesNear) > std::numeric_limits::max() * abs (farMinusNear)) ++ if (abs (farMinusNear) < 1 && ++ abs (farTimesNear) > ++ std::numeric_limits::max () * abs (farMinusNear)) + { +- throw std::domain_error ("Frustum::normalizedZToDepth cannot be computed: " +- "near and far clipping planes of the viewing frustum " +- "may be too close to each other"); ++ throw std::domain_error ( ++ "Frustum::normalizedZToDepth cannot be computed: " ++ "near and far clipping planes of the viewing frustum " ++ "may be too close to each other"); + } + + return farTimesNear / farMinusNear; +@@ -727,7 +800,8 @@ Frustum::normalizedZToDepth (T zval) const IMATH_NOEXCEPT + + if (_orthographic) + { +- return -(Zp * (_farPlane - _nearPlane) + (_farPlane + _nearPlane)) / T (2); ++ return -(Zp * (_farPlane - _nearPlane) + (_farPlane + _nearPlane)) / ++ T (2); + } + else + { +@@ -742,14 +816,16 @@ template + IMATH_CONSTEXPR14 long + Frustum::DepthToZExc (T depth, long zmin, long zmax) const + { +- long zdiff = zmax - zmin; +- T farMinusNear = _farPlane - _nearPlane; ++ long zdiff = zmax - zmin; ++ T farMinusNear = _farPlane - _nearPlane; + + if (_orthographic) + { + T farPlusNear = T (2) * depth + _farPlane + _nearPlane; + +- if (abs (farMinusNear) < T (1) && abs (farPlusNear) > std::numeric_limits::max() * abs (farMinusNear)) ++ if (abs (farMinusNear) < T (1) && ++ abs (farPlusNear) > ++ std::numeric_limits::max () * abs (farMinusNear)) + { + throw std::domain_error ("Bad viewing frustum: " + "near and far clipping planes " +@@ -764,14 +840,17 @@ Frustum::DepthToZExc (T depth, long zmin, long zmax) const + // Perspective + + T farTimesNear = T (2) * _farPlane * _nearPlane; +- if (abs (depth) < T (1) && abs (farTimesNear) > std::numeric_limits::max() * abs (depth)) ++ if (abs (depth) < T (1) && ++ abs (farTimesNear) > std::numeric_limits::max () * abs (depth)) + { + throw std::domain_error ("Bad call to DepthToZ function: " + "value of `depth' is too small"); + } + + T farPlusNear = farTimesNear / depth + _farPlane + _nearPlane; +- if (abs (farMinusNear) < T (1) && abs (farPlusNear) > std::numeric_limits::max() * abs (farMinusNear)) ++ if (abs (farMinusNear) < T (1) && ++ abs (farPlusNear) > ++ std::numeric_limits::max () * abs (farMinusNear)) + { + throw std::domain_error ("Bad viewing frustum: " + "near and far clipping planes " +@@ -787,8 +866,8 @@ template + IMATH_CONSTEXPR14 long + Frustum::DepthToZ (T depth, long zmin, long zmax) const IMATH_NOEXCEPT + { +- long zdiff = zmax - zmin; +- T farMinusNear = _farPlane - _nearPlane; ++ long zdiff = zmax - zmin; ++ T farMinusNear = _farPlane - _nearPlane; + + if (_orthographic) + { +@@ -824,7 +903,8 @@ Frustum::screenRadiusExc (const Vec3& p, T radius) const + // A similar analysis holds in the Y-Z plane. + // So r is the quantity we want to return. + +- if (abs (p.z) > T (1) || abs (-_nearPlane) < std::numeric_limits::max() * abs (p.z)) ++ if (abs (p.z) > T (1) || ++ abs (-_nearPlane) < std::numeric_limits::max () * abs (p.z)) + { + return radius * (-_nearPlane / p.z); + } +@@ -858,7 +938,8 @@ template + IMATH_CONSTEXPR14 T + Frustum::worldRadiusExc (const Vec3& p, T radius) const + { +- if (abs (-_nearPlane) > T (1) || abs (p.z) < std::numeric_limits::max() * abs (-_nearPlane)) ++ if (abs (-_nearPlane) > T (1) || ++ abs (p.z) < std::numeric_limits::max () * abs (-_nearPlane)) + { + return radius * (p.z / -_nearPlane); + } +@@ -924,15 +1005,15 @@ Frustum::planes (Plane3 p[6], const Matrix44& M) const IMATH_NOEXCEPT + Vec3 d = Vec3 (_right, _bottom, -_nearPlane) * M; + if (!_orthographic) + { +- double s = _farPlane / double (_nearPlane); +- T farLeft = (T) (s * _left); +- T farRight = (T) (s * _right); +- T farTop = (T) (s * _top); +- T farBottom = (T) (s * _bottom); +- Vec3 e = Vec3 (farLeft, farBottom, -_farPlane) * M; +- Vec3 f = Vec3 (farLeft, farTop, -_farPlane) * M; +- Vec3 g = Vec3 (farRight, farTop, -_farPlane) * M; +- Vec3 o = Vec3 (0, 0, 0) * M; ++ double s = _farPlane / double (_nearPlane); ++ T farLeft = (T) (s * _left); ++ T farRight = (T) (s * _right); ++ T farTop = (T) (s * _top); ++ T farBottom = (T) (s * _bottom); ++ Vec3 e = Vec3 (farLeft, farBottom, -_farPlane) * M; ++ Vec3 f = Vec3 (farLeft, farTop, -_farPlane) * M; ++ Vec3 g = Vec3 (farRight, farTop, -_farPlane) * M; ++ Vec3 o = Vec3 (0, 0, 0) * M; + p[0].set (o, c, b); + p[1].set (o, d, c); + p[2].set (o, a, d); +diff --git a/src/Imath/ImathFrustumTest.h b/src/Imath/ImathFrustumTest.h +index 3995ddb..d052cca 100644 +--- a/src/Imath/ImathFrustumTest.h ++++ b/src/Imath/ImathFrustumTest.h +@@ -84,21 +84,22 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class IMATH_EXPORT_TEMPLATE_TYPE FrustumTest + { +- public: ++public: + /// @{ + /// @name Constructors + + /// Initialize camera matrix to identity +- FrustumTest() IMATH_NOEXCEPT ++ FrustumTest () IMATH_NOEXCEPT + { +- Frustum frust; ++ Frustum frust; + Matrix44 cameraMat; +- cameraMat.makeIdentity(); ++ cameraMat.makeIdentity (); + setFrustum (frust, cameraMat); + } + + /// Initialize to a given frustum and camera matrix. +- FrustumTest (const Frustum& frustum, const Matrix44& cameraMat) IMATH_NOEXCEPT ++ FrustumTest (const Frustum& frustum, const Matrix44& cameraMat) ++ IMATH_NOEXCEPT + { + setFrustum (frustum, cameraMat); + } +@@ -107,17 +108,18 @@ template class IMATH_EXPORT_TEMPLATE_TYPE FrustumTest + + /// @{ + /// @name Set Value +- ++ + /// Update the frustum test with a new frustum and matrix. + /// This should usually be called just once per frame, or however + /// often the camera moves. +- void setFrustum (const Frustum& frustum, const Matrix44& cameraMat) IMATH_NOEXCEPT; ++ void setFrustum (const Frustum& frustum, const Matrix44& cameraMat) ++ IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Query +- ++ + /// Return true if any part of the sphere is inside the frustum. + /// The result MAY return close false-positives, but not false-negatives. + bool isVisible (const Sphere3& sphere) const IMATH_NOEXCEPT; +@@ -138,15 +140,20 @@ template class IMATH_EXPORT_TEMPLATE_TYPE FrustumTest + bool completelyContains (const Box>& box) const IMATH_NOEXCEPT; + + /// Return the camera matrix (primarily for debugging) +- IMATH_INTERNAL_NAMESPACE::Matrix44 cameraMat() const IMATH_NOEXCEPT { return cameraMatrix; } ++ IMATH_INTERNAL_NAMESPACE::Matrix44 cameraMat () const IMATH_NOEXCEPT ++ { ++ return cameraMatrix; ++ } + + /// Return the viewing frustum (primarily for debugging) +- IMATH_INTERNAL_NAMESPACE::Frustum currentFrustum() const IMATH_NOEXCEPT { return currFrustum; } ++ IMATH_INTERNAL_NAMESPACE::Frustum currentFrustum () const IMATH_NOEXCEPT ++ { ++ return currFrustum; ++ } + + /// @} +- +- protected: + ++protected: + // To understand why the planes are stored this way, see + // the SPECIAL NOTE above. + +@@ -164,7 +171,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE FrustumTest + Vec3 planeNormAbsZ[2]; // The abs(X) components from 6 plane equations + + // These are kept primarily for debugging tools. +- Frustum currFrustum; ++ Frustum currFrustum; + Matrix44 cameraMatrix; + + /// @endcond +@@ -172,7 +179,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE FrustumTest + + template + void +-FrustumTest::setFrustum (const Frustum& frustum, const Matrix44& cameraMat) IMATH_NOEXCEPT ++FrustumTest::setFrustum ( ++ const Frustum& frustum, const Matrix44& cameraMat) IMATH_NOEXCEPT + { + Plane3 frustumPlanes[6]; + frustum.planes (frustumPlanes, cameraMat); +@@ -183,29 +191,36 @@ FrustumTest::setFrustum (const Frustum& frustum, const Matrix44& camera + { + int index = i * 3; + +- planeNormX[i] = Vec3 (frustumPlanes[index + 0].normal.x, +- frustumPlanes[index + 1].normal.x, +- frustumPlanes[index + 2].normal.x); +- planeNormY[i] = Vec3 (frustumPlanes[index + 0].normal.y, +- frustumPlanes[index + 1].normal.y, +- frustumPlanes[index + 2].normal.y); +- planeNormZ[i] = Vec3 (frustumPlanes[index + 0].normal.z, +- frustumPlanes[index + 1].normal.z, +- frustumPlanes[index + 2].normal.z); +- +- planeNormAbsX[i] = Vec3 (std::abs (planeNormX[i].x), +- std::abs (planeNormX[i].y), +- std::abs (planeNormX[i].z)); +- planeNormAbsY[i] = Vec3 (std::abs (planeNormY[i].x), +- std::abs (planeNormY[i].y), +- std::abs (planeNormY[i].z)); +- planeNormAbsZ[i] = Vec3 (std::abs (planeNormZ[i].x), +- std::abs (planeNormZ[i].y), +- std::abs (planeNormZ[i].z)); +- +- planeOffsetVec[i] = Vec3 (frustumPlanes[index + 0].distance, +- frustumPlanes[index + 1].distance, +- frustumPlanes[index + 2].distance); ++ planeNormX[i] = Vec3 ( ++ frustumPlanes[index + 0].normal.x, ++ frustumPlanes[index + 1].normal.x, ++ frustumPlanes[index + 2].normal.x); ++ planeNormY[i] = Vec3 ( ++ frustumPlanes[index + 0].normal.y, ++ frustumPlanes[index + 1].normal.y, ++ frustumPlanes[index + 2].normal.y); ++ planeNormZ[i] = Vec3 ( ++ frustumPlanes[index + 0].normal.z, ++ frustumPlanes[index + 1].normal.z, ++ frustumPlanes[index + 2].normal.z); ++ ++ planeNormAbsX[i] = Vec3 ( ++ std::abs (planeNormX[i].x), ++ std::abs (planeNormX[i].y), ++ std::abs (planeNormX[i].z)); ++ planeNormAbsY[i] = Vec3 ( ++ std::abs (planeNormY[i].x), ++ std::abs (planeNormY[i].y), ++ std::abs (planeNormY[i].z)); ++ planeNormAbsZ[i] = Vec3 ( ++ std::abs (planeNormZ[i].x), ++ std::abs (planeNormZ[i].y), ++ std::abs (planeNormZ[i].z)); ++ ++ planeOffsetVec[i] = Vec3 ( ++ frustumPlanes[index + 0].distance, ++ frustumPlanes[index + 1].distance, ++ frustumPlanes[index + 2].distance); + } + currFrustum = frustum; + cameraMatrix = cameraMat; +@@ -219,40 +234,37 @@ FrustumTest::isVisible (const Sphere3& sphere) const IMATH_NOEXCEPT + Vec3 radiusVec = Vec3 (sphere.radius, sphere.radius, sphere.radius); + + // This is a vertical dot-product on three vectors at once. +- Vec3 d0 = planeNormX[0] * center.x + planeNormY[0] * center.y + planeNormZ[0] * center.z - +- radiusVec - planeOffsetVec[0]; ++ Vec3 d0 = planeNormX[0] * center.x + planeNormY[0] * center.y + ++ planeNormZ[0] * center.z - radiusVec - planeOffsetVec[0]; + +- if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) +- return false; ++ if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) return false; + +- Vec3 d1 = planeNormX[1] * center.x + planeNormY[1] * center.y + planeNormZ[1] * center.z - +- radiusVec - planeOffsetVec[1]; ++ Vec3 d1 = planeNormX[1] * center.x + planeNormY[1] * center.y + ++ planeNormZ[1] * center.z - radiusVec - planeOffsetVec[1]; + +- if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) +- return false; ++ if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) return false; + + return true; + } + + template + bool +-FrustumTest::completelyContains (const Sphere3& sphere) const IMATH_NOEXCEPT ++FrustumTest::completelyContains (const Sphere3& sphere) const ++ IMATH_NOEXCEPT + { + Vec3 center = sphere.center; + Vec3 radiusVec = Vec3 (sphere.radius, sphere.radius, sphere.radius); + + // This is a vertical dot-product on three vectors at once. +- Vec3 d0 = planeNormX[0] * center.x + planeNormY[0] * center.y + planeNormZ[0] * center.z + +- radiusVec - planeOffsetVec[0]; ++ Vec3 d0 = planeNormX[0] * center.x + planeNormY[0] * center.y + ++ planeNormZ[0] * center.z + radiusVec - planeOffsetVec[0]; + +- if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) +- return false; ++ if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) return false; + +- Vec3 d1 = planeNormX[1] * center.x + planeNormY[1] * center.y + planeNormZ[1] * center.z + +- radiusVec - planeOffsetVec[1]; ++ Vec3 d1 = planeNormX[1] * center.x + planeNormY[1] * center.y + ++ planeNormZ[1] * center.z + radiusVec - planeOffsetVec[1]; + +- if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) +- return false; ++ if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) return false; + + return true; + } +@@ -261,54 +273,53 @@ template + bool + FrustumTest::isVisible (const Box>& box) const IMATH_NOEXCEPT + { +- if (box.isEmpty()) +- return false; ++ if (box.isEmpty ()) return false; + + Vec3 center = (box.min + box.max) / 2; + Vec3 extent = (box.max - center); + + // This is a vertical dot-product on three vectors at once. +- Vec3 d0 = planeNormX[0] * center.x + planeNormY[0] * center.y + planeNormZ[0] * center.z - +- planeNormAbsX[0] * extent.x - planeNormAbsY[0] * extent.y - +- planeNormAbsZ[0] * extent.z - planeOffsetVec[0]; ++ Vec3 d0 = planeNormX[0] * center.x + planeNormY[0] * center.y + ++ planeNormZ[0] * center.z - planeNormAbsX[0] * extent.x - ++ planeNormAbsY[0] * extent.y - planeNormAbsZ[0] * extent.z - ++ planeOffsetVec[0]; + +- if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) +- return false; ++ if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) return false; + +- Vec3 d1 = planeNormX[1] * center.x + planeNormY[1] * center.y + planeNormZ[1] * center.z - +- planeNormAbsX[1] * extent.x - planeNormAbsY[1] * extent.y - +- planeNormAbsZ[1] * extent.z - planeOffsetVec[1]; ++ Vec3 d1 = planeNormX[1] * center.x + planeNormY[1] * center.y + ++ planeNormZ[1] * center.z - planeNormAbsX[1] * extent.x - ++ planeNormAbsY[1] * extent.y - planeNormAbsZ[1] * extent.z - ++ planeOffsetVec[1]; + +- if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) +- return false; ++ if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) return false; + + return true; + } + + template + bool +-FrustumTest::completelyContains (const Box>& box) const IMATH_NOEXCEPT ++FrustumTest::completelyContains (const Box>& box) const ++ IMATH_NOEXCEPT + { +- if (box.isEmpty()) +- return false; ++ if (box.isEmpty ()) return false; + + Vec3 center = (box.min + box.max) / 2; + Vec3 extent = (box.max - center); + + // This is a vertical dot-product on three vectors at once. +- Vec3 d0 = planeNormX[0] * center.x + planeNormY[0] * center.y + planeNormZ[0] * center.z + +- planeNormAbsX[0] * extent.x + planeNormAbsY[0] * extent.y + +- planeNormAbsZ[0] * extent.z - planeOffsetVec[0]; ++ Vec3 d0 = planeNormX[0] * center.x + planeNormY[0] * center.y + ++ planeNormZ[0] * center.z + planeNormAbsX[0] * extent.x + ++ planeNormAbsY[0] * extent.y + planeNormAbsZ[0] * extent.z - ++ planeOffsetVec[0]; + +- if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) +- return false; ++ if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) return false; + +- Vec3 d1 = planeNormX[1] * center.x + planeNormY[1] * center.y + planeNormZ[1] * center.z + +- planeNormAbsX[1] * extent.x + planeNormAbsY[1] * extent.y + +- planeNormAbsZ[1] * extent.z - planeOffsetVec[1]; ++ Vec3 d1 = planeNormX[1] * center.x + planeNormY[1] * center.y + ++ planeNormZ[1] * center.z + planeNormAbsX[1] * extent.x + ++ planeNormAbsY[1] * extent.y + planeNormAbsZ[1] * extent.z - ++ planeOffsetVec[1]; + +- if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) +- return false; ++ if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) return false; + + return true; + } +@@ -318,17 +329,15 @@ bool + FrustumTest::isVisible (const Vec3& vec) const IMATH_NOEXCEPT + { + // This is a vertical dot-product on three vectors at once. +- Vec3 d0 = (planeNormX[0] * vec.x) + (planeNormY[0] * vec.y) + (planeNormZ[0] * vec.z) - +- planeOffsetVec[0]; ++ Vec3 d0 = (planeNormX[0] * vec.x) + (planeNormY[0] * vec.y) + ++ (planeNormZ[0] * vec.z) - planeOffsetVec[0]; + +- if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) +- return false; ++ if (d0.x >= 0 || d0.y >= 0 || d0.z >= 0) return false; + +- Vec3 d1 = (planeNormX[1] * vec.x) + (planeNormY[1] * vec.y) + (planeNormZ[1] * vec.z) - +- planeOffsetVec[1]; ++ Vec3 d1 = (planeNormX[1] * vec.x) + (planeNormY[1] * vec.y) + ++ (planeNormZ[1] * vec.z) - planeOffsetVec[1]; + +- if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) +- return false; ++ if (d1.x >= 0 || d1.y >= 0 || d1.z >= 0) return false; + + return true; + } +diff --git a/src/Imath/ImathFun.cpp b/src/Imath/ImathFun.cpp +index 7479936..27d7650 100644 +--- a/src/Imath/ImathFun.cpp ++++ b/src/Imath/ImathFun.cpp +@@ -12,12 +12,12 @@ succf (float f) IMATH_NOEXCEPT + { + union + { +- float f; ++ float f; + uint32_t i; + } u; + u.f = f; + +- if (isinf(f) || isnan (f)) ++ if (isinf (f) || isnan (f)) + { + // Nan or infinity; don't change value. + } +@@ -50,12 +50,12 @@ predf (float f) IMATH_NOEXCEPT + { + union + { +- float f; ++ float f; + uint32_t i; + } u; + u.f = f; + +- if (isinf(f) || isnan (f)) ++ if (isinf (f) || isnan (f)) + { + // Nan or infinity; don't change value. + } +@@ -88,12 +88,12 @@ succd (double d) IMATH_NOEXCEPT + { + union + { +- double d; ++ double d; + uint64_t i; + } u; + u.d = d; + +- if (isinf(d) || isnan (d)) ++ if (isinf (d) || isnan (d)) + { + // Nan or infinity; don't change value. + } +@@ -126,7 +126,7 @@ predd (double d) IMATH_NOEXCEPT + { + union + { +- double d; ++ double d; + uint64_t i; + } u; + u.d = d; +diff --git a/src/Imath/ImathFun.h b/src/Imath/ImathFun.h +index 938d0cf..5004c87 100644 +--- a/src/Imath/ImathFun.h ++++ b/src/Imath/ImathFun.h +@@ -12,8 +12,8 @@ + // + //----------------------------------------------------------------------------- + +-#include + #include ++#include + + #include "ImathExport.h" + #include "ImathNamespace.h" +@@ -66,7 +66,7 @@ lerpfactor (T m, T a, T b) IMATH_NOEXCEPT + T d = b - a; + T n = m - a; + +- if (abs (d) > T (1) || abs (n) < std::numeric_limits::max() * abs (d)) ++ if (abs (d) > T (1) || abs (n) < std::numeric_limits::max () * abs (d)) + return n / d; + + return T (0); +@@ -139,13 +139,15 @@ trunc (T x) IMATH_NOEXCEPT + IMATH_HOSTDEVICE constexpr inline int + divs (int x, int y) IMATH_NOEXCEPT + { +- return (x >= 0) ? ((y >= 0) ? (x / y) : -(x / -y)) : ((y >= 0) ? -(-x / y) : (-x / -y)); ++ return (x >= 0) ? ((y >= 0) ? (x / y) : -(x / -y)) ++ : ((y >= 0) ? -(-x / y) : (-x / -y)); + } + + IMATH_HOSTDEVICE constexpr inline int + mods (int x, int y) IMATH_NOEXCEPT + { +- return (x >= 0) ? ((y >= 0) ? (x % y) : (x % -y)) : ((y >= 0) ? -(-x % y) : -(-x % -y)); ++ return (x >= 0) ? ((y >= 0) ? (x % y) : (x % -y)) ++ : ((y >= 0) ? -(-x % y) : -(-x % -y)); + } + + // +@@ -206,7 +208,7 @@ finitef (float f) IMATH_NOEXCEPT + union + { + float f; +- int i; ++ int i; + } u; + u.f = f; + +@@ -218,7 +220,7 @@ finited (double d) IMATH_NOEXCEPT + { + union + { +- double d; ++ double d; + uint64_t i; + } u; + u.d = d; +diff --git a/src/Imath/ImathGL.h b/src/Imath/ImathGL.h +index e38fe65..90884f2 100644 +--- a/src/Imath/ImathGL.h ++++ b/src/Imath/ImathGL.h +@@ -61,7 +61,7 @@ glTexCoord (const IMATH_INTERNAL_NAMESPACE::V2f& t) + + /// Disable GL textures + inline void +-glDisableTexture() ++glDisableTexture () + { + glActiveTexture (GL_TEXTURE1); + glBindTexture (GL_TEXTURE_2D, 0); +@@ -78,7 +78,8 @@ const float GL_FLOAT_MAX = 1.8e+19; // sqrt (FLT_MAX) + inline bool + badFloat (float f) + { +- return !IMATH_INTERNAL_NAMESPACE::finitef (f) || f < -GL_FLOAT_MAX || f > GL_FLOAT_MAX; ++ return !IMATH_INTERNAL_NAMESPACE::finitef (f) || f < -GL_FLOAT_MAX || ++ f > GL_FLOAT_MAX; + } + + } // namespace +@@ -87,10 +88,12 @@ badFloat (float f) + inline void + throwBadMatrix (const IMATH_INTERNAL_NAMESPACE::M44f& m) + { +- if (badFloat (m[0][0]) || badFloat (m[0][1]) || badFloat (m[0][2]) || badFloat (m[0][3]) || +- badFloat (m[1][0]) || badFloat (m[1][1]) || badFloat (m[1][2]) || badFloat (m[1][3]) || +- badFloat (m[2][0]) || badFloat (m[2][1]) || badFloat (m[2][2]) || badFloat (m[2][3]) || +- badFloat (m[3][0]) || badFloat (m[3][1]) || badFloat (m[3][2]) || badFloat (m[3][3])) ++ if (badFloat (m[0][0]) || badFloat (m[0][1]) || badFloat (m[0][2]) || ++ badFloat (m[0][3]) || badFloat (m[1][0]) || badFloat (m[1][1]) || ++ badFloat (m[1][2]) || badFloat (m[1][3]) || badFloat (m[2][0]) || ++ badFloat (m[2][1]) || badFloat (m[2][2]) || badFloat (m[2][3]) || ++ badFloat (m[3][0]) || badFloat (m[3][1]) || badFloat (m[3][2]) || ++ badFloat (m[3][3])) + throw std::invalid_argument ("GL matrix overflow"); + } + +@@ -135,9 +138,9 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + class GLPushMatrix + { +- public: +- GLPushMatrix() { glPushMatrix(); } +- ~GLPushMatrix() { glPopMatrix(); } ++public: ++ GLPushMatrix () { glPushMatrix (); } ++ ~GLPushMatrix () { glPopMatrix (); } + }; + + /// +@@ -147,12 +150,12 @@ class GLPushMatrix + + class GLPushAttrib + { +- public: ++public: + /// call glPushAttrib() + GLPushAttrib (GLbitfield mask) { glPushAttrib (mask); } + + /// call glPopAttrib() +- ~GLPushAttrib() { glPopAttrib(); } ++ ~GLPushAttrib () { glPopAttrib (); } + }; + + /// +@@ -162,13 +165,12 @@ class GLPushAttrib + + class GLBegin + { +- public: +- ++public: + /// Call glBegin() + GLBegin (GLenum mode) { glBegin (mode); } + + /// Call glEnd() +- ~GLBegin() { glEnd(); } ++ ~GLBegin () { glEnd (); } + }; + + IMATH_INTERNAL_NAMESPACE_HEADER_EXIT +diff --git a/src/Imath/ImathGLU.h b/src/Imath/ImathGLU.h +index 231da83..396c21d 100644 +--- a/src/Imath/ImathGLU.h ++++ b/src/Imath/ImathGLU.h +@@ -17,11 +17,21 @@ + + /// Call gluLookAt with the given position, interest, and up-vector. + inline void +-gluLookAt (const IMATH_INTERNAL_NAMESPACE::V3f& pos, +- const IMATH_INTERNAL_NAMESPACE::V3f& interest, +- const IMATH_INTERNAL_NAMESPACE::V3f& up) ++gluLookAt ( ++ const IMATH_INTERNAL_NAMESPACE::V3f& pos, ++ const IMATH_INTERNAL_NAMESPACE::V3f& interest, ++ const IMATH_INTERNAL_NAMESPACE::V3f& up) + { +- gluLookAt (pos.x, pos.y, pos.z, interest.x, interest.y, interest.z, up.x, up.y, up.z); ++ gluLookAt ( ++ pos.x, ++ pos.y, ++ pos.z, ++ interest.x, ++ interest.y, ++ interest.z, ++ up.x, ++ up.y, ++ up.z); + } + + #endif +diff --git a/src/Imath/ImathInt64.h b/src/Imath/ImathInt64.h +index 258b147..fd123ea 100644 +--- a/src/Imath/ImathInt64.h ++++ b/src/Imath/ImathInt64.h +@@ -19,24 +19,24 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + #if (defined _WIN32 || defined _WIN64) && _MSC_VER >= 1300 + /// Int64 - unsigned 64-bit integer +-IMATH_DEPRECATED("use uint64_t") ++IMATH_DEPRECATED ("use uint64_t") + typedef unsigned __int64 Int64; + /// SInt64 - signed 64-bit integer +-IMATH_DEPRECATED("use sint64_t") ++IMATH_DEPRECATED ("use sint64_t") + typedef __int64 SInt64; + #elif ULONG_MAX == 18446744073709551615LU + /// Int64 - unsigned 64-bit integer +-IMATH_DEPRECATED("use uint64_t") ++IMATH_DEPRECATED ("use uint64_t") + typedef long unsigned int Int64; + /// SInt64 - signed 64-bit integer +-IMATH_DEPRECATED("use sint64_t") ++IMATH_DEPRECATED ("use sint64_t") + typedef long int SInt64; + #else + /// Int64 - unsigned 64-bit integer +-IMATH_DEPRECATED("use uint64_t") ++IMATH_DEPRECATED ("use uint64_t") + typedef long long unsigned int Int64; + /// SInt64 - signed 64-bit integer +-IMATH_DEPRECATED("use sint64_t") ++IMATH_DEPRECATED ("use sint64_t") + typedef long long int SInt64; + #endif + +diff --git a/src/Imath/ImathInterval.h b/src/Imath/ImathInterval.h +index ae483a4..0e13962 100644 +--- a/src/Imath/ImathInterval.h ++++ b/src/Imath/ImathInterval.h +@@ -24,11 +24,10 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class IMATH_EXPORT_TEMPLATE_TYPE Interval + { +- public: +- ++public: + /// @{ + /// @name Direct access to bounds +- ++ + /// The minimum value of the interval + T min; + +@@ -36,18 +35,19 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Interval + T max; + + /// @} +- ++ + /// @{ + /// @name Constructors + + /// Initialize to the empty interval +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Interval() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Interval () IMATH_NOEXCEPT; + + /// Intitialize to a single point + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Interval (const T& point) IMATH_NOEXCEPT; + + /// Intitialize to a given (min,max) +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Interval (const T& minT, const T& maxT) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Interval (const T& minT, const T& maxT) ++ IMATH_NOEXCEPT; + + /// @} + +@@ -55,9 +55,11 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Interval + /// @name Comparison + + /// Equality +- IMATH_HOSTDEVICE constexpr bool operator== (const Interval& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Interval& src) const IMATH_NOEXCEPT; + /// Inequality +- IMATH_HOSTDEVICE constexpr bool operator!= (const Interval& src) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Interval& src) const IMATH_NOEXCEPT; + + /// @} + +@@ -66,7 +68,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Interval + + /// Set the interval to be empty. An interval is empty if the + /// minimum is greater than the maximum. +- IMATH_HOSTDEVICE void makeEmpty() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeEmpty () IMATH_NOEXCEPT; + + /// Extend the interval to include the given point. + IMATH_HOSTDEVICE void extendBy (const T& point) IMATH_NOEXCEPT; +@@ -75,7 +77,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Interval + IMATH_HOSTDEVICE void extendBy (const Interval& interval) IMATH_NOEXCEPT; + + /// Make the interval include the entire range of the base type. +- IMATH_HOSTDEVICE void makeInfinite() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeInfinite () IMATH_NOEXCEPT; + + /// @} + +@@ -83,36 +85,39 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Interval + /// @name Query + + /// Return the size of the interval. The size is (max-min). An empty box has a size of 0. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T size() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T size () const IMATH_NOEXCEPT; + + /// Return the center of the interval. The center is defined as + /// (max+min)/2. The center of an empty interval is undefined. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T center() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T center () const IMATH_NOEXCEPT; + + /// Return true if the given point is inside the interval, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects (const T& point) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersects (const T& point) const IMATH_NOEXCEPT; + + /// Return true if the given interval is inside the interval, false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects (const Interval& interval) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersects (const Interval& interval) const IMATH_NOEXCEPT; + + /// Return true if the interval is empty, false otherwise. An + /// empty interval's minimum is greater than its maximum. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isEmpty() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isEmpty () const IMATH_NOEXCEPT; + + /// Return true if the interval is larger than a single point, + /// false otherwise. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool hasVolume() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool hasVolume () const IMATH_NOEXCEPT; + + /// Return true if the interval contains all points, false + /// otherwise. An infinite box has a mimimum of std::numeric_limits::lowest() + /// and a maximum of std::numeric_limits::max() +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isInfinite() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isInfinite () const IMATH_NOEXCEPT; + + /// @} + }; + + /// Stream output, as "(min max)" +-template std::ostream& operator<< (std::ostream& s, const Interval& v); ++template ++std::ostream& operator<< (std::ostream& s, const Interval& v); + + /// Interval of type float + typedef Interval Intervalf; +@@ -127,20 +132,23 @@ typedef Interval Intervals; + typedef Interval Intervali; + + template +-IMATH_HOSTDEVICE inline IMATH_CONSTEXPR14 Interval::Interval() IMATH_NOEXCEPT ++IMATH_HOSTDEVICE inline IMATH_CONSTEXPR14 ++Interval::Interval () IMATH_NOEXCEPT + { +- makeEmpty(); ++ makeEmpty (); + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Interval::Interval (const T& point) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Interval::Interval (const T& point) ++ IMATH_NOEXCEPT + { + min = point; + max = point; + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Interval::Interval (const T& minV, const T& maxV) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Interval::Interval ( ++ const T& minV, const T& maxV) IMATH_NOEXCEPT + { + min = minV; + max = maxV; +@@ -162,41 +170,36 @@ Interval::operator!= (const Interval& src) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline void +-Interval::makeEmpty() IMATH_NOEXCEPT ++Interval::makeEmpty () IMATH_NOEXCEPT + { +- min = std::numeric_limits::max(); +- max = std::numeric_limits::lowest(); ++ min = std::numeric_limits::max (); ++ max = std::numeric_limits::lowest (); + } + + template + IMATH_HOSTDEVICE inline void +-Interval::makeInfinite() IMATH_NOEXCEPT ++Interval::makeInfinite () IMATH_NOEXCEPT + { +- min = std::numeric_limits::lowest(); +- max = std::numeric_limits::max(); ++ min = std::numeric_limits::lowest (); ++ max = std::numeric_limits::max (); + } + +- + template + IMATH_HOSTDEVICE inline void + Interval::extendBy (const T& point) IMATH_NOEXCEPT + { +- if (point < min) +- min = point; ++ if (point < min) min = point; + +- if (point > max) +- max = point; ++ if (point > max) max = point; + } + + template + IMATH_HOSTDEVICE inline void + Interval::extendBy (const Interval& interval) IMATH_NOEXCEPT + { +- if (interval.min < min) +- min = interval.min; ++ if (interval.min < min) min = interval.min; + +- if (interval.max > max) +- max = interval.max; ++ if (interval.max > max) max = interval.max; + } + + template +@@ -215,40 +218,40 @@ Interval::intersects (const Interval& interval) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T +-Interval::size() const IMATH_NOEXCEPT ++Interval::size () const IMATH_NOEXCEPT + { +- if (isEmpty()) +- return T(0); +- ++ if (isEmpty ()) return T (0); ++ + return max - min; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T +-Interval::center() const IMATH_NOEXCEPT ++Interval::center () const IMATH_NOEXCEPT + { + return (max + min) / 2; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Interval::isEmpty() const IMATH_NOEXCEPT ++Interval::isEmpty () const IMATH_NOEXCEPT + { + return max < min; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Interval::hasVolume() const IMATH_NOEXCEPT ++Interval::hasVolume () const IMATH_NOEXCEPT + { + return max > min; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool +-Interval::isInfinite() const IMATH_NOEXCEPT ++Interval::isInfinite () const IMATH_NOEXCEPT + { +- if (min != std::numeric_limits::lowest() || max != std::numeric_limits::max()) ++ if (min != std::numeric_limits::lowest () || ++ max != std::numeric_limits::max ()) + return false; + + return true; +diff --git a/src/Imath/ImathLine.h b/src/Imath/ImathLine.h +index 499d75b..73c32e9 100644 +--- a/src/Imath/ImathLine.h ++++ b/src/Imath/ImathLine.h +@@ -23,11 +23,10 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class Line3 + { +- public: +- ++public: + /// @{ + /// @name Direct access to member fields +- ++ + /// A point on the line + Vec3 pos; + +@@ -40,40 +39,47 @@ template class Line3 + /// @name Constructors + + /// Uninitialized by default +- IMATH_HOSTDEVICE constexpr Line3() IMATH_NOEXCEPT {} ++ IMATH_HOSTDEVICE constexpr Line3 () IMATH_NOEXCEPT {} + + /// Initialize with two points. The direction is the difference + /// between the points. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Line3 (const Vec3& point1, const Vec3& point2) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Line3 (const Vec3& point1, const Vec3& point2) IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Manipulation +- ++ + /// Set the line defined by two points. The direction is the difference + /// between the points. +- IMATH_HOSTDEVICE void set (const Vec3& point1, const Vec3& point2) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ set (const Vec3& point1, const Vec3& point2) IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Utility Methods +- ++ + /// Return the point on the line at the given parameter value, + /// e.g. L(t) +- IMATH_HOSTDEVICE constexpr Vec3 operator() (T parameter) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 ++ operator() (T parameter) const IMATH_NOEXCEPT; + + /// Return the distance to the given point +- IMATH_HOSTDEVICE constexpr T distanceTo (const Vec3& point) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T ++ distanceTo (const Vec3& point) const IMATH_NOEXCEPT; + /// Return the distance to the given line +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T distanceTo (const Line3& line) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T ++ distanceTo (const Line3& line) const IMATH_NOEXCEPT; + + /// Return the point on the line closest to the given point +- IMATH_HOSTDEVICE constexpr Vec3 closestPointTo (const Vec3& point) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 ++ closestPointTo (const Vec3& point) const IMATH_NOEXCEPT; + + /// Return the point on the line closest to the given line +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 closestPointTo (const Line3& line) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 ++ closestPointTo (const Line3& line) const IMATH_NOEXCEPT; + + /// @} + }; +@@ -85,7 +91,8 @@ typedef Line3 Line3f; + typedef Line3 Line3d; + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Line3::Line3 (const Vec3& p0, const Vec3& p1) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Line3::Line3 ( ++ const Vec3& p0, const Vec3& p1) IMATH_NOEXCEPT + { + set (p0, p1); + } +@@ -96,7 +103,7 @@ Line3::set (const Vec3& p0, const Vec3& p1) IMATH_NOEXCEPT + { + pos = p0; + dir = p1 - p0; +- dir.normalize(); ++ dir.normalize (); + } + + template +@@ -110,7 +117,7 @@ template + IMATH_HOSTDEVICE constexpr inline T + Line3::distanceTo (const Vec3& point) const IMATH_NOEXCEPT + { +- return (closestPointTo (point) - point).length(); ++ return (closestPointTo (point) - point).length (); + } + + template +@@ -135,10 +142,10 @@ Line3::closestPointTo (const Line3& line) const IMATH_NOEXCEPT + // Assumes the lines are normalized + + Vec3 posLpos = pos - line.pos; +- T c = dir ^ posLpos; +- T a = line.dir ^ dir; +- T f = line.dir ^ posLpos; +- T num = c - a * f; ++ T c = dir ^ posLpos; ++ T a = line.dir ^ dir; ++ T f = line.dir ^ posLpos; ++ T num = c - a * f; + + T denom = a * a - 1; + +@@ -148,8 +155,7 @@ Line3::closestPointTo (const Line3& line) const IMATH_NOEXCEPT + { + T absNum = ((num >= 0) ? num : -num); + +- if (absNum >= absDenom * std::numeric_limits::max()) +- return pos; ++ if (absNum >= absDenom * std::numeric_limits::max ()) return pos; + } + + return pos + dir * (num / denom); +diff --git a/src/Imath/ImathLineAlgo.h b/src/Imath/ImathLineAlgo.h +index 89d3a77..a5e6add 100644 +--- a/src/Imath/ImathLineAlgo.h ++++ b/src/Imath/ImathLineAlgo.h +@@ -28,18 +28,23 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template + IMATH_CONSTEXPR14 bool +-closestPoints (const Line3& line1, const Line3& line2, Vec3& point1, Vec3& point2) IMATH_NOEXCEPT ++closestPoints ( ++ const Line3& line1, ++ const Line3& line2, ++ Vec3& point1, ++ Vec3& point2) IMATH_NOEXCEPT + { +- Vec3 w = line1.pos - line2.pos; +- T d1w = line1.dir ^ w; +- T d2w = line2.dir ^ w; +- T d1d2 = line1.dir ^ line2.dir; +- T n1 = d1d2 * d2w - d1w; +- T n2 = d2w - d1d2 * d1w; +- T d = 1 - d1d2 * d1d2; +- T absD = abs (d); +- +- if ((absD > 1) || (abs (n1) < std::numeric_limits::max() * absD && abs (n2) < std::numeric_limits::max() * absD)) ++ Vec3 w = line1.pos - line2.pos; ++ T d1w = line1.dir ^ w; ++ T d2w = line2.dir ^ w; ++ T d1d2 = line1.dir ^ line2.dir; ++ T n1 = d1d2 * d2w - d1w; ++ T n2 = d2w - d1d2 * d1w; ++ T d = 1 - d1d2 * d1d2; ++ T absD = abs (d); ++ ++ if ((absD > 1) || (abs (n1) < std::numeric_limits::max () * absD && ++ abs (n2) < std::numeric_limits::max () * absD)) + { + point1 = line1 (n1 / d); + point2 = line2 (n2 / d); +@@ -77,19 +82,20 @@ closestPoints (const Line3& line1, const Line3& line2, Vec3& point1, Ve + + template + IMATH_CONSTEXPR14 bool +-intersect (const Line3& line, +- const Vec3& v0, +- const Vec3& v1, +- const Vec3& v2, +- Vec3& pt, +- Vec3& barycentric, +- bool& front) IMATH_NOEXCEPT ++intersect ( ++ const Line3& line, ++ const Vec3& v0, ++ const Vec3& v1, ++ const Vec3& v2, ++ Vec3& pt, ++ Vec3& barycentric, ++ bool& front) IMATH_NOEXCEPT + { + Vec3 edge0 = v1 - v0; + Vec3 edge1 = v2 - v1; + Vec3 normal = edge1 % edge0; + +- T l = normal.length(); ++ T l = normal.length (); + + if (l != 0) + normal /= l; +@@ -104,7 +110,7 @@ intersect (const Line3& line, + T d = normal ^ (v0 - line.pos); + T nd = normal ^ line.dir; + +- if (abs (nd) > 1 || abs (d) < std::numeric_limits::max() * abs (nd)) ++ if (abs (nd) > 1 || abs (d) < std::numeric_limits::max () * abs (nd)) + pt = line (d / nd); + else + return false; // line and plane are nearly parallel +@@ -116,13 +122,13 @@ intersect (const Line3& line, + // + + { +- Vec3 en = edge0.normalized(); ++ Vec3 en = edge0.normalized (); + Vec3 a = pt - v0; + Vec3 b = v2 - v0; + Vec3 c = (a - en * (en ^ a)); + Vec3 d = (b - en * (en ^ b)); +- T e = c ^ d; +- T f = d ^ d; ++ T e = c ^ d; ++ T f = d ^ d; + + if (e >= 0 && e <= f) + barycentric.z = e / f; +@@ -131,13 +137,13 @@ intersect (const Line3& line, + } + + { +- Vec3 en = edge1.normalized(); ++ Vec3 en = edge1.normalized (); + Vec3 a = pt - v1; + Vec3 b = v0 - v1; + Vec3 c = (a - en * (en ^ a)); + Vec3 d = (b - en * (en ^ b)); +- T e = c ^ d; +- T f = d ^ d; ++ T e = c ^ d; ++ T f = d ^ d; + + if (e >= 0 && e <= f) + barycentric.x = e / f; +@@ -147,8 +153,7 @@ intersect (const Line3& line, + + barycentric.y = 1 - barycentric.x - barycentric.z; + +- if (barycentric.y < 0) +- return false; // outside ++ if (barycentric.y < 0) return false; // outside + + front = ((line.dir ^ normal) < 0); + return true; +@@ -161,12 +166,14 @@ intersect (const Line3& line, + + template + IMATH_CONSTEXPR14 Vec3 +-closestVertex (const Vec3& v0, const Vec3& v1, const Vec3& v2, const Line3& l) IMATH_NOEXCEPT ++ closestVertex ( ++ const Vec3& v0, const Vec3& v1, const Vec3& v2, const Line3& l) ++ IMATH_NOEXCEPT + { + Vec3 nearest = v0; +- T neardot = (v0 - l.closestPointTo (v0)).length2(); ++ T neardot = (v0 - l.closestPointTo (v0)).length2 (); + +- T tmp = (v1 - l.closestPointTo (v1)).length2(); ++ T tmp = (v1 - l.closestPointTo (v1)).length2 (); + + if (tmp < neardot) + { +@@ -174,7 +181,7 @@ closestVertex (const Vec3& v0, const Vec3& v1, const Vec3& v2, const Li + nearest = v1; + } + +- tmp = (v2 - l.closestPointTo (v2)).length2(); ++ tmp = (v2 - l.closestPointTo (v2)).length2 (); + if (tmp < neardot) + { + neardot = tmp; +@@ -197,12 +204,12 @@ rotatePoint (const Vec3 p, Line3 l, T angle) IMATH_NOEXCEPT + // plane. + // + +- Vec3 q = l.closestPointTo (p); +- Vec3 x = p - q; +- T radius = x.length(); ++ Vec3 q = l.closestPointTo (p); ++ Vec3 x = p - q; ++ T radius = x.length (); + +- x.normalize(); +- Vec3 y = (x % l.dir).normalize(); ++ x.normalize (); ++ Vec3 y = (x % l.dir).normalize (); + + T cosangle = std::cos (angle); + T sinangle = std::sin (angle); +diff --git a/src/Imath/ImathMath.h b/src/Imath/ImathMath.h +index d6551b9..b3d2845 100644 +--- a/src/Imath/ImathMath.h ++++ b/src/Imath/ImathMath.h +@@ -36,59 +36,59 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + /// @cond Doxygen_Suppress + template struct Math + { +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T acos (T x) { return std::acos (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T asin (T x) { return std::asin (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T atan (T x) { return std::atan (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T atan2 (T x, T y) { return std::atan2 (x, y); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T cos (T x) { return std::cos (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T sin (T x) { return std::sin (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T tan (T x) { return std::tan (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T cosh (T x) { return std::cosh (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T sinh (T x) { return std::sinh (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T tanh (T x) { return std::tanh (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T exp (T x) { return std::exp (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T log (T x) { return std::log (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T log10 (T x) { return std::log10 (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T modf (T x, T* iptr) + { +@@ -98,44 +98,43 @@ template struct Math + return rval; + } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T pow (T x, T y) { return std::pow (x, y); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T sqrt (T x) { return std::sqrt (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T ceil (T x) { return std::ceil (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T fabs (T x) { return std::fabs (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T floor (T x) { return std::floor (x); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T fmod (T x, T y) { return std::fmod (x, y); } + +- IMATH_DEPRECATED("use std::math functions") ++ IMATH_DEPRECATED ("use std::math functions") + IMATH_HOSTDEVICE + static T hypot (T x, T y) { return std::hypot (x, y); } + }; + /// @endcond + +- + /// Don Hatch's version of sin(x)/x, which is accurate for very small x. + /// Returns 1 for x == 0. + template + IMATH_HOSTDEVICE inline T + sinx_over_x (T x) + { +- if (x * x < std::numeric_limits::epsilon()) ++ if (x * x < std::numeric_limits::epsilon ()) + return T (1); + else + return std::sin (x) / x; +diff --git a/src/Imath/ImathMatrix.h b/src/Imath/ImathMatrix.h +index 3336dbe..a9a9847 100644 +--- a/src/Imath/ImathMatrix.h ++++ b/src/Imath/ImathMatrix.h +@@ -44,16 +44,15 @@ enum IMATH_EXPORT_ENUM Uninitialized + + template class IMATH_EXPORT_TEMPLATE_TYPE Matrix22 + { +- public: +- ++public: + /// @{ + /// @name Direct access to elements +- ++ + /// Matrix elements + T x[2][2]; + + /// @} +- ++ + /// Row access + IMATH_HOSTDEVICE T* operator[] (int i) IMATH_NOEXCEPT; + +@@ -70,7 +69,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix22 + /// + /// 1 0 + /// 0 1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 () IMATH_NOEXCEPT; + + /// Initialize to scalar constant: + /// +@@ -82,28 +81,35 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix22 + /// + /// a[0][0] a[0][1] + /// a[1][0] a[1][1] +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 (const T a[2][2]) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 (const T a[2][2]) ++ IMATH_NOEXCEPT; + + /// Construct from given scalar values: + /// + /// a b + /// c d +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 (T a, T b, T c, T d) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 (T a, T b, T c, T d) ++ IMATH_NOEXCEPT; + + /// Copy constructor +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 (const Matrix22& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 (const Matrix22& v) ++ IMATH_NOEXCEPT; + + /// Construct from Matrix22 of another base type +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 explicit Matrix22 (const Matrix22& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 explicit Matrix22 (const Matrix22& v) ++ IMATH_NOEXCEPT; + + /// Assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& operator= (const Matrix22& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ operator= (const Matrix22& v) IMATH_NOEXCEPT; + + /// Assignment from scalar +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& operator= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ operator= (T a) IMATH_NOEXCEPT; + + /// Destructor +- ~Matrix22() IMATH_NOEXCEPT = default; ++ ~Matrix22 () IMATH_NOEXCEPT = default; + + /// @} + +@@ -122,15 +128,19 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix22 + /// disabled by defining IMATH_FOREIGN_VECTOR_INTEROP to be 0 prior to + /// including any Imath header files. + /// +- template::value)> ++ template < ++ typename M, ++ IMATH_ENABLE_IF (has_double_subscript::value)> + IMATH_HOSTDEVICE explicit Matrix22 (const M& m) +- : Matrix22(T(m[0][0]), T(m[0][1]), T(m[1][0]), T(m[1][1])) +- { } ++ : Matrix22 (T (m[0][0]), T (m[0][1]), T (m[1][0]), T (m[1][1])) ++ {} + +- template::value)> ++ template < ++ typename M, ++ IMATH_ENABLE_IF (has_double_subscript::value)> + IMATH_HOSTDEVICE const Matrix22& operator= (const M& m) + { +- *this = Matrix22(T(m[0][0]), T(m[0][1]), T(m[1][0]), T(m[1][1])); ++ *this = Matrix22 (T (m[0][0]), T (m[0][1]), T (m[1][0]), T (m[1][1])); + return *this; + } + /// @} +@@ -140,92 +150,112 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix22 + /// @name Compatibility with Sb + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE T* getValue() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T* getValue () IMATH_NOEXCEPT; + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE const T* getValue() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const T* getValue () const IMATH_NOEXCEPT; + + /// Return the value in `v` +- template IMATH_HOSTDEVICE void getValue (Matrix22& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void getValue (Matrix22& v) const IMATH_NOEXCEPT; + + /// Set the value +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22& setValue (const Matrix22& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22& ++ setValue (const Matrix22& v) IMATH_NOEXCEPT; + + /// Set the value + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22& setTheMatrix (const Matrix22& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22& ++ setTheMatrix (const Matrix22& v) IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Arithmetic and Comparison +- ++ + /// Equality +- IMATH_HOSTDEVICE constexpr bool operator== (const Matrix22& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Matrix22& v) const IMATH_NOEXCEPT; + + /// Inequality +- IMATH_HOSTDEVICE constexpr bool operator!= (const Matrix22& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Matrix22& v) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and `m` are the same + /// with an absolute error of no more than e, i.e., for all i, j: + /// + /// abs (this[i][j] - m[i][j]) <= e +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError (const Matrix22& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithAbsError (const Matrix22& v, T e) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and m are the same with + /// a relative error of no more than e, i.e., for all i, j: + /// + /// abs (this[i] - v[i][j]) <= e * abs (this[i][j]) +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError (const Matrix22& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithRelError (const Matrix22& v, T e) const IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& operator+= (const Matrix22& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ operator+= (const Matrix22& v) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& operator+= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ operator+= (T a) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE constexpr Matrix22 operator+ (const Matrix22& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix22 ++ operator+ (const Matrix22& v) const IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& operator-= (const Matrix22& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ operator-= (const Matrix22& v) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& operator-= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ operator-= (T a) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE constexpr Matrix22 operator- (const Matrix22& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix22 ++ operator- (const Matrix22& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE constexpr Matrix22 operator-() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix22 operator- () const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& negate() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& negate () IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& operator*= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ operator*= (T a) IMATH_NOEXCEPT; + + /// Component-wise multiplication + IMATH_HOSTDEVICE constexpr Matrix22 operator* (T a) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& operator/= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ operator/= (T a) IMATH_NOEXCEPT; + + /// Component-wise division + IMATH_HOSTDEVICE constexpr Matrix22 operator/ (T a) const IMATH_NOEXCEPT; + + /// Matrix-matrix multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& operator*= (const Matrix22& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ operator*= (const Matrix22& v) IMATH_NOEXCEPT; + + /// Matrix-matrix multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 operator* (const Matrix22& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 ++ operator* (const Matrix22& v) const IMATH_NOEXCEPT; + + /// Vector * matrix multiplication + /// @param[in] src Input vector + /// @param[out] dst transformed vector +- template IMATH_HOSTDEVICE void multDirMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void ++ multDirMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCEPT; + + /// @} + +@@ -233,13 +263,14 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix22 + /// @name Maniplation + + /// Set to the identity +- IMATH_HOSTDEVICE void makeIdentity() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeIdentity () IMATH_NOEXCEPT; + + /// Transpose +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& transpose() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ transpose () IMATH_NOEXCEPT; + + /// Return the transpose +- IMATH_HOSTDEVICE constexpr Matrix22 transposed() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix22 transposed () const IMATH_NOEXCEPT; + + /// Invert in place + /// @param singExc If true, throw an exception if the matrix cannot be inverted. +@@ -248,60 +279,83 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix22 + + /// Invert in place + /// @return const reference to this +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& invert() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& invert () IMATH_NOEXCEPT; + + /// Return the inverse, leaving this unmodified. + /// @param singExc If true, throw an exception if the matrix cannot be inverted. + IMATH_CONSTEXPR14 Matrix22 inverse (bool singExc) const; + + /// Return the inverse, leaving this unmodified. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 inverse() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix22 ++ inverse () const IMATH_NOEXCEPT; + + /// Determinant +- IMATH_HOSTDEVICE constexpr T determinant() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T determinant () const IMATH_NOEXCEPT; + + /// Set matrix to rotation by r (in radians) + /// @return const referenced to this +- template IMATH_HOSTDEVICE const Matrix22& setRotation (S r) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE const Matrix22& setRotation (S r) IMATH_NOEXCEPT; + + /// Rotate the given matrix by r (in radians) + /// @return const referenced to this +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& rotate (S r) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ rotate (S r) IMATH_NOEXCEPT; + + /// Set matrix to scale by given uniform factor + /// @return const referenced to this +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& setScale (T s) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ setScale (T s) IMATH_NOEXCEPT; + + /// Set matrix to scale by given vector + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& setScale (const Vec2& s) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ setScale (const Vec2& s) IMATH_NOEXCEPT; + + // Scale the matrix by s + /// @return const referenced to this +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& scale (const Vec2& s) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix22& ++ scale (const Vec2& s) IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Numeric Limits +- ++ + /// Largest possible negative value +- IMATH_HOSTDEVICE constexpr static T baseTypeLowest() IMATH_NOEXCEPT { return std::numeric_limits::lowest(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeLowest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::lowest (); ++ } + + /// Largest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeMax() IMATH_NOEXCEPT { return std::numeric_limits::max(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeMax () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::max (); ++ } + + /// Smallest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeSmallest() IMATH_NOEXCEPT { return std::numeric_limits::min(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeSmallest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::min (); ++ } + + /// Smallest possible e for which 1+e != 1 +- IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon() IMATH_NOEXCEPT { return std::numeric_limits::epsilon(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::epsilon (); ++ } + + /// @} +- ++ + /// Return the number of the row and column dimensions, i.e. 2. +- IMATH_HOSTDEVICE constexpr static unsigned int dimensions() IMATH_NOEXCEPT { return 2; } ++ IMATH_HOSTDEVICE constexpr static unsigned int dimensions () IMATH_NOEXCEPT ++ { ++ return 2; ++ } + + /// The base type: In templates that accept a parameter `V`, you + /// can refer to `T` as `V::BaseType` +@@ -317,16 +371,15 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix22 + + template class IMATH_EXPORT_TEMPLATE_TYPE Matrix33 + { +- public: +- ++public: + /// @{ + /// @name Direct access to elements +- ++ + /// Matrix elements + T x[3][3]; + + /// @} +- ++ + /// Row access + IMATH_HOSTDEVICE T* operator[] (int i) IMATH_NOEXCEPT; + +@@ -343,7 +396,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix33 + /// 1 0 0 + /// 0 1 0 + /// 0 0 1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 () IMATH_NOEXCEPT; + + /// Initialize to scalar constant + /// a a a +@@ -351,32 +404,39 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix33 + /// a a a + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 (T a) IMATH_NOEXCEPT; + +- /// Construct from 3x3 array ++ /// Construct from 3x3 array + /// a[0][0] a[0][1] a[0][2] + /// a[1][0] a[1][1] a[1][2] + /// a[2][0] a[2][1] a[2][2] +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 (const T a[3][3]) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 (const T a[3][3]) ++ IMATH_NOEXCEPT; + + /// Construct from given scalar values + /// a b c + /// d e f + /// g h i +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 (T a, T b, T c, T d, T e, T f, T g, T h, T i) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Matrix33 (T a, T b, T c, T d, T e, T f, T g, T h, T i) IMATH_NOEXCEPT; + + /// Copy constructor +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 (const Matrix33& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 (const Matrix33& v) ++ IMATH_NOEXCEPT; + + /// Construct from Matrix33 of another base type +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 explicit Matrix33 (const Matrix33& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 explicit Matrix33 (const Matrix33& v) ++ IMATH_NOEXCEPT; + + /// Assignment operator +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& operator= (const Matrix33& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ operator= (const Matrix33& v) IMATH_NOEXCEPT; + + /// Assignment from scalar +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& operator= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ operator= (T a) IMATH_NOEXCEPT; + + /// Destructor +- ~Matrix33() IMATH_NOEXCEPT = default; ++ ~Matrix33 () IMATH_NOEXCEPT = default; + + /// @} + +@@ -395,21 +455,39 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix33 + /// disabled by defining IMATH_FOREIGN_VECTOR_INTEROP to be 0 prior to + /// including any Imath header files. + /// +- template::value)> ++ template < ++ typename M, ++ IMATH_ENABLE_IF (has_double_subscript::value)> + IMATH_HOSTDEVICE explicit Matrix33 (const M& m) +- : Matrix33(T(m[0][0]), T(m[0][1]), T(m[0][2]), +- T(m[1][0]), T(m[1][1]), T(m[1][2]), +- T(m[2][0]), T(m[2][1]), T(m[2][2])) +- { } ++ : Matrix33 ( ++ T (m[0][0]), ++ T (m[0][1]), ++ T (m[0][2]), ++ T (m[1][0]), ++ T (m[1][1]), ++ T (m[1][2]), ++ T (m[2][0]), ++ T (m[2][1]), ++ T (m[2][2])) ++ {} + + /// Interoperability assignment from another type that behaves as if it + /// were an equivalent matrix. +- template::value)> ++ template < ++ typename M, ++ IMATH_ENABLE_IF (has_double_subscript::value)> + IMATH_HOSTDEVICE const Matrix33& operator= (const M& m) + { +- *this = Matrix33(T(m[0][0]), T(m[0][1]), T(m[0][2]), +- T(m[1][0]), T(m[1][1]), T(m[1][2]), +- T(m[2][0]), T(m[2][1]), T(m[2][2])); ++ *this = Matrix33 ( ++ T (m[0][0]), ++ T (m[0][1]), ++ T (m[0][2]), ++ T (m[1][0]), ++ T (m[1][1]), ++ T (m[1][2]), ++ T (m[2][0]), ++ T (m[2][1]), ++ T (m[2][2])); + return *this; + } + /// @} +@@ -419,100 +497,122 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix33 + /// @name Compatibility with Sb + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE T* getValue() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T* getValue () IMATH_NOEXCEPT; + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE const T* getValue() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const T* getValue () const IMATH_NOEXCEPT; + + /// Return the value in `v` +- template IMATH_HOSTDEVICE void getValue (Matrix33& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void getValue (Matrix33& v) const IMATH_NOEXCEPT; + + /// Set the value +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33& setValue (const Matrix33& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33& ++ setValue (const Matrix33& v) IMATH_NOEXCEPT; + + /// Set the value + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33& setTheMatrix (const Matrix33& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33& ++ setTheMatrix (const Matrix33& v) IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Arithmetic and Comparison +- ++ + /// Equality +- IMATH_HOSTDEVICE constexpr bool operator== (const Matrix33& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Matrix33& v) const IMATH_NOEXCEPT; + + /// Inequality +- IMATH_HOSTDEVICE constexpr bool operator!= (const Matrix33& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Matrix33& v) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and `m` are the same + /// with an absolute error of no more than e, i.e., for all i, j: + /// + /// abs (this[i][j] - m[i][j]) <= e +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError (const Matrix33& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithAbsError (const Matrix33& v, T e) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and m are the same with + /// a relative error of no more than e, i.e., for all i, j: + /// + /// abs (this[i] - v[i][j]) <= e * abs (this[i][j]) +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError (const Matrix33& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithRelError (const Matrix33& v, T e) const IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& operator+= (const Matrix33& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ operator+= (const Matrix33& v) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& operator+= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ operator+= (T a) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE constexpr Matrix33 operator+ (const Matrix33& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix33 ++ operator+ (const Matrix33& v) const IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& operator-= (const Matrix33& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ operator-= (const Matrix33& v) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& operator-= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ operator-= (T a) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE constexpr Matrix33 operator- (const Matrix33& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix33 ++ operator- (const Matrix33& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE constexpr Matrix33 operator-() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix33 operator- () const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& negate() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& negate () IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& operator*= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ operator*= (T a) IMATH_NOEXCEPT; + + /// Component-wise multiplication + IMATH_HOSTDEVICE constexpr Matrix33 operator* (T a) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& operator/= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ operator/= (T a) IMATH_NOEXCEPT; + + /// Component-wise division + IMATH_HOSTDEVICE constexpr Matrix33 operator/ (T a) const IMATH_NOEXCEPT; + + /// Matrix-matrix multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& operator*= (const Matrix33& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ operator*= (const Matrix33& v) IMATH_NOEXCEPT; + + /// Matrix-matrix multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 operator* (const Matrix33& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 ++ operator* (const Matrix33& v) const IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: a homogeneous transformation + /// by computing Vec3 (src.x, src.y, 1) * m and dividing by the + /// result's third element. + /// @param[in] src The input vector + /// @param[out] dst The output vector +- template IMATH_HOSTDEVICE void multVecMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void ++ multVecMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: multiply `src` by the upper left 2x2 + /// submatrix, ignoring the rest of matrix. + /// @param[in] src The input vector + /// @param[out] dst The output vector +- template IMATH_HOSTDEVICE void multDirMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void ++ multDirMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCEPT; + + /// @} + +@@ -520,13 +620,14 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix33 + /// @name Maniplation + + /// Set to the identity matrix +- IMATH_HOSTDEVICE void makeIdentity() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeIdentity () IMATH_NOEXCEPT; + + /// Transpose +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& transpose() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ transpose () IMATH_NOEXCEPT; + + /// Return the transpose +- IMATH_HOSTDEVICE constexpr Matrix33 transposed() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix33 transposed () const IMATH_NOEXCEPT; + + /// Invert in place using the determinant. + /// @param singExc If true, throw an exception if the matrix cannot be inverted. +@@ -535,25 +636,26 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix33 + + /// Invert in place using the determinant. + /// @return const reference to this +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& invert() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& invert () IMATH_NOEXCEPT; + + /// Return the inverse using the determinant, leaving this unmodified. + /// @param singExc If true, throw an exception if the matrix cannot be inverted. + IMATH_CONSTEXPR14 Matrix33 inverse (bool singExc) const; + + /// Return the inverse using the determinant, leaving this unmodified. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 inverse() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix33 ++ inverse () const IMATH_NOEXCEPT; + + /// Invert in place using the Gauss-Jordan method. Significantly slower + /// but more accurate than invert(). + /// @param singExc If true, throw an exception if the matrix cannot be inverted. + /// @return const reference to this + const Matrix33& gjInvert (bool singExc); +- ++ + /// Invert in place using the Gauss-Jordan method. Significantly slower + /// but more accurate than invert(). + /// @return const reference to this +- IMATH_HOSTDEVICE const Matrix33& gjInvert() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const Matrix33& gjInvert () IMATH_NOEXCEPT; + + /// Return the inverse using the Gauss-Jordan method, leaving this + /// unmodified. Significantly slower but more accurate than inverse(). +@@ -561,92 +663,126 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix33 + + /// Return the inverse using the Gauss-Jordan method. Significantly slower, + /// leaving this unmodified. Slower but more accurate than inverse(). +- IMATH_HOSTDEVICE Matrix33 gjInverse() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Matrix33 gjInverse () const IMATH_NOEXCEPT; + + /// Calculate the matrix minor of the (r,c) element +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T minorOf (const int r, const int c) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T ++ minorOf (const int r, const int c) const IMATH_NOEXCEPT; + + /// Build a minor using the specified rows and columns + IMATH_HOSTDEVICE +- constexpr T fastMinor (const int r0, const int r1, const int c0, const int c1) const IMATH_NOEXCEPT; ++ constexpr T ++ fastMinor (const int r0, const int r1, const int c0, const int c1) const ++ IMATH_NOEXCEPT; + + /// Determinant +- IMATH_HOSTDEVICE constexpr T determinant() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T determinant () const IMATH_NOEXCEPT; + + /// Set matrix to rotation by r (in radians) + /// @return const referenced to this +- template IMATH_HOSTDEVICE const Matrix33& setRotation (S r) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE const Matrix33& setRotation (S r) IMATH_NOEXCEPT; + + // Rotate the given matrix by r (in radians) + /// @return const referenced to this +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& rotate (S r) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ rotate (S r) IMATH_NOEXCEPT; + + /// Set matrix to scale by given uniform factor + /// @return const referenced to this +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& setScale (T s) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ setScale (T s) IMATH_NOEXCEPT; + + /// Set matrix to scale by given vector + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& setScale (const Vec2& s) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ setScale (const Vec2& s) IMATH_NOEXCEPT; + + /// Scale the matrix by s + /// @return const referenced to this +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& scale (const Vec2& s) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ scale (const Vec2& s) IMATH_NOEXCEPT; + + /// Set matrix to translation by given vector + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& setTranslation (const Vec2& t) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ setTranslation (const Vec2& t) IMATH_NOEXCEPT; + + /// Return the translation component +- IMATH_HOSTDEVICE constexpr Vec2 translation() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec2 translation () const IMATH_NOEXCEPT; + + /// Translate the matrix by t + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& translate (const Vec2& t) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ translate (const Vec2& t) IMATH_NOEXCEPT; + + /// Set matrix to shear x for each y coord. by given factor xy + /// @return const referenced to this +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& setShear (const S& h) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ setShear (const S& h) IMATH_NOEXCEPT; + + /// Set matrix to shear x for each y coord. by given factor h.x + /// and to shear y for each x coord. by given factor h.y + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& setShear (const Vec2& h) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ setShear (const Vec2& h) IMATH_NOEXCEPT; + + /// Shear the matrix in x for each y coord. by given factor xy + /// @return const referenced to this +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& shear (const S& xy) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ shear (const S& xy) IMATH_NOEXCEPT; + + /// Shear the matrix in x for each y coord. by given factor xy + /// and shear y for each x coord. by given factor yx + /// @return const referenced to this +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& shear (const Vec2& h) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix33& ++ shear (const Vec2& h) IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Numeric Limits +- ++ + /// Largest possible negative value +- IMATH_HOSTDEVICE constexpr static T baseTypeLowest() IMATH_NOEXCEPT { return std::numeric_limits::lowest(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeLowest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::lowest (); ++ } + + /// Largest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeMax() IMATH_NOEXCEPT { return std::numeric_limits::max(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeMax () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::max (); ++ } + + /// Smallest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeSmallest() IMATH_NOEXCEPT { return std::numeric_limits::min(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeSmallest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::min (); ++ } + + /// Smallest possible e for which 1+e != 1 +- IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon() IMATH_NOEXCEPT { return std::numeric_limits::epsilon(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::epsilon (); ++ } + + /// @} +- ++ + /// Return the number of the row and column dimensions, i.e. 3. +- IMATH_HOSTDEVICE constexpr static unsigned int dimensions() IMATH_NOEXCEPT { return 3; } ++ IMATH_HOSTDEVICE constexpr static unsigned int dimensions () IMATH_NOEXCEPT ++ { ++ return 3; ++ } + + /// The base type: In templates that accept a parameter `V` (could be a Color4), you can refer to `T` as `V::BaseType` + typedef T BaseType; +@@ -661,16 +797,15 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix33 + + template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + { +- public: +- ++public: + /// @{ + /// @name Direct access to elements +- ++ + /// Matrix elements + T x[4][4]; + + /// @} +- ++ + /// Row access + IMATH_HOSTDEVICE T* operator[] (int i) IMATH_NOEXCEPT; + +@@ -688,7 +823,7 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// 0 1 0 0 + /// 0 0 1 0 + /// 0 0 0 1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 () IMATH_NOEXCEPT; + + /// Initialize to scalar constant + /// a a a a +@@ -697,43 +832,64 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// a a a a + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 (T a) IMATH_NOEXCEPT; + +- /// Construct from 4x4 array ++ /// Construct from 4x4 array + /// a[0][0] a[0][1] a[0][2] a[0][3] + /// a[1][0] a[1][1] a[1][2] a[1][3] + /// a[2][0] a[2][1] a[2][2] a[2][3] + /// a[3][0] a[3][1] a[3][2] a[3][3] +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 (const T a[4][4]) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 (const T a[4][4]) ++ IMATH_NOEXCEPT; + + /// Construct from given scalar values + /// a b c d + /// e f g h + /// i j k l + /// m n o p +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 +- Matrix44 (T a, T b, T c, T d, T e, T f, T g, T h, T i, T j, T k, T l, T m, T n, T o, T p) IMATH_NOEXCEPT; +- ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 ( ++ T a, ++ T b, ++ T c, ++ T d, ++ T e, ++ T f, ++ T g, ++ T h, ++ T i, ++ T j, ++ T k, ++ T l, ++ T m, ++ T n, ++ T o, ++ T p) IMATH_NOEXCEPT; + + /// Construct from a 3x3 rotation matrix and a translation vector + /// r r r 0 + /// r r r 0 + /// r r r 0 + /// t t t 1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 (Matrix33 r, Vec3 t) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 (Matrix33 r, Vec3 t) ++ IMATH_NOEXCEPT; + + /// Copy constructor +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 (const Matrix44& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 (const Matrix44& v) ++ IMATH_NOEXCEPT; + + /// Construct from Matrix44 of another base type +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 explicit Matrix44 (const Matrix44& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 explicit Matrix44 (const Matrix44& v) ++ IMATH_NOEXCEPT; + + /// Assignment operator +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& operator= (const Matrix44& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ operator= (const Matrix44& v) IMATH_NOEXCEPT; + + /// Assignment from scalar +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& operator= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ operator= (T a) IMATH_NOEXCEPT; + + /// Destructor +- ~Matrix44() IMATH_NOEXCEPT = default; ++ ~Matrix44 () IMATH_NOEXCEPT = default; + + /// @} + +@@ -752,23 +908,53 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// disabled by defining IMATH_FOREIGN_VECTOR_INTEROP to be 0 prior to + /// including any Imath header files. + /// +- template::value)> ++ template < ++ typename M, ++ IMATH_ENABLE_IF (has_double_subscript::value)> + IMATH_HOSTDEVICE explicit Matrix44 (const M& m) +- : Matrix44(T(m[0][0]), T(m[0][1]), T(m[0][2]), T(m[0][3]), +- T(m[1][0]), T(m[1][1]), T(m[1][2]), T(m[1][3]), +- T(m[2][0]), T(m[2][1]), T(m[2][2]), T(m[2][3]), +- T(m[3][0]), T(m[3][1]), T(m[3][2]), T(m[3][3])) +- { } ++ : Matrix44 ( ++ T (m[0][0]), ++ T (m[0][1]), ++ T (m[0][2]), ++ T (m[0][3]), ++ T (m[1][0]), ++ T (m[1][1]), ++ T (m[1][2]), ++ T (m[1][3]), ++ T (m[2][0]), ++ T (m[2][1]), ++ T (m[2][2]), ++ T (m[2][3]), ++ T (m[3][0]), ++ T (m[3][1]), ++ T (m[3][2]), ++ T (m[3][3])) ++ {} + + /// Interoperability assignment from another type that behaves as if it + /// were an equivalent matrix. +- template::value)> ++ template < ++ typename M, ++ IMATH_ENABLE_IF (has_double_subscript::value)> + IMATH_HOSTDEVICE const Matrix44& operator= (const M& m) + { +- *this = Matrix44(T(m[0][0]), T(m[0][1]), T(m[0][2]), T(m[0][3]), +- T(m[1][0]), T(m[1][1]), T(m[1][2]), T(m[1][3]), +- T(m[2][0]), T(m[2][1]), T(m[2][2]), T(m[2][3]), +- T(m[3][0]), T(m[3][1]), T(m[3][2]), T(m[3][3])); ++ *this = Matrix44 ( ++ T (m[0][0]), ++ T (m[0][1]), ++ T (m[0][2]), ++ T (m[0][3]), ++ T (m[1][0]), ++ T (m[1][1]), ++ T (m[1][2]), ++ T (m[1][3]), ++ T (m[2][0]), ++ T (m[2][1]), ++ T (m[2][2]), ++ T (m[2][3]), ++ T (m[3][0]), ++ T (m[3][1]), ++ T (m[3][2]), ++ T (m[3][3])); + return *this; + } + /// @} +@@ -778,110 +964,134 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// @name Compatibility with Sb + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE T* getValue() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T* getValue () IMATH_NOEXCEPT; + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE const T* getValue() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const T* getValue () const IMATH_NOEXCEPT; + + /// Return the value in `v` +- template IMATH_HOSTDEVICE void getValue (Matrix44& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void getValue (Matrix44& v) const IMATH_NOEXCEPT; + + /// Set the value +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44& setValue (const Matrix44& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44& ++ setValue (const Matrix44& v) IMATH_NOEXCEPT; + + /// Set the value + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44& setTheMatrix (const Matrix44& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44& ++ setTheMatrix (const Matrix44& v) IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Arithmetic and Comparison +- ++ + /// Equality +- IMATH_HOSTDEVICE constexpr bool operator== (const Matrix44& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Matrix44& v) const IMATH_NOEXCEPT; + + /// Inequality +- IMATH_HOSTDEVICE constexpr bool operator!= (const Matrix44& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Matrix44& v) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and `m` are the same + /// with an absolute error of no more than e, i.e., for all i, j: + /// + /// abs (this[i][j] - m[i][j]) <= e +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError (const Matrix44& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithAbsError (const Matrix44& v, T e) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and m are the same with + /// a relative error of no more than e, i.e., for all i, j: + /// + /// abs (this[i] - v[i][j]) <= e * abs (this[i][j]) +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError (const Matrix44& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithRelError (const Matrix44& v, T e) const IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& operator+= (const Matrix44& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ operator+= (const Matrix44& v) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& operator+= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ operator+= (T a) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE constexpr Matrix44 operator+ (const Matrix44& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix44 ++ operator+ (const Matrix44& v) const IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& operator-= (const Matrix44& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ operator-= (const Matrix44& v) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& operator-= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ operator-= (T a) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE constexpr Matrix44 operator- (const Matrix44& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix44 ++ operator- (const Matrix44& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE constexpr Matrix44 operator-() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix44 operator- () const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& negate() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& negate () IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& operator*= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ operator*= (T a) IMATH_NOEXCEPT; + + /// Component-wise multiplication + IMATH_HOSTDEVICE constexpr Matrix44 operator* (T a) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& operator/= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ operator/= (T a) IMATH_NOEXCEPT; + + /// Component-wise division + IMATH_HOSTDEVICE constexpr Matrix44 operator/ (T a) const IMATH_NOEXCEPT; + + /// Matrix-matrix multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& operator*= (const Matrix44& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ operator*= (const Matrix44& v) IMATH_NOEXCEPT; + + /// Matrix-matrix multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 operator* (const Matrix44& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 ++ operator* (const Matrix44& v) const IMATH_NOEXCEPT; + + /// Matrix-matrix multiplication: compute c = a * b + IMATH_HOSTDEVICE +- static void multiply (const Matrix44& a, // assumes that +- const Matrix44& b, // &a != &c and +- Matrix44& c) IMATH_NOEXCEPT; // &b != &c. ++ static void multiply ( ++ const Matrix44& a, // assumes that ++ const Matrix44& b, // &a != &c and ++ Matrix44& c) IMATH_NOEXCEPT; // &b != &c. + + /// Matrix-matrix multiplication returning a result. + IMATH_HOSTDEVICE +- static IMATH_CONSTEXPR14 Matrix44 multiply (const Matrix44& a, const Matrix44& b) IMATH_NOEXCEPT; ++ static IMATH_CONSTEXPR14 Matrix44 ++ multiply (const Matrix44& a, const Matrix44& b) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: a homogeneous transformation + /// by computing Vec3 (src.x, src.y, src.z, 1) * m and dividing by the + /// result's third element. + /// @param[in] src The input vector + /// @param[out] dst The output vector +- template IMATH_HOSTDEVICE void multVecMatrix (const Vec3& src, Vec3& dst) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void ++ multVecMatrix (const Vec3& src, Vec3& dst) const IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: multiply `src` by the upper left 2x2 + /// submatrix, ignoring the rest of matrix. + /// @param[in] src The input vector + /// @param[out] dst The output vector +- template IMATH_HOSTDEVICE void multDirMatrix (const Vec3& src, Vec3& dst) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void ++ multDirMatrix (const Vec3& src, Vec3& dst) const IMATH_NOEXCEPT; + + /// @} + +@@ -889,13 +1099,14 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// @name Maniplation + + /// Set to the identity matrix +- IMATH_HOSTDEVICE void makeIdentity() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void makeIdentity () IMATH_NOEXCEPT; + + /// Transpose +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& transpose() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ transpose () IMATH_NOEXCEPT; + + /// Return the transpose +- IMATH_HOSTDEVICE constexpr Matrix44 transposed() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix44 transposed () const IMATH_NOEXCEPT; + + /// Invert in place using the determinant. + /// @param singExc If true, throw an exception if the matrix cannot be inverted. +@@ -904,14 +1115,15 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + + /// Invert in place using the determinant. + /// @return const reference to this +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& invert() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& invert () IMATH_NOEXCEPT; + + /// Return the inverse using the determinant, leaving this unmodified. + /// @param singExc If true, throw an exception if the matrix cannot be inverted. + IMATH_CONSTEXPR14 Matrix44 inverse (bool singExc) const; + + /// Return the inverse using the determinant, leaving this unmodified. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 inverse() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Matrix44 ++ inverse () const IMATH_NOEXCEPT; + + /// Invert in place using the Gauss-Jordan method. Significantly slower + /// but more accurate than invert(). +@@ -922,7 +1134,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// Invert in place using the Gauss-Jordan method. Significantly slower + /// but more accurate than invert(). + /// @return const reference to this +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& gjInvert() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ gjInvert () IMATH_NOEXCEPT; + + /// Return the inverse using the Gauss-Jordan method, leaving this + /// unmodified. Significantly slower but more accurate than inverse(). +@@ -930,61 +1143,74 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + + /// Return the inverse using the Gauss-Jordan method, leaving this + /// unmodified Significantly slower but more accurate than inverse(). +- IMATH_HOSTDEVICE Matrix44 gjInverse() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Matrix44 gjInverse () const IMATH_NOEXCEPT; + + /// Calculate the matrix minor of the (r,c) element +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T minorOf (const int r, const int c) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T ++ minorOf (const int r, const int c) const IMATH_NOEXCEPT; + + /// Build a minor using the specified rows and columns + IMATH_HOSTDEVICE +- constexpr T fastMinor (const int r0, +- const int r1, +- const int r2, +- const int c0, +- const int c1, +- const int c2) const IMATH_NOEXCEPT; ++ constexpr T fastMinor ( ++ const int r0, ++ const int r1, ++ const int r2, ++ const int c0, ++ const int c1, ++ const int c2) const IMATH_NOEXCEPT; + + /// Determinant +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T determinant() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T determinant () const IMATH_NOEXCEPT; + + /// Set matrix to rotation by XYZ euler angles (in radians) + /// @return const referenced to this +- template IMATH_HOSTDEVICE const Matrix44& setEulerAngles (const Vec3& r) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE const Matrix44& ++ setEulerAngles (const Vec3& r) IMATH_NOEXCEPT; + + /// Set matrix to rotation around given axis by given angle (in radians) + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& setAxisAngle (const Vec3& ax, S ang) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ setAxisAngle (const Vec3& ax, S ang) IMATH_NOEXCEPT; + + /// Rotate the matrix by XYZ euler angles in r (in radians) + /// @return const referenced to this +- template IMATH_HOSTDEVICE const Matrix44& rotate (const Vec3& r) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE const Matrix44& rotate (const Vec3& r) IMATH_NOEXCEPT; + + /// Set matrix to scale by given uniform factor + /// @return const referenced to this +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& setScale (T s) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ setScale (T s) IMATH_NOEXCEPT; + + /// Set matrix to scale by given vector + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& setScale (const Vec3& s) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ setScale (const Vec3& s) IMATH_NOEXCEPT; + + /// Scale the matrix by s + /// @return const referenced to this +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& scale (const Vec3& s) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ scale (const Vec3& s) IMATH_NOEXCEPT; + + /// Set matrix to translation by given vector + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& setTranslation (const Vec3& t) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ setTranslation (const Vec3& t) IMATH_NOEXCEPT; + + /// Return translation component +- IMATH_HOSTDEVICE constexpr const Vec3 translation() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr const Vec3 ++ translation () const IMATH_NOEXCEPT; + + /// Translate the matrix by t + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& translate (const Vec3& t) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ translate (const Vec3& t) IMATH_NOEXCEPT; + + /// Set matrix to shear by given vector h. The resulting matrix + /// - will shear x for each y coord. by a factor of h[0] ; +@@ -992,7 +1218,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// - will shear y for each z coord. by a factor of h[2] . + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& setShear (const Vec3& h) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ setShear (const Vec3& h) IMATH_NOEXCEPT; + + /// Set matrix to shear by given factors. The resulting matrix + /// - will shear x for each y coord. by a factor of h.xy ; +@@ -1003,7 +1230,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// - will shear z for each y coord. by a factor of h.zy . + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& setShear (const Shear6& h) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ setShear (const Shear6& h) IMATH_NOEXCEPT; + + /// Shear the matrix by given vector. The composed matrix + /// will be `shear` * `this`, where the shear matrix ... +@@ -1011,7 +1239,9 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// - will shear x for each z coord. by a factor of h[1] ; + /// - will shear y for each z coord. by a factor of h[2] . + /// @return const referenced to this +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& shear (const Vec3& h) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ shear (const Vec3& h) IMATH_NOEXCEPT; + + /// Shear the matrix by the given factors. The composed matrix + /// will be `shear` * `this`, where the shear matrix ... +@@ -1023,29 +1253,45 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// - will shear z for each y coord. by a factor of h.zy . + /// @return const referenced to this + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& shear (const Shear6& h) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Matrix44& ++ shear (const Shear6& h) IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Numeric Limits +- ++ + /// Largest possible negative value +- IMATH_HOSTDEVICE constexpr static T baseTypeLowest() IMATH_NOEXCEPT { return std::numeric_limits::lowest(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeLowest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::lowest (); ++ } + + /// Largest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeMax() IMATH_NOEXCEPT { return std::numeric_limits::max(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeMax () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::max (); ++ } + + /// Smallest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeSmallest() IMATH_NOEXCEPT { return std::numeric_limits::min(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeSmallest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::min (); ++ } + + /// Smallest possible e for which 1+e != 1 +- IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon() IMATH_NOEXCEPT { return std::numeric_limits::epsilon(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::epsilon (); ++ } + + /// @} +- ++ + /// Return the number of the row and column dimensions, i.e. 4 +- IMATH_HOSTDEVICE constexpr static unsigned int dimensions() IMATH_NOEXCEPT { return 4; } ++ IMATH_HOSTDEVICE constexpr static unsigned int dimensions () IMATH_NOEXCEPT ++ { ++ return 4; ++ } + + /// The base type: In templates that accept a parameter `V` (could be a Color4), you can refer to `T` as `V::BaseType` + typedef T BaseType; +@@ -1057,13 +1303,15 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Matrix44 + /// Stream output, as: + /// (m00 m01 + /// m10 m11) +-template std::ostream& operator<< (std::ostream& s, const Matrix22& m); ++template ++std::ostream& operator<< (std::ostream& s, const Matrix22& m); + + /// Stream output, as: + /// (m00 m01 m02 + /// m10 m11 m12 + /// m20 m21 m22) +-template std::ostream& operator<< (std::ostream& s, const Matrix33& m); ++template ++std::ostream& operator<< (std::ostream& s, const Matrix33& m); + + /// Stream output, as: + /// +@@ -1071,7 +1319,8 @@ template std::ostream& operator<< (std::ostream& s, const Matrix33& + /// m10 m11 m12 m13 + /// m20 m21 m22 m23 + /// m30 m31 m32 m33) +-template std::ostream& operator<< (std::ostream& s, const Matrix44& m); ++template ++std::ostream& operator<< (std::ostream& s, const Matrix44& m); + + //--------------------------------------------- + // Vector-times-matrix multiplication operators +@@ -1079,43 +1328,53 @@ template std::ostream& operator<< (std::ostream& s, const Matrix44& + + /// Vector-matrix multiplication: v *= m + template +-IMATH_HOSTDEVICE inline const Vec2& operator*= (Vec2& v, const Matrix22& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline const Vec2& ++operator*= (Vec2& v, const Matrix22& m) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: r = v * m + template +-IMATH_HOSTDEVICE inline Vec2 operator* (const Vec2& v, const Matrix22& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline Vec2 ++operator* (const Vec2& v, const Matrix22& m) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: v *= m + template +-IMATH_HOSTDEVICE inline const Vec2& operator*= (Vec2& v, const Matrix33& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline const Vec2& ++operator*= (Vec2& v, const Matrix33& m) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: r = v * m + template +-IMATH_HOSTDEVICE inline Vec2 operator* (const Vec2& v, const Matrix33& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline Vec2 ++operator* (const Vec2& v, const Matrix33& m) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: v *= m + template +-IMATH_HOSTDEVICE inline const Vec3& operator*= (Vec3& v, const Matrix33& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline const Vec3& ++operator*= (Vec3& v, const Matrix33& m) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: r = v * m + template +-IMATH_HOSTDEVICE inline Vec3 operator* (const Vec3& v, const Matrix33& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline Vec3 ++operator* (const Vec3& v, const Matrix33& m) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: v *= m + template +-IMATH_HOSTDEVICE inline const Vec3& operator*= (Vec3& v, const Matrix44& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline const Vec3& ++operator*= (Vec3& v, const Matrix44& m) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: r = v * m + template +-IMATH_HOSTDEVICE inline Vec3 operator* (const Vec3& v, const Matrix44& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline Vec3 ++operator* (const Vec3& v, const Matrix44& m) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: v *= m + template +-IMATH_HOSTDEVICE inline const Vec4& operator*= (Vec4& v, const Matrix44& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline const Vec4& ++operator*= (Vec4& v, const Matrix44& m) IMATH_NOEXCEPT; + + /// Vector-matrix multiplication: r = v * m + template +-IMATH_HOSTDEVICE inline Vec4 operator* (const Vec4& v, const Matrix44& m) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE inline Vec4 ++operator* (const Vec4& v, const Matrix44& m) IMATH_NOEXCEPT; + + //------------------------- + // Typedefs for convenience +@@ -1157,7 +1416,9 @@ Matrix22::operator[] (int i) const IMATH_NOEXCEPT + return x[i]; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22() IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE ++ IMATH_CONSTEXPR14 inline Matrix22::Matrix22 () IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -1165,7 +1426,9 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix + x[1][1] = 1; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22 (T a) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE ++ IMATH_CONSTEXPR14 inline Matrix22::Matrix22 (T a) IMATH_NOEXCEPT + { + x[0][0] = a; + x[0][1] = a; +@@ -1173,7 +1436,9 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix + x[1][1] = a; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22 (const T a[2][2]) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22 ( ++ const T a[2][2]) IMATH_NOEXCEPT + { + // Function calls and aliasing issues can inhibit vectorization versus + // straight assignment of data members, so instead of this: +@@ -1185,7 +1450,9 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix + x[1][1] = a[1][1]; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22 (T a, T b, T c, T d) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22 ( ++ T a, T b, T c, T d) IMATH_NOEXCEPT + { + x[0][0] = a; + x[0][1] = b; +@@ -1193,7 +1460,9 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix + x[1][1] = d; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22 (const Matrix22& v) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22 ( ++ const Matrix22& v) IMATH_NOEXCEPT + { + // Function calls and aliasing issues can inhibit vectorization versus + // straight assignment of data members, so we don't do this: +@@ -1207,7 +1476,8 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix + + template + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22 (const Matrix22& v) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22::Matrix22 ( ++ const Matrix22& v) IMATH_NOEXCEPT + { + x[0][0] = T (v.x[0][0]); + x[0][1] = T (v.x[0][1]); +@@ -1243,14 +1513,14 @@ Matrix22::operator= (T a) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_HOSTDEVICE inline T* +-Matrix22::getValue() IMATH_NOEXCEPT ++Matrix22::getValue () IMATH_NOEXCEPT + { + return (T*) &x[0][0]; + } + + template + IMATH_HOSTDEVICE inline const T* +-Matrix22::getValue() const IMATH_NOEXCEPT ++Matrix22::getValue () const IMATH_NOEXCEPT + { + return (const T*) &x[0][0]; + } +@@ -1269,7 +1539,7 @@ Matrix22::getValue (Matrix22& v) const IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22& +-Matrix22::setValue (const Matrix22& v) IMATH_NOEXCEPT ++ Matrix22::setValue (const Matrix22& v) IMATH_NOEXCEPT + { + x[0][0] = v.x[0][0]; + x[0][1] = v.x[0][1]; +@@ -1281,7 +1551,7 @@ Matrix22::setValue (const Matrix22& v) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22& +-Matrix22::setTheMatrix (const Matrix22& v) IMATH_NOEXCEPT ++ Matrix22::setTheMatrix (const Matrix22& v) IMATH_NOEXCEPT + { + x[0][0] = v.x[0][0]; + x[0][1] = v.x[0][1]; +@@ -1292,7 +1562,7 @@ Matrix22::setTheMatrix (const Matrix22& v) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline void +-Matrix22::makeIdentity() IMATH_NOEXCEPT ++Matrix22::makeIdentity () IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -1304,16 +1574,16 @@ template + IMATH_HOSTDEVICE constexpr inline bool + Matrix22::operator== (const Matrix22& v) const IMATH_NOEXCEPT + { +- return x[0][0] == v.x[0][0] && x[0][1] == v.x[0][1] && x[1][0] == v.x[1][0] && +- x[1][1] == v.x[1][1]; ++ return x[0][0] == v.x[0][0] && x[0][1] == v.x[0][1] && ++ x[1][0] == v.x[1][0] && x[1][1] == v.x[1][1]; + } + + template + IMATH_HOSTDEVICE constexpr inline bool + Matrix22::operator!= (const Matrix22& v) const IMATH_NOEXCEPT + { +- return x[0][0] != v.x[0][0] || x[0][1] != v.x[0][1] || x[1][0] != v.x[1][0] || +- x[1][1] != v.x[1][1]; ++ return x[0][0] != v.x[0][0] || x[0][1] != v.x[0][1] || ++ x[1][0] != v.x[1][0] || x[1][1] != v.x[1][1]; + } + + template +@@ -1322,7 +1592,8 @@ Matrix22::equalWithAbsError (const Matrix22& m, T e) const IMATH_NOEXCEPT + { + for (int i = 0; i < 2; i++) + for (int j = 0; j < 2; j++) +- if (!IMATH_INTERNAL_NAMESPACE::equalWithAbsError ((*this).x[i][j], m.x[i][j], e)) ++ if (!IMATH_INTERNAL_NAMESPACE::equalWithAbsError ( ++ (*this).x[i][j], m.x[i][j], e)) + return false; + + return true; +@@ -1334,7 +1605,8 @@ Matrix22::equalWithRelError (const Matrix22& m, T e) const IMATH_NOEXCEPT + { + for (int i = 0; i < 2; i++) + for (int j = 0; j < 2; j++) +- if (!IMATH_INTERNAL_NAMESPACE::equalWithRelError ((*this).x[i][j], m.x[i][j], e)) ++ if (!IMATH_INTERNAL_NAMESPACE::equalWithRelError ( ++ (*this).x[i][j], m.x[i][j], e)) + return false; + + return true; +@@ -1368,10 +1640,11 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix22 + Matrix22::operator+ (const Matrix22& v) const IMATH_NOEXCEPT + { +- return Matrix22 (x[0][0] + v.x[0][0], +- x[0][1] + v.x[0][1], +- x[1][0] + v.x[1][0], +- x[1][1] + v.x[1][1]); ++ return Matrix22 ( ++ x[0][0] + v.x[0][0], ++ x[0][1] + v.x[0][1], ++ x[1][0] + v.x[1][0], ++ x[1][1] + v.x[1][1]); + } + + template +@@ -1402,22 +1675,23 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix22 + Matrix22::operator- (const Matrix22& v) const IMATH_NOEXCEPT + { +- return Matrix22 (x[0][0] - v.x[0][0], +- x[0][1] - v.x[0][1], +- x[1][0] - v.x[1][0], +- x[1][1] - v.x[1][1]); ++ return Matrix22 ( ++ x[0][0] - v.x[0][0], ++ x[0][1] - v.x[0][1], ++ x[1][0] - v.x[1][0], ++ x[1][1] - v.x[1][1]); + } + + template + IMATH_HOSTDEVICE constexpr inline Matrix22 +-Matrix22::operator-() const IMATH_NOEXCEPT ++Matrix22::operator- () const IMATH_NOEXCEPT + { + return Matrix22 (-x[0][0], -x[0][1], -x[1][0], -x[1][1]); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix22& +-Matrix22::negate() IMATH_NOEXCEPT ++ Matrix22::negate () IMATH_NOEXCEPT + { + x[0][0] = -x[0][0]; + x[0][1] = -x[0][1]; +@@ -1486,7 +1760,8 @@ Matrix22::operator* (const Matrix22& v) const IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE inline void +-Matrix22::multDirMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCEPT ++Matrix22::multDirMatrix (const Vec2& src, Vec2& dst) const ++ IMATH_NOEXCEPT + { + S a, b; + +@@ -1518,7 +1793,7 @@ Matrix22::operator/ (T a) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix22& +-Matrix22::transpose() IMATH_NOEXCEPT ++ Matrix22::transpose () IMATH_NOEXCEPT + { + Matrix22 tmp (x[0][0], x[1][0], x[0][1], x[1][1]); + *this = tmp; +@@ -1527,7 +1802,7 @@ Matrix22::transpose() IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline Matrix22 +-Matrix22::transposed() const IMATH_NOEXCEPT ++Matrix22::transposed () const IMATH_NOEXCEPT + { + return Matrix22 (x[0][0], x[1][0], x[0][1], x[1][1]); + } +@@ -1542,9 +1817,9 @@ Matrix22::invert (bool singExc) + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix22& +-Matrix22::invert() IMATH_NOEXCEPT ++ Matrix22::invert () IMATH_NOEXCEPT + { +- *this = inverse(); ++ *this = inverse (); + return *this; + } + +@@ -1568,7 +1843,8 @@ Matrix22::inverse (bool singExc) const + } + else + { +- T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min(); ++ T mr = ++ IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min (); + + for (int i = 0; i < 2; ++i) + { +@@ -1583,7 +1859,7 @@ Matrix22::inverse (bool singExc) const + if (singExc) + throw std::invalid_argument ("Cannot invert " + "singular matrix."); +- return Matrix22(); ++ return Matrix22 (); + } + } + } +@@ -1593,7 +1869,7 @@ Matrix22::inverse (bool singExc) const + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix22 +-Matrix22::inverse() const IMATH_NOEXCEPT ++ Matrix22::inverse () const IMATH_NOEXCEPT + { + Matrix22 s (x[1][1], -x[0][1], -x[1][0], x[0][0]); + +@@ -1611,7 +1887,8 @@ Matrix22::inverse() const IMATH_NOEXCEPT + } + else + { +- T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min(); ++ T mr = ++ IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min (); + + for (int i = 0; i < 2; ++i) + { +@@ -1623,7 +1900,7 @@ Matrix22::inverse() const IMATH_NOEXCEPT + } + else + { +- return Matrix22(); ++ return Matrix22 (); + } + } + } +@@ -1633,7 +1910,7 @@ Matrix22::inverse() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline T +-Matrix22::determinant() const IMATH_NOEXCEPT ++Matrix22::determinant () const IMATH_NOEXCEPT + { + return x[0][0] * x[1][1] - x[1][0] * x[0][1]; + } +@@ -1660,9 +1937,9 @@ Matrix22::setRotation (S r) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix22& +-Matrix22::rotate (S r) IMATH_NOEXCEPT ++ Matrix22::rotate (S r) IMATH_NOEXCEPT + { +- *this *= Matrix22().setRotation (r); ++ *this *= Matrix22 ().setRotation (r); + return *this; + } + +@@ -1687,7 +1964,7 @@ Matrix22::setScale (T s) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix22& +-Matrix22::setScale (const Vec2& s) IMATH_NOEXCEPT ++ Matrix22::setScale (const Vec2& s) IMATH_NOEXCEPT + { + // + // Set the matrix to: +@@ -1706,7 +1983,7 @@ Matrix22::setScale (const Vec2& s) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix22& +-Matrix22::scale (const Vec2& s) IMATH_NOEXCEPT ++ Matrix22::scale (const Vec2& s) IMATH_NOEXCEPT + { + x[0][0] *= s.x; + x[0][1] *= s.x; +@@ -1737,7 +2014,7 @@ Matrix33::operator[] (int i) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline IMATH_CONSTEXPR14 +-Matrix33::Matrix33() IMATH_NOEXCEPT ++Matrix33::Matrix33 () IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -1750,7 +2027,9 @@ Matrix33::Matrix33() IMATH_NOEXCEPT + x[2][2] = 1; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 (T a) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE ++ IMATH_CONSTEXPR14 inline Matrix33::Matrix33 (T a) IMATH_NOEXCEPT + { + x[0][0] = a; + x[0][1] = a; +@@ -1763,7 +2042,9 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix + x[2][2] = a; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 (const T a[3][3]) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 ( ++ const T a[3][3]) IMATH_NOEXCEPT + { + // Function calls and aliasing issues can inhibit vectorization versus + // straight assignment of data members, so instead of this: +@@ -1781,7 +2062,8 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 (T a, T b, T c, T d, T e, T f, T g, T h, T i) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 ( ++ T a, T b, T c, T d, T e, T f, T g, T h, T i) IMATH_NOEXCEPT + { + x[0][0] = a; + x[0][1] = b; +@@ -1795,7 +2077,8 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 (T a, T b, T c, + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 (const Matrix33& v) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 ( ++ const Matrix33& v) IMATH_NOEXCEPT + { + // Function calls and aliasing issues can inhibit vectorization versus + // straight assignment of data members, so instead of this: +@@ -1814,7 +2097,8 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 (const Matrix33& + + template + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 (const Matrix33& v) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33::Matrix33 ( ++ const Matrix33& v) IMATH_NOEXCEPT + { + x[0][0] = T (v.x[0][0]); + x[0][1] = T (v.x[0][1]); +@@ -1865,14 +2149,14 @@ Matrix33::operator= (T a) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_HOSTDEVICE inline T* +-Matrix33::getValue() IMATH_NOEXCEPT ++Matrix33::getValue () IMATH_NOEXCEPT + { + return (T*) &x[0][0]; + } + + template + IMATH_HOSTDEVICE inline const T* +-Matrix33::getValue() const IMATH_NOEXCEPT ++Matrix33::getValue () const IMATH_NOEXCEPT + { + return (const T*) &x[0][0]; + } +@@ -1896,7 +2180,7 @@ Matrix33::getValue (Matrix33& v) const IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33& +-Matrix33::setValue (const Matrix33& v) IMATH_NOEXCEPT ++ Matrix33::setValue (const Matrix33& v) IMATH_NOEXCEPT + { + x[0][0] = v.x[0][0]; + x[0][1] = v.x[0][1]; +@@ -1913,7 +2197,7 @@ Matrix33::setValue (const Matrix33& v) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33& +-Matrix33::setTheMatrix (const Matrix33& v) IMATH_NOEXCEPT ++ Matrix33::setTheMatrix (const Matrix33& v) IMATH_NOEXCEPT + { + x[0][0] = v.x[0][0]; + x[0][1] = v.x[0][1]; +@@ -1929,7 +2213,7 @@ Matrix33::setTheMatrix (const Matrix33& v) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline void +-Matrix33::makeIdentity() IMATH_NOEXCEPT ++Matrix33::makeIdentity () IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -1946,8 +2230,9 @@ template + IMATH_HOSTDEVICE constexpr inline bool + Matrix33::operator== (const Matrix33& v) const IMATH_NOEXCEPT + { +- return x[0][0] == v.x[0][0] && x[0][1] == v.x[0][1] && x[0][2] == v.x[0][2] && +- x[1][0] == v.x[1][0] && x[1][1] == v.x[1][1] && x[1][2] == v.x[1][2] && ++ return x[0][0] == v.x[0][0] && x[0][1] == v.x[0][1] && ++ x[0][2] == v.x[0][2] && x[1][0] == v.x[1][0] && ++ x[1][1] == v.x[1][1] && x[1][2] == v.x[1][2] && + x[2][0] == v.x[2][0] && x[2][1] == v.x[2][1] && x[2][2] == v.x[2][2]; + } + +@@ -1955,8 +2240,9 @@ template + IMATH_HOSTDEVICE constexpr inline bool + Matrix33::operator!= (const Matrix33& v) const IMATH_NOEXCEPT + { +- return x[0][0] != v.x[0][0] || x[0][1] != v.x[0][1] || x[0][2] != v.x[0][2] || +- x[1][0] != v.x[1][0] || x[1][1] != v.x[1][1] || x[1][2] != v.x[1][2] || ++ return x[0][0] != v.x[0][0] || x[0][1] != v.x[0][1] || ++ x[0][2] != v.x[0][2] || x[1][0] != v.x[1][0] || ++ x[1][1] != v.x[1][1] || x[1][2] != v.x[1][2] || + x[2][0] != v.x[2][0] || x[2][1] != v.x[2][1] || x[2][2] != v.x[2][2]; + } + +@@ -1966,7 +2252,8 @@ Matrix33::equalWithAbsError (const Matrix33& m, T e) const IMATH_NOEXCEPT + { + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) +- if (!IMATH_INTERNAL_NAMESPACE::equalWithAbsError ((*this)[i][j], m[i][j], e)) ++ if (!IMATH_INTERNAL_NAMESPACE::equalWithAbsError ( ++ (*this)[i][j], m[i][j], e)) + return false; + + return true; +@@ -1978,7 +2265,8 @@ Matrix33::equalWithRelError (const Matrix33& m, T e) const IMATH_NOEXCEPT + { + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) +- if (!IMATH_INTERNAL_NAMESPACE::equalWithRelError ((*this)[i][j], m[i][j], e)) ++ if (!IMATH_INTERNAL_NAMESPACE::equalWithRelError ( ++ (*this)[i][j], m[i][j], e)) + return false; + + return true; +@@ -2022,15 +2310,16 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix33 + Matrix33::operator+ (const Matrix33& v) const IMATH_NOEXCEPT + { +- return Matrix33 (x[0][0] + v.x[0][0], +- x[0][1] + v.x[0][1], +- x[0][2] + v.x[0][2], +- x[1][0] + v.x[1][0], +- x[1][1] + v.x[1][1], +- x[1][2] + v.x[1][2], +- x[2][0] + v.x[2][0], +- x[2][1] + v.x[2][1], +- x[2][2] + v.x[2][2]); ++ return Matrix33 ( ++ x[0][0] + v.x[0][0], ++ x[0][1] + v.x[0][1], ++ x[0][2] + v.x[0][2], ++ x[1][0] + v.x[1][0], ++ x[1][1] + v.x[1][1], ++ x[1][2] + v.x[1][2], ++ x[2][0] + v.x[2][0], ++ x[2][1] + v.x[2][1], ++ x[2][2] + v.x[2][2]); + } + + template +@@ -2071,35 +2360,37 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix33 + Matrix33::operator- (const Matrix33& v) const IMATH_NOEXCEPT + { +- return Matrix33 (x[0][0] - v.x[0][0], +- x[0][1] - v.x[0][1], +- x[0][2] - v.x[0][2], +- x[1][0] - v.x[1][0], +- x[1][1] - v.x[1][1], +- x[1][2] - v.x[1][2], +- x[2][0] - v.x[2][0], +- x[2][1] - v.x[2][1], +- x[2][2] - v.x[2][2]); ++ return Matrix33 ( ++ x[0][0] - v.x[0][0], ++ x[0][1] - v.x[0][1], ++ x[0][2] - v.x[0][2], ++ x[1][0] - v.x[1][0], ++ x[1][1] - v.x[1][1], ++ x[1][2] - v.x[1][2], ++ x[2][0] - v.x[2][0], ++ x[2][1] - v.x[2][1], ++ x[2][2] - v.x[2][2]); + } + + template + IMATH_HOSTDEVICE constexpr inline Matrix33 +-Matrix33::operator-() const IMATH_NOEXCEPT ++Matrix33::operator- () const IMATH_NOEXCEPT + { +- return Matrix33 (-x[0][0], +- -x[0][1], +- -x[0][2], +- -x[1][0], +- -x[1][1], +- -x[1][2], +- -x[2][0], +- -x[2][1], +- -x[2][2]); ++ return Matrix33 ( ++ -x[0][0], ++ -x[0][1], ++ -x[0][2], ++ -x[1][0], ++ -x[1][1], ++ -x[1][2], ++ -x[2][0], ++ -x[2][1], ++ -x[2][2]); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::negate() IMATH_NOEXCEPT ++ Matrix33::negate () IMATH_NOEXCEPT + { + x[0][0] = -x[0][0]; + x[0][1] = -x[0][1]; +@@ -2135,15 +2426,16 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix33 + Matrix33::operator* (T a) const IMATH_NOEXCEPT + { +- return Matrix33 (x[0][0] * a, +- x[0][1] * a, +- x[0][2] * a, +- x[1][0] * a, +- x[1][1] * a, +- x[1][2] * a, +- x[2][0] * a, +- x[2][1] * a, +- x[2][2] * a); ++ return Matrix33 ( ++ x[0][0] * a, ++ x[0][1] * a, ++ x[0][2] * a, ++ x[1][0] * a, ++ x[1][1] * a, ++ x[1][2] * a, ++ x[2][0] * a, ++ x[2][1] * a, ++ x[2][2] * a); + } + + /// Matrix-scalar multiplication +@@ -2160,19 +2452,28 @@ Matrix33::operator*= (const Matrix33& v) IMATH_NOEXCEPT + { + // Avoid initializing with 0 values before immediately overwriting them, + // and unroll all loops for the best autovectorization. +- Matrix33 tmp(IMATH_INTERNAL_NAMESPACE::UNINITIALIZED); +- +- tmp.x[0][0] = x[0][0] * v.x[0][0] + x[0][1] * v.x[1][0] + x[0][2] * v.x[2][0]; +- tmp.x[0][1] = x[0][0] * v.x[0][1] + x[0][1] * v.x[1][1] + x[0][2] * v.x[2][1]; +- tmp.x[0][2] = x[0][0] * v.x[0][2] + x[0][1] * v.x[1][2] + x[0][2] * v.x[2][2]; +- +- tmp.x[1][0] = x[1][0] * v.x[0][0] + x[1][1] * v.x[1][0] + x[1][2] * v.x[2][0]; +- tmp.x[1][1] = x[1][0] * v.x[0][1] + x[1][1] * v.x[1][1] + x[1][2] * v.x[2][1]; +- tmp.x[1][2] = x[1][0] * v.x[0][2] + x[1][1] * v.x[1][2] + x[1][2] * v.x[2][2]; +- +- tmp.x[2][0] = x[2][0] * v.x[0][0] + x[2][1] * v.x[1][0] + x[2][2] * v.x[2][0]; +- tmp.x[2][1] = x[2][0] * v.x[0][1] + x[2][1] * v.x[1][1] + x[2][2] * v.x[2][1]; +- tmp.x[2][2] = x[2][0] * v.x[0][2] + x[2][1] * v.x[1][2] + x[2][2] * v.x[2][2]; ++ Matrix33 tmp (IMATH_INTERNAL_NAMESPACE::UNINITIALIZED); ++ ++ tmp.x[0][0] = ++ x[0][0] * v.x[0][0] + x[0][1] * v.x[1][0] + x[0][2] * v.x[2][0]; ++ tmp.x[0][1] = ++ x[0][0] * v.x[0][1] + x[0][1] * v.x[1][1] + x[0][2] * v.x[2][1]; ++ tmp.x[0][2] = ++ x[0][0] * v.x[0][2] + x[0][1] * v.x[1][2] + x[0][2] * v.x[2][2]; ++ ++ tmp.x[1][0] = ++ x[1][0] * v.x[0][0] + x[1][1] * v.x[1][0] + x[1][2] * v.x[2][0]; ++ tmp.x[1][1] = ++ x[1][0] * v.x[0][1] + x[1][1] * v.x[1][1] + x[1][2] * v.x[2][1]; ++ tmp.x[1][2] = ++ x[1][0] * v.x[0][2] + x[1][1] * v.x[1][2] + x[1][2] * v.x[2][2]; ++ ++ tmp.x[2][0] = ++ x[2][0] * v.x[0][0] + x[2][1] * v.x[1][0] + x[2][2] * v.x[2][0]; ++ tmp.x[2][1] = ++ x[2][0] * v.x[0][1] + x[2][1] * v.x[1][1] + x[2][2] * v.x[2][1]; ++ tmp.x[2][2] = ++ x[2][0] * v.x[0][2] + x[2][1] * v.x[1][2] + x[2][2] * v.x[2][2]; + + *this = tmp; + return *this; +@@ -2184,19 +2485,28 @@ Matrix33::operator* (const Matrix33& v) const IMATH_NOEXCEPT + { + // Avoid initializing with 0 values before immediately overwriting them, + // and unroll all loops for the best autovectorization. +- Matrix33 tmp(IMATH_INTERNAL_NAMESPACE::UNINITIALIZED); +- +- tmp.x[0][0] = x[0][0] * v.x[0][0] + x[0][1] * v.x[1][0] + x[0][2] * v.x[2][0]; +- tmp.x[0][1] = x[0][0] * v.x[0][1] + x[0][1] * v.x[1][1] + x[0][2] * v.x[2][1]; +- tmp.x[0][2] = x[0][0] * v.x[0][2] + x[0][1] * v.x[1][2] + x[0][2] * v.x[2][2]; +- +- tmp.x[1][0] = x[1][0] * v.x[0][0] + x[1][1] * v.x[1][0] + x[1][2] * v.x[2][0]; +- tmp.x[1][1] = x[1][0] * v.x[0][1] + x[1][1] * v.x[1][1] + x[1][2] * v.x[2][1]; +- tmp.x[1][2] = x[1][0] * v.x[0][2] + x[1][1] * v.x[1][2] + x[1][2] * v.x[2][2]; +- +- tmp.x[2][0] = x[2][0] * v.x[0][0] + x[2][1] * v.x[1][0] + x[2][2] * v.x[2][0]; +- tmp.x[2][1] = x[2][0] * v.x[0][1] + x[2][1] * v.x[1][1] + x[2][2] * v.x[2][1]; +- tmp.x[2][2] = x[2][0] * v.x[0][2] + x[2][1] * v.x[1][2] + x[2][2] * v.x[2][2]; ++ Matrix33 tmp (IMATH_INTERNAL_NAMESPACE::UNINITIALIZED); ++ ++ tmp.x[0][0] = ++ x[0][0] * v.x[0][0] + x[0][1] * v.x[1][0] + x[0][2] * v.x[2][0]; ++ tmp.x[0][1] = ++ x[0][0] * v.x[0][1] + x[0][1] * v.x[1][1] + x[0][2] * v.x[2][1]; ++ tmp.x[0][2] = ++ x[0][0] * v.x[0][2] + x[0][1] * v.x[1][2] + x[0][2] * v.x[2][2]; ++ ++ tmp.x[1][0] = ++ x[1][0] * v.x[0][0] + x[1][1] * v.x[1][0] + x[1][2] * v.x[2][0]; ++ tmp.x[1][1] = ++ x[1][0] * v.x[0][1] + x[1][1] * v.x[1][1] + x[1][2] * v.x[2][1]; ++ tmp.x[1][2] = ++ x[1][0] * v.x[0][2] + x[1][1] * v.x[1][2] + x[1][2] * v.x[2][2]; ++ ++ tmp.x[2][0] = ++ x[2][0] * v.x[0][0] + x[2][1] * v.x[1][0] + x[2][2] * v.x[2][0]; ++ tmp.x[2][1] = ++ x[2][0] * v.x[0][1] + x[2][1] * v.x[1][1] + x[2][2] * v.x[2][1]; ++ tmp.x[2][2] = ++ x[2][0] * v.x[0][2] + x[2][1] * v.x[1][2] + x[2][2] * v.x[2][2]; + + return tmp; + } +@@ -2204,7 +2514,8 @@ Matrix33::operator* (const Matrix33& v) const IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE inline void +-Matrix33::multVecMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCEPT ++Matrix33::multVecMatrix (const Vec2& src, Vec2& dst) const ++ IMATH_NOEXCEPT + { + S a, b, w; + +@@ -2219,7 +2530,8 @@ Matrix33::multVecMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCE + template + template + IMATH_HOSTDEVICE inline void +-Matrix33::multDirMatrix (const Vec2& src, Vec2& dst) const IMATH_NOEXCEPT ++Matrix33::multDirMatrix (const Vec2& src, Vec2& dst) const ++ IMATH_NOEXCEPT + { + S a, b; + +@@ -2251,39 +2563,50 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix33 + Matrix33::operator/ (T a) const IMATH_NOEXCEPT + { +- return Matrix33 (x[0][0] / a, +- x[0][1] / a, +- x[0][2] / a, +- x[1][0] / a, +- x[1][1] / a, +- x[1][2] / a, +- x[2][0] / a, +- x[2][1] / a, +- x[2][2] / a); ++ return Matrix33 ( ++ x[0][0] / a, ++ x[0][1] / a, ++ x[0][2] / a, ++ x[1][0] / a, ++ x[1][1] / a, ++ x[1][2] / a, ++ x[2][0] / a, ++ x[2][1] / a, ++ x[2][2] / a); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::transpose() IMATH_NOEXCEPT +-{ +- Matrix33 tmp (x[0][0], x[1][0], x[2][0], x[0][1], x[1][1], x[2][1], x[0][2], x[1][2], x[2][2]); ++ Matrix33::transpose () IMATH_NOEXCEPT ++{ ++ Matrix33 tmp ( ++ x[0][0], ++ x[1][0], ++ x[2][0], ++ x[0][1], ++ x[1][1], ++ x[2][1], ++ x[0][2], ++ x[1][2], ++ x[2][2]); + *this = tmp; + return *this; + } + + template + IMATH_HOSTDEVICE constexpr inline Matrix33 +-Matrix33::transposed() const IMATH_NOEXCEPT ++Matrix33::transposed () const IMATH_NOEXCEPT + { +- return Matrix33 (x[0][0], +- x[1][0], +- x[2][0], +- x[0][1], +- x[1][1], +- x[2][1], +- x[0][2], +- x[1][2], +- x[2][2]); ++ return Matrix33 ( ++ x[0][0], ++ x[1][0], ++ x[2][0], ++ x[0][1], ++ x[1][1], ++ x[2][1], ++ x[0][2], ++ x[1][2], ++ x[2][2]); + } + + template +@@ -2296,9 +2619,9 @@ Matrix33::gjInvert (bool singExc) + + template + IMATH_HOSTDEVICE const inline Matrix33& +-Matrix33::gjInvert() IMATH_NOEXCEPT ++Matrix33::gjInvert () IMATH_NOEXCEPT + { +- *this = gjInverse(); ++ *this = gjInverse (); + return *this; + } + +@@ -2306,7 +2629,7 @@ template + inline Matrix33 + Matrix33::gjInverse (bool singExc) const + { +- int i, j, k; ++ int i, j, k; + Matrix33 s; + Matrix33 t (*this); + +@@ -2318,15 +2641,13 @@ Matrix33::gjInverse (bool singExc) const + + T pivotsize = t.x[i][i]; + +- if (pivotsize < 0) +- pivotsize = -pivotsize; ++ if (pivotsize < 0) pivotsize = -pivotsize; + + for (j = i + 1; j < 3; j++) + { + T tmp = t.x[j][i]; + +- if (tmp < 0) +- tmp = -tmp; ++ if (tmp < 0) tmp = -tmp; + + if (tmp > pivotsize) + { +@@ -2340,7 +2661,7 @@ Matrix33::gjInverse (bool singExc) const + if (singExc) + throw std::invalid_argument ("Cannot invert singular matrix."); + +- return Matrix33(); ++ return Matrix33 (); + } + + if (pivot != i) +@@ -2382,7 +2703,7 @@ Matrix33::gjInverse (bool singExc) const + if (singExc) + throw std::invalid_argument ("Cannot invert singular matrix."); + +- return Matrix33(); ++ return Matrix33 (); + } + + for (j = 0; j < 3; j++) +@@ -2408,9 +2729,9 @@ Matrix33::gjInverse (bool singExc) const + + template + IMATH_HOSTDEVICE inline Matrix33 +-Matrix33::gjInverse() const IMATH_NOEXCEPT ++Matrix33::gjInverse () const IMATH_NOEXCEPT + { +- int i, j, k; ++ int i, j, k; + Matrix33 s; + Matrix33 t (*this); + +@@ -2422,15 +2743,13 @@ Matrix33::gjInverse() const IMATH_NOEXCEPT + + T pivotsize = t.x[i][i]; + +- if (pivotsize < 0) +- pivotsize = -pivotsize; ++ if (pivotsize < 0) pivotsize = -pivotsize; + + for (j = i + 1; j < 3; j++) + { + T tmp = t.x[j][i]; + +- if (tmp < 0) +- tmp = -tmp; ++ if (tmp < 0) tmp = -tmp; + + if (tmp > pivotsize) + { +@@ -2439,10 +2758,7 @@ Matrix33::gjInverse() const IMATH_NOEXCEPT + } + } + +- if (pivotsize == 0) +- { +- return Matrix33(); +- } ++ if (pivotsize == 0) { return Matrix33 (); } + + if (pivot != i) + { +@@ -2478,10 +2794,7 @@ Matrix33::gjInverse() const IMATH_NOEXCEPT + { + T f; + +- if ((f = t.x[i][i]) == 0) +- { +- return Matrix33(); +- } ++ if ((f = t.x[i][i]) == 0) { return Matrix33 (); } + + for (j = 0; j < 3; j++) + { +@@ -2514,9 +2827,9 @@ Matrix33::invert (bool singExc) + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::invert() IMATH_NOEXCEPT ++ Matrix33::invert () IMATH_NOEXCEPT + { +- *this = inverse(); ++ *this = inverse (); + return *this; + } + +@@ -2526,17 +2839,18 @@ Matrix33::inverse (bool singExc) const + { + if (x[0][2] != 0 || x[1][2] != 0 || x[2][2] != 1) + { +- Matrix33 s (x[1][1] * x[2][2] - x[2][1] * x[1][2], +- x[2][1] * x[0][2] - x[0][1] * x[2][2], +- x[0][1] * x[1][2] - x[1][1] * x[0][2], ++ Matrix33 s ( ++ x[1][1] * x[2][2] - x[2][1] * x[1][2], ++ x[2][1] * x[0][2] - x[0][1] * x[2][2], ++ x[0][1] * x[1][2] - x[1][1] * x[0][2], + +- x[2][0] * x[1][2] - x[1][0] * x[2][2], +- x[0][0] * x[2][2] - x[2][0] * x[0][2], +- x[1][0] * x[0][2] - x[0][0] * x[1][2], ++ x[2][0] * x[1][2] - x[1][0] * x[2][2], ++ x[0][0] * x[2][2] - x[2][0] * x[0][2], ++ x[1][0] * x[0][2] - x[0][0] * x[1][2], + +- x[1][0] * x[2][1] - x[2][0] * x[1][1], +- x[2][0] * x[0][1] - x[0][0] * x[2][1], +- x[0][0] * x[1][1] - x[1][0] * x[0][1]); ++ x[1][0] * x[2][1] - x[2][0] * x[1][1], ++ x[2][0] * x[0][1] - x[0][0] * x[2][1], ++ x[0][0] * x[1][1] - x[1][0] * x[0][1]); + + T r = x[0][0] * s[0][0] + x[0][1] * s[1][0] + x[0][2] * s[2][0]; + +@@ -2552,7 +2866,8 @@ Matrix33::inverse (bool singExc) const + } + else + { +- T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min(); ++ T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / ++ std::numeric_limits::min (); + + for (int i = 0; i < 3; ++i) + { +@@ -2567,7 +2882,7 @@ Matrix33::inverse (bool singExc) const + if (singExc) + throw std::invalid_argument ("Cannot invert " + "singular matrix."); +- return Matrix33(); ++ return Matrix33 (); + } + } + } +@@ -2577,17 +2892,18 @@ Matrix33::inverse (bool singExc) const + } + else + { +- Matrix33 s (x[1][1], +- -x[0][1], +- 0, ++ Matrix33 s ( ++ x[1][1], ++ -x[0][1], ++ 0, + +- -x[1][0], +- x[0][0], +- 0, ++ -x[1][0], ++ x[0][0], ++ 0, + +- 0, +- 0, +- 1); ++ 0, ++ 0, ++ 1); + + T r = x[0][0] * x[1][1] - x[1][0] * x[0][1]; + +@@ -2603,7 +2919,8 @@ Matrix33::inverse (bool singExc) const + } + else + { +- T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min(); ++ T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / ++ std::numeric_limits::min (); + + for (int i = 0; i < 2; ++i) + { +@@ -2618,7 +2935,7 @@ Matrix33::inverse (bool singExc) const + if (singExc) + throw std::invalid_argument ("Cannot invert " + "singular matrix."); +- return Matrix33(); ++ return Matrix33 (); + } + } + } +@@ -2633,21 +2950,22 @@ Matrix33::inverse (bool singExc) const + + template + IMATH_HOSTDEVICE IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix33 +-Matrix33::inverse() const IMATH_NOEXCEPT ++ Matrix33::inverse () const IMATH_NOEXCEPT + { + if (x[0][2] != 0 || x[1][2] != 0 || x[2][2] != 1) + { +- Matrix33 s (x[1][1] * x[2][2] - x[2][1] * x[1][2], +- x[2][1] * x[0][2] - x[0][1] * x[2][2], +- x[0][1] * x[1][2] - x[1][1] * x[0][2], ++ Matrix33 s ( ++ x[1][1] * x[2][2] - x[2][1] * x[1][2], ++ x[2][1] * x[0][2] - x[0][1] * x[2][2], ++ x[0][1] * x[1][2] - x[1][1] * x[0][2], + +- x[2][0] * x[1][2] - x[1][0] * x[2][2], +- x[0][0] * x[2][2] - x[2][0] * x[0][2], +- x[1][0] * x[0][2] - x[0][0] * x[1][2], ++ x[2][0] * x[1][2] - x[1][0] * x[2][2], ++ x[0][0] * x[2][2] - x[2][0] * x[0][2], ++ x[1][0] * x[0][2] - x[0][0] * x[1][2], + +- x[1][0] * x[2][1] - x[2][0] * x[1][1], +- x[2][0] * x[0][1] - x[0][0] * x[2][1], +- x[0][0] * x[1][1] - x[1][0] * x[0][1]); ++ x[1][0] * x[2][1] - x[2][0] * x[1][1], ++ x[2][0] * x[0][1] - x[0][0] * x[2][1], ++ x[0][0] * x[1][1] - x[1][0] * x[0][1]); + + T r = x[0][0] * s.x[0][0] + x[0][1] * s.x[1][0] + x[0][2] * s.x[2][0]; + +@@ -2663,7 +2981,8 @@ Matrix33::inverse() const IMATH_NOEXCEPT + } + else + { +- T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min(); ++ T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / ++ std::numeric_limits::min (); + + for (int i = 0; i < 3; ++i) + { +@@ -2675,7 +2994,7 @@ Matrix33::inverse() const IMATH_NOEXCEPT + } + else + { +- return Matrix33(); ++ return Matrix33 (); + } + } + } +@@ -2685,17 +3004,18 @@ Matrix33::inverse() const IMATH_NOEXCEPT + } + else + { +- Matrix33 s (x[1][1], +- -x[0][1], +- 0, ++ Matrix33 s ( ++ x[1][1], ++ -x[0][1], ++ 0, + +- -x[1][0], +- x[0][0], +- 0, ++ -x[1][0], ++ x[0][0], ++ 0, + +- 0, +- 0, +- 1); ++ 0, ++ 0, ++ 1); + + T r = x[0][0] * x[1][1] - x[1][0] * x[0][1]; + +@@ -2711,7 +3031,8 @@ Matrix33::inverse() const IMATH_NOEXCEPT + } + else + { +- T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min(); ++ T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / ++ std::numeric_limits::min (); + + for (int i = 0; i < 2; ++i) + { +@@ -2723,7 +3044,7 @@ Matrix33::inverse() const IMATH_NOEXCEPT + } + else + { +- return Matrix33(); ++ return Matrix33 (); + } + } + } +@@ -2750,14 +3071,15 @@ Matrix33::minorOf (const int r, const int c) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline T +-Matrix33::fastMinor (const int r0, const int r1, const int c0, const int c1) const IMATH_NOEXCEPT ++Matrix33::fastMinor ( ++ const int r0, const int r1, const int c0, const int c1) const IMATH_NOEXCEPT + { + return x[r0][c0] * x[r1][c1] - x[r0][c1] * x[r1][c0]; + } + + template + IMATH_HOSTDEVICE constexpr inline T +-Matrix33::determinant() const IMATH_NOEXCEPT ++Matrix33::determinant () const IMATH_NOEXCEPT + { + return x[0][0] * (x[1][1] * x[2][2] - x[1][2] * x[2][1]) + + x[0][1] * (x[1][2] * x[2][0] - x[1][0] * x[2][2]) + +@@ -2792,15 +3114,15 @@ Matrix33::setRotation (S r) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::rotate (S r) IMATH_NOEXCEPT ++ Matrix33::rotate (S r) IMATH_NOEXCEPT + { +- *this *= Matrix33().setRotation (r); ++ *this *= Matrix33 ().setRotation (r); + return *this; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::setScale (T s) IMATH_NOEXCEPT ++ Matrix33::setScale (T s) IMATH_NOEXCEPT + { + // + // Set the matrix to a 2D homogeneous transform scale: +@@ -2824,7 +3146,7 @@ Matrix33::setScale (T s) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::setScale (const Vec2& s) IMATH_NOEXCEPT ++ Matrix33::setScale (const Vec2& s) IMATH_NOEXCEPT + { + // + // Set the matrix to a 2D homogeneous transform scale: +@@ -2848,7 +3170,7 @@ Matrix33::setScale (const Vec2& s) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::scale (const Vec2& s) IMATH_NOEXCEPT ++ Matrix33::scale (const Vec2& s) IMATH_NOEXCEPT + { + x[0][0] *= s.x; + x[0][1] *= s.x; +@@ -2864,7 +3186,7 @@ Matrix33::scale (const Vec2& s) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::setTranslation (const Vec2& t) IMATH_NOEXCEPT ++ Matrix33::setTranslation (const Vec2& t) IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -2883,7 +3205,7 @@ Matrix33::setTranslation (const Vec2& t) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline Vec2 +-Matrix33::translation() const IMATH_NOEXCEPT ++Matrix33::translation () const IMATH_NOEXCEPT + { + return Vec2 (x[2][0], x[2][1]); + } +@@ -2891,7 +3213,7 @@ Matrix33::translation() const IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::translate (const Vec2& t) IMATH_NOEXCEPT ++ Matrix33::translate (const Vec2& t) IMATH_NOEXCEPT + { + x[2][0] += t.x * x[0][0] + t.y * x[1][0]; + x[2][1] += t.x * x[0][1] + t.y * x[1][1]; +@@ -2903,7 +3225,7 @@ Matrix33::translate (const Vec2& t) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::setShear (const S& xy) IMATH_NOEXCEPT ++ Matrix33::setShear (const S& xy) IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -2923,7 +3245,7 @@ Matrix33::setShear (const S& xy) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::setShear (const Vec2& h) IMATH_NOEXCEPT ++ Matrix33::setShear (const Vec2& h) IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = h.y; +@@ -2943,7 +3265,7 @@ Matrix33::setShear (const Vec2& h) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::shear (const S& xy) IMATH_NOEXCEPT ++ Matrix33::shear (const S& xy) IMATH_NOEXCEPT + { + // + // In this case, we don't need a temp. copy of the matrix +@@ -2961,7 +3283,7 @@ Matrix33::shear (const S& xy) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix33& +-Matrix33::shear (const Vec2& h) IMATH_NOEXCEPT ++ Matrix33::shear (const Vec2& h) IMATH_NOEXCEPT + { + Matrix33 P (*this); + +@@ -2994,7 +3316,9 @@ Matrix44::operator[] (int i) const IMATH_NOEXCEPT + return x[i]; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44() IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE ++ IMATH_CONSTEXPR14 inline Matrix44::Matrix44 () IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -3014,7 +3338,9 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix + x[3][3] = 1; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 (T a) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE ++ IMATH_CONSTEXPR14 inline Matrix44::Matrix44 (T a) IMATH_NOEXCEPT + { + x[0][0] = a; + x[0][1] = a; +@@ -3034,7 +3360,9 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix + x[3][3] = a; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 (const T a[4][4]) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 ( ++ const T a[4][4]) IMATH_NOEXCEPT + { + x[0][0] = a[0][0]; + x[0][1] = a[0][1]; +@@ -3055,8 +3383,23 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44< +- T>::Matrix44 (T a, T b, T c, T d, T e, T f, T g, T h, T i, T j, T k, T l, T m, T n, T o, T p) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 ( ++ T a, ++ T b, ++ T c, ++ T d, ++ T e, ++ T f, ++ T g, ++ T h, ++ T i, ++ T j, ++ T k, ++ T l, ++ T m, ++ T n, ++ T o, ++ T p) IMATH_NOEXCEPT + { + x[0][0] = a; + x[0][1] = b; +@@ -3076,7 +3419,9 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44< + x[3][3] = p; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 (Matrix33 r, Vec3 t) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 ( ++ Matrix33 r, Vec3 t) IMATH_NOEXCEPT + { + x[0][0] = r.x[0][0]; + x[0][1] = r.x[0][1]; +@@ -3096,7 +3441,9 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix + x[3][3] = 1; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 (const Matrix44& v) IMATH_NOEXCEPT ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 ( ++ const Matrix44& v) IMATH_NOEXCEPT + { + x[0][0] = v.x[0][0]; + x[0][1] = v.x[0][1]; +@@ -3118,7 +3465,8 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix + + template + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 (const Matrix44& v) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44::Matrix44 ( ++ const Matrix44& v) IMATH_NOEXCEPT + { + x[0][0] = T (v.x[0][0]); + x[0][1] = T (v.x[0][1]); +@@ -3186,14 +3534,14 @@ Matrix44::operator= (T a) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_HOSTDEVICE inline T* +-Matrix44::getValue() IMATH_NOEXCEPT ++Matrix44::getValue () IMATH_NOEXCEPT + { + return (T*) &x[0][0]; + } + + template + IMATH_HOSTDEVICE inline const T* +-Matrix44::getValue() const IMATH_NOEXCEPT ++Matrix44::getValue () const IMATH_NOEXCEPT + { + return (const T*) &x[0][0]; + } +@@ -3224,7 +3572,7 @@ Matrix44::getValue (Matrix44& v) const IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44& +-Matrix44::setValue (const Matrix44& v) IMATH_NOEXCEPT ++ Matrix44::setValue (const Matrix44& v) IMATH_NOEXCEPT + { + x[0][0] = v.x[0][0]; + x[0][1] = v.x[0][1]; +@@ -3248,7 +3596,7 @@ Matrix44::setValue (const Matrix44& v) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44& +-Matrix44::setTheMatrix (const Matrix44& v) IMATH_NOEXCEPT ++ Matrix44::setTheMatrix (const Matrix44& v) IMATH_NOEXCEPT + { + x[0][0] = v.x[0][0]; + x[0][1] = v.x[0][1]; +@@ -3271,7 +3619,7 @@ Matrix44::setTheMatrix (const Matrix44& v) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline void +-Matrix44::makeIdentity() IMATH_NOEXCEPT ++Matrix44::makeIdentity () IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -3295,24 +3643,28 @@ template + IMATH_HOSTDEVICE constexpr inline bool + Matrix44::operator== (const Matrix44& v) const IMATH_NOEXCEPT + { +- return 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]; ++ return 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]; + } + + template + IMATH_HOSTDEVICE constexpr inline bool + Matrix44::operator!= (const Matrix44& v) const IMATH_NOEXCEPT + { +- return 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]; ++ return 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]; + } + + template +@@ -3321,7 +3673,8 @@ Matrix44::equalWithAbsError (const Matrix44& m, T e) const IMATH_NOEXCEPT + { + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) +- if (!IMATH_INTERNAL_NAMESPACE::equalWithAbsError ((*this).x[i][j], m.x[i][j], e)) ++ if (!IMATH_INTERNAL_NAMESPACE::equalWithAbsError ( ++ (*this).x[i][j], m.x[i][j], e)) + return false; + + return true; +@@ -3333,7 +3686,8 @@ Matrix44::equalWithRelError (const Matrix44& m, T e) const IMATH_NOEXCEPT + { + for (int i = 0; i < 4; i++) + for (int j = 0; j < 4; j++) +- if (!IMATH_INTERNAL_NAMESPACE::equalWithRelError ((*this).x[i][j], m.x[i][j], e)) ++ if (!IMATH_INTERNAL_NAMESPACE::equalWithRelError ( ++ (*this).x[i][j], m.x[i][j], e)) + return false; + + return true; +@@ -3391,22 +3745,23 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix44 + Matrix44::operator+ (const Matrix44& v) const IMATH_NOEXCEPT + { +- return Matrix44 (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]); ++ return Matrix44 ( ++ 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]); + } + + template +@@ -3461,49 +3816,51 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix44 + Matrix44::operator- (const Matrix44& v) const IMATH_NOEXCEPT + { +- return Matrix44 (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]); ++ return Matrix44 ( ++ 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]); + } + + template + IMATH_HOSTDEVICE constexpr inline Matrix44 +-Matrix44::operator-() const IMATH_NOEXCEPT +-{ +- return Matrix44 (-x[0][0], +- -x[0][1], +- -x[0][2], +- -x[0][3], +- -x[1][0], +- -x[1][1], +- -x[1][2], +- -x[1][3], +- -x[2][0], +- -x[2][1], +- -x[2][2], +- -x[2][3], +- -x[3][0], +- -x[3][1], +- -x[3][2], +- -x[3][3]); ++Matrix44::operator- () const IMATH_NOEXCEPT ++{ ++ return Matrix44 ( ++ -x[0][0], ++ -x[0][1], ++ -x[0][2], ++ -x[0][3], ++ -x[1][0], ++ -x[1][1], ++ -x[1][2], ++ -x[1][3], ++ -x[2][0], ++ -x[2][1], ++ -x[2][2], ++ -x[2][3], ++ -x[3][0], ++ -x[3][1], ++ -x[3][2], ++ -x[3][3]); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::negate() IMATH_NOEXCEPT ++ Matrix44::negate () IMATH_NOEXCEPT + { + x[0][0] = -x[0][0]; + x[0][1] = -x[0][1]; +@@ -3553,22 +3910,23 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix44 + Matrix44::operator* (T a) const IMATH_NOEXCEPT + { +- return Matrix44 (x[0][0] * a, +- x[0][1] * a, +- x[0][2] * a, +- x[0][3] * a, +- x[1][0] * a, +- x[1][1] * a, +- x[1][2] * a, +- x[1][3] * a, +- x[2][0] * a, +- x[2][1] * a, +- x[2][2] * a, +- x[2][3] * a, +- x[3][0] * a, +- x[3][1] * a, +- x[3][2] * a, +- x[3][3] * a); ++ return Matrix44 ( ++ x[0][0] * a, ++ x[0][1] * a, ++ x[0][2] * a, ++ x[0][3] * a, ++ x[1][0] * a, ++ x[1][1] * a, ++ x[1][2] * a, ++ x[1][3] * a, ++ x[2][0] * a, ++ x[2][1] * a, ++ x[2][2] * a, ++ x[2][3] * a, ++ x[3][0] * a, ++ x[3][1] * a, ++ x[3][2] * a, ++ x[3][3] * a); + } + + /// Matrix-scalar multiplication +@@ -3579,62 +3937,89 @@ operator* (T a, const Matrix44& v) IMATH_NOEXCEPT + return v * a; + } + +- + template + IMATH_HOSTDEVICE inline IMATH_CONSTEXPR14 Matrix44 +-Matrix44::multiply (const Matrix44 &a, const Matrix44 &b) IMATH_NOEXCEPT ++Matrix44::multiply (const Matrix44& a, const Matrix44& b) IMATH_NOEXCEPT + { + const auto a00 = a.x[0][0]; + const auto a01 = a.x[0][1]; + const auto a02 = a.x[0][2]; + const auto a03 = a.x[0][3]; + +- const auto c00 = a00 * b.x[0][0] + a01 * b.x[1][0] + a02 * b.x[2][0] + a03 * b.x[3][0]; +- const auto c01 = a00 * b.x[0][1] + a01 * b.x[1][1] + a02 * b.x[2][1] + a03 * b.x[3][1]; +- const auto c02 = a00 * b.x[0][2] + a01 * b.x[1][2] + a02 * b.x[2][2] + a03 * b.x[3][2]; +- const auto c03 = a00 * b.x[0][3] + a01 * b.x[1][3] + a02 * b.x[2][3] + a03 * b.x[3][3]; ++ const auto c00 = ++ a00 * b.x[0][0] + a01 * b.x[1][0] + a02 * b.x[2][0] + a03 * b.x[3][0]; ++ const auto c01 = ++ a00 * b.x[0][1] + a01 * b.x[1][1] + a02 * b.x[2][1] + a03 * b.x[3][1]; ++ const auto c02 = ++ a00 * b.x[0][2] + a01 * b.x[1][2] + a02 * b.x[2][2] + a03 * b.x[3][2]; ++ const auto c03 = ++ a00 * b.x[0][3] + a01 * b.x[1][3] + a02 * b.x[2][3] + a03 * b.x[3][3]; + + const auto a10 = a.x[1][0]; + const auto a11 = a.x[1][1]; + const auto a12 = a.x[1][2]; + const auto a13 = a.x[1][3]; + +- const auto c10 = a10 * b.x[0][0] + a11 * b.x[1][0] + a12 * b.x[2][0] + a13 * b.x[3][0]; +- const auto c11 = a10 * b.x[0][1] + a11 * b.x[1][1] + a12 * b.x[2][1] + a13 * b.x[3][1]; +- const auto c12 = a10 * b.x[0][2] + a11 * b.x[1][2] + a12 * b.x[2][2] + a13 * b.x[3][2]; +- const auto c13 = a10 * b.x[0][3] + a11 * b.x[1][3] + a12 * b.x[2][3] + a13 * b.x[3][3]; ++ const auto c10 = ++ a10 * b.x[0][0] + a11 * b.x[1][0] + a12 * b.x[2][0] + a13 * b.x[3][0]; ++ const auto c11 = ++ a10 * b.x[0][1] + a11 * b.x[1][1] + a12 * b.x[2][1] + a13 * b.x[3][1]; ++ const auto c12 = ++ a10 * b.x[0][2] + a11 * b.x[1][2] + a12 * b.x[2][2] + a13 * b.x[3][2]; ++ const auto c13 = ++ a10 * b.x[0][3] + a11 * b.x[1][3] + a12 * b.x[2][3] + a13 * b.x[3][3]; + + const auto a20 = a.x[2][0]; + const auto a21 = a.x[2][1]; + const auto a22 = a.x[2][2]; + const auto a23 = a.x[2][3]; + +- const auto c20 = a20 * b.x[0][0] + a21 * b.x[1][0] + a22 * b.x[2][0] + a23 * b.x[3][0]; +- const auto c21 = a20 * b.x[0][1] + a21 * b.x[1][1] + a22 * b.x[2][1] + a23 * b.x[3][1]; +- const auto c22 = a20 * b.x[0][2] + a21 * b.x[1][2] + a22 * b.x[2][2] + a23 * b.x[3][2]; +- const auto c23 = a20 * b.x[0][3] + a21 * b.x[1][3] + a22 * b.x[2][3] + a23 * b.x[3][3]; ++ const auto c20 = ++ a20 * b.x[0][0] + a21 * b.x[1][0] + a22 * b.x[2][0] + a23 * b.x[3][0]; ++ const auto c21 = ++ a20 * b.x[0][1] + a21 * b.x[1][1] + a22 * b.x[2][1] + a23 * b.x[3][1]; ++ const auto c22 = ++ a20 * b.x[0][2] + a21 * b.x[1][2] + a22 * b.x[2][2] + a23 * b.x[3][2]; ++ const auto c23 = ++ a20 * b.x[0][3] + a21 * b.x[1][3] + a22 * b.x[2][3] + a23 * b.x[3][3]; + + const auto a30 = a.x[3][0]; + const auto a31 = a.x[3][1]; + const auto a32 = a.x[3][2]; + const auto a33 = a.x[3][3]; + +- const auto c30 = a30 * b.x[0][0] + a31 * b.x[1][0] + a32 * b.x[2][0] + a33 * b.x[3][0]; +- const auto c31 = a30 * b.x[0][1] + a31 * b.x[1][1] + a32 * b.x[2][1] + a33 * b.x[3][1]; +- const auto c32 = a30 * b.x[0][2] + a31 * b.x[1][2] + a32 * b.x[2][2] + a33 * b.x[3][2]; +- const auto c33 = a30 * b.x[0][3] + a31 * b.x[1][3] + a32 * b.x[2][3] + a33 * b.x[3][3]; +- return Matrix44(c00, c01, c02, c03, +- c10, c11, c12, c13, +- c20, c21, c22, c23, +- c30, c31, c32, c33); ++ const auto c30 = ++ a30 * b.x[0][0] + a31 * b.x[1][0] + a32 * b.x[2][0] + a33 * b.x[3][0]; ++ const auto c31 = ++ a30 * b.x[0][1] + a31 * b.x[1][1] + a32 * b.x[2][1] + a33 * b.x[3][1]; ++ const auto c32 = ++ a30 * b.x[0][2] + a31 * b.x[1][2] + a32 * b.x[2][2] + a33 * b.x[3][2]; ++ const auto c33 = ++ a30 * b.x[0][3] + a31 * b.x[1][3] + a32 * b.x[2][3] + a33 * b.x[3][3]; ++ return Matrix44 ( ++ c00, ++ c01, ++ c02, ++ c03, ++ c10, ++ c11, ++ c12, ++ c13, ++ c20, ++ c21, ++ c22, ++ c23, ++ c30, ++ c31, ++ c32, ++ c33); + } + +- + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& + Matrix44::operator*= (const Matrix44& v) IMATH_NOEXCEPT + { +- *this = multiply(*this, v); ++ *this = multiply (*this, v); + return *this; + } + +@@ -3642,20 +4027,22 @@ template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44 + Matrix44::operator* (const Matrix44& v) const IMATH_NOEXCEPT + { +- return multiply(*this, v); ++ return multiply (*this, v); + } + + template + IMATH_HOSTDEVICE inline void +-Matrix44::multiply (const Matrix44& a, const Matrix44& b, Matrix44& c) IMATH_NOEXCEPT ++Matrix44::multiply ( ++ const Matrix44& a, const Matrix44& b, Matrix44& c) IMATH_NOEXCEPT + { +- c = multiply(a, b); ++ c = multiply (a, b); + } + + template + template + IMATH_HOSTDEVICE inline void +-Matrix44::multVecMatrix (const Vec3& src, Vec3& dst) const IMATH_NOEXCEPT ++Matrix44::multVecMatrix (const Vec3& src, Vec3& dst) const ++ IMATH_NOEXCEPT + { + S a, b, c, w; + +@@ -3672,7 +4059,8 @@ Matrix44::multVecMatrix (const Vec3& src, Vec3& dst) const IMATH_NOEXCE + template + template + IMATH_HOSTDEVICE inline void +-Matrix44::multDirMatrix (const Vec3& src, Vec3& dst) const IMATH_NOEXCEPT ++Matrix44::multDirMatrix (const Vec3& src, Vec3& dst) const ++ IMATH_NOEXCEPT + { + S a, b, c; + +@@ -3713,68 +4101,71 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix44 + Matrix44::operator/ (T a) const IMATH_NOEXCEPT + { +- return Matrix44 (x[0][0] / a, +- x[0][1] / a, +- x[0][2] / a, +- x[0][3] / a, +- x[1][0] / a, +- x[1][1] / a, +- x[1][2] / a, +- x[1][3] / a, +- x[2][0] / a, +- x[2][1] / a, +- x[2][2] / a, +- x[2][3] / a, +- x[3][0] / a, +- x[3][1] / a, +- x[3][2] / a, +- x[3][3] / a); ++ return Matrix44 ( ++ x[0][0] / a, ++ x[0][1] / a, ++ x[0][2] / a, ++ x[0][3] / a, ++ x[1][0] / a, ++ x[1][1] / a, ++ x[1][2] / a, ++ x[1][3] / a, ++ x[2][0] / a, ++ x[2][1] / a, ++ x[2][2] / a, ++ x[2][3] / a, ++ x[3][0] / a, ++ x[3][1] / a, ++ x[3][2] / a, ++ x[3][3] / a); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::transpose() IMATH_NOEXCEPT +-{ +- Matrix44 tmp (x[0][0], +- x[1][0], +- x[2][0], +- x[3][0], +- x[0][1], +- x[1][1], +- x[2][1], +- x[3][1], +- x[0][2], +- x[1][2], +- x[2][2], +- x[3][2], +- x[0][3], +- x[1][3], +- x[2][3], +- x[3][3]); ++ Matrix44::transpose () IMATH_NOEXCEPT ++{ ++ Matrix44 tmp ( ++ x[0][0], ++ x[1][0], ++ x[2][0], ++ x[3][0], ++ x[0][1], ++ x[1][1], ++ x[2][1], ++ x[3][1], ++ x[0][2], ++ x[1][2], ++ x[2][2], ++ x[3][2], ++ x[0][3], ++ x[1][3], ++ x[2][3], ++ x[3][3]); + *this = tmp; + return *this; + } + + template + IMATH_HOSTDEVICE constexpr inline Matrix44 +-Matrix44::transposed() const IMATH_NOEXCEPT +-{ +- return Matrix44 (x[0][0], +- x[1][0], +- x[2][0], +- x[3][0], +- x[0][1], +- x[1][1], +- x[2][1], +- x[3][1], +- x[0][2], +- x[1][2], +- x[2][2], +- x[3][2], +- x[0][3], +- x[1][3], +- x[2][3], +- x[3][3]); ++Matrix44::transposed () const IMATH_NOEXCEPT ++{ ++ return Matrix44 ( ++ x[0][0], ++ x[1][0], ++ x[2][0], ++ x[3][0], ++ x[0][1], ++ x[1][1], ++ x[2][1], ++ x[3][1], ++ x[0][2], ++ x[1][2], ++ x[2][2], ++ x[3][2], ++ x[0][3], ++ x[1][3], ++ x[2][3], ++ x[3][3]); + } + + template +@@ -3787,9 +4178,9 @@ Matrix44::gjInvert (bool singExc) + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::gjInvert() IMATH_NOEXCEPT ++ Matrix44::gjInvert () IMATH_NOEXCEPT + { +- *this = gjInverse(); ++ *this = gjInverse (); + return *this; + } + +@@ -3797,7 +4188,7 @@ template + inline Matrix44 + Matrix44::gjInverse (bool singExc) const + { +- int i, j, k; ++ int i, j, k; + Matrix44 s; + Matrix44 t (*this); + +@@ -3809,15 +4200,13 @@ Matrix44::gjInverse (bool singExc) const + + T pivotsize = t.x[i][i]; + +- if (pivotsize < 0) +- pivotsize = -pivotsize; ++ if (pivotsize < 0) pivotsize = -pivotsize; + + for (j = i + 1; j < 4; j++) + { + T tmp = t.x[j][i]; + +- if (tmp < 0) +- tmp = -tmp; ++ if (tmp < 0) tmp = -tmp; + + if (tmp > pivotsize) + { +@@ -3831,7 +4220,7 @@ Matrix44::gjInverse (bool singExc) const + if (singExc) + throw std::invalid_argument ("Cannot invert singular matrix."); + +- return Matrix44(); ++ return Matrix44 (); + } + + if (pivot != i) +@@ -3873,7 +4262,7 @@ Matrix44::gjInverse (bool singExc) const + if (singExc) + throw std::invalid_argument ("Cannot invert singular matrix."); + +- return Matrix44(); ++ return Matrix44 (); + } + + for (j = 0; j < 4; j++) +@@ -3899,9 +4288,9 @@ Matrix44::gjInverse (bool singExc) const + + template + IMATH_HOSTDEVICE inline Matrix44 +-Matrix44::gjInverse() const IMATH_NOEXCEPT ++Matrix44::gjInverse () const IMATH_NOEXCEPT + { +- int i, j, k; ++ int i, j, k; + Matrix44 s; + Matrix44 t (*this); + +@@ -3913,15 +4302,13 @@ Matrix44::gjInverse() const IMATH_NOEXCEPT + + T pivotsize = t.x[i][i]; + +- if (pivotsize < 0) +- pivotsize = -pivotsize; ++ if (pivotsize < 0) pivotsize = -pivotsize; + + for (j = i + 1; j < 4; j++) + { + T tmp = t.x[j][i]; + +- if (tmp < 0) +- tmp = -tmp; ++ if (tmp < 0) tmp = -tmp; + + if (tmp > pivotsize) + { +@@ -3930,10 +4317,7 @@ Matrix44::gjInverse() const IMATH_NOEXCEPT + } + } + +- if (pivotsize == 0) +- { +- return Matrix44(); +- } ++ if (pivotsize == 0) { return Matrix44 (); } + + if (pivot != i) + { +@@ -3969,10 +4353,7 @@ Matrix44::gjInverse() const IMATH_NOEXCEPT + { + T f; + +- if ((f = t.x[i][i]) == 0) +- { +- return Matrix44(); +- } ++ if ((f = t.x[i][i]) == 0) { return Matrix44 (); } + + for (j = 0; j < 4; j++) + { +@@ -4005,9 +4386,9 @@ Matrix44::invert (bool singExc) + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::invert() IMATH_NOEXCEPT ++ Matrix44::invert () IMATH_NOEXCEPT + { +- *this = inverse(); ++ *this = inverse (); + return *this; + } + +@@ -4018,25 +4399,26 @@ Matrix44::inverse (bool singExc) const + if (x[0][3] != 0 || x[1][3] != 0 || x[2][3] != 0 || x[3][3] != 1) + return gjInverse (singExc); + +- Matrix44 s (x[1][1] * x[2][2] - x[2][1] * x[1][2], +- x[2][1] * x[0][2] - x[0][1] * x[2][2], +- x[0][1] * x[1][2] - x[1][1] * x[0][2], +- 0, ++ Matrix44 s ( ++ x[1][1] * x[2][2] - x[2][1] * x[1][2], ++ x[2][1] * x[0][2] - x[0][1] * x[2][2], ++ x[0][1] * x[1][2] - x[1][1] * x[0][2], ++ 0, + +- x[2][0] * x[1][2] - x[1][0] * x[2][2], +- x[0][0] * x[2][2] - x[2][0] * x[0][2], +- x[1][0] * x[0][2] - x[0][0] * x[1][2], +- 0, ++ x[2][0] * x[1][2] - x[1][0] * x[2][2], ++ x[0][0] * x[2][2] - x[2][0] * x[0][2], ++ x[1][0] * x[0][2] - x[0][0] * x[1][2], ++ 0, + +- x[1][0] * x[2][1] - x[2][0] * x[1][1], +- x[2][0] * x[0][1] - x[0][0] * x[2][1], +- x[0][0] * x[1][1] - x[1][0] * x[0][1], +- 0, ++ x[1][0] * x[2][1] - x[2][0] * x[1][1], ++ x[2][0] * x[0][1] - x[0][0] * x[2][1], ++ x[0][0] * x[1][1] - x[1][0] * x[0][1], ++ 0, + +- 0, +- 0, +- 0, +- 1); ++ 0, ++ 0, ++ 0, ++ 1); + + T r = x[0][0] * s.x[0][0] + x[0][1] * s.x[1][0] + x[0][2] * s.x[2][0]; + +@@ -4052,7 +4434,8 @@ Matrix44::inverse (bool singExc) const + } + else + { +- T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min(); ++ T mr = ++ IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min (); + + for (int i = 0; i < 3; ++i) + { +@@ -4065,47 +4448,52 @@ Matrix44::inverse (bool singExc) const + else + { + if (singExc) +- throw std::invalid_argument ("Cannot invert singular matrix."); ++ throw std::invalid_argument ( ++ "Cannot invert singular matrix."); + +- return Matrix44(); ++ return Matrix44 (); + } + } + } + } + +- s.x[3][0] = -x[3][0] * s.x[0][0] - x[3][1] * s.x[1][0] - x[3][2] * s.x[2][0]; +- s.x[3][1] = -x[3][0] * s.x[0][1] - x[3][1] * s.x[1][1] - x[3][2] * s.x[2][1]; +- s.x[3][2] = -x[3][0] * s.x[0][2] - x[3][1] * s.x[1][2] - x[3][2] * s.x[2][2]; ++ s.x[3][0] = ++ -x[3][0] * s.x[0][0] - x[3][1] * s.x[1][0] - x[3][2] * s.x[2][0]; ++ s.x[3][1] = ++ -x[3][0] * s.x[0][1] - x[3][1] * s.x[1][1] - x[3][2] * s.x[2][1]; ++ s.x[3][2] = ++ -x[3][0] * s.x[0][2] - x[3][1] * s.x[1][2] - x[3][2] * s.x[2][2]; + + return s; + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Matrix44 +-Matrix44::inverse() const IMATH_NOEXCEPT ++ Matrix44::inverse () const IMATH_NOEXCEPT + { + if (x[0][3] != 0 || x[1][3] != 0 || x[2][3] != 0 || x[3][3] != 1) +- return gjInverse(); ++ return gjInverse (); + +- Matrix44 s (x[1][1] * x[2][2] - x[2][1] * x[1][2], +- x[2][1] * x[0][2] - x[0][1] * x[2][2], +- x[0][1] * x[1][2] - x[1][1] * x[0][2], +- 0, ++ Matrix44 s ( ++ x[1][1] * x[2][2] - x[2][1] * x[1][2], ++ x[2][1] * x[0][2] - x[0][1] * x[2][2], ++ x[0][1] * x[1][2] - x[1][1] * x[0][2], ++ 0, + +- x[2][0] * x[1][2] - x[1][0] * x[2][2], +- x[0][0] * x[2][2] - x[2][0] * x[0][2], +- x[1][0] * x[0][2] - x[0][0] * x[1][2], +- 0, ++ x[2][0] * x[1][2] - x[1][0] * x[2][2], ++ x[0][0] * x[2][2] - x[2][0] * x[0][2], ++ x[1][0] * x[0][2] - x[0][0] * x[1][2], ++ 0, + +- x[1][0] * x[2][1] - x[2][0] * x[1][1], +- x[2][0] * x[0][1] - x[0][0] * x[2][1], +- x[0][0] * x[1][1] - x[1][0] * x[0][1], +- 0, ++ x[1][0] * x[2][1] - x[2][0] * x[1][1], ++ x[2][0] * x[0][1] - x[0][0] * x[2][1], ++ x[0][0] * x[1][1] - x[1][0] * x[0][1], ++ 0, + +- 0, +- 0, +- 0, +- 1); ++ 0, ++ 0, ++ 0, ++ 1); + + T r = x[0][0] * s.x[0][0] + x[0][1] * s.x[1][0] + x[0][2] * s.x[2][0]; + +@@ -4121,7 +4509,8 @@ Matrix44::inverse() const IMATH_NOEXCEPT + } + else + { +- T mr = IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min(); ++ T mr = ++ IMATH_INTERNAL_NAMESPACE::abs (r) / std::numeric_limits::min (); + + for (int i = 0; i < 3; ++i) + { +@@ -4133,27 +4522,31 @@ Matrix44::inverse() const IMATH_NOEXCEPT + } + else + { +- return Matrix44(); ++ return Matrix44 (); + } + } + } + } + +- s.x[3][0] = -x[3][0] * s.x[0][0] - x[3][1] * s.x[1][0] - x[3][2] * s.x[2][0]; +- s.x[3][1] = -x[3][0] * s.x[0][1] - x[3][1] * s.x[1][1] - x[3][2] * s.x[2][1]; +- s.x[3][2] = -x[3][0] * s.x[0][2] - x[3][1] * s.x[1][2] - x[3][2] * s.x[2][2]; ++ s.x[3][0] = ++ -x[3][0] * s.x[0][0] - x[3][1] * s.x[1][0] - x[3][2] * s.x[2][0]; ++ s.x[3][1] = ++ -x[3][0] * s.x[0][1] - x[3][1] * s.x[1][1] - x[3][2] * s.x[2][1]; ++ s.x[3][2] = ++ -x[3][0] * s.x[0][2] - x[3][1] * s.x[1][2] - x[3][2] * s.x[2][2]; + + return s; + } + + template + IMATH_HOSTDEVICE constexpr inline T +-Matrix44::fastMinor (const int r0, +- const int r1, +- const int r2, +- const int c0, +- const int c1, +- const int c2) const IMATH_NOEXCEPT ++Matrix44::fastMinor ( ++ const int r0, ++ const int r1, ++ const int r2, ++ const int c0, ++ const int c1, ++ const int c2) const IMATH_NOEXCEPT + { + return x[r0][c0] * (x[r1][c1] * x[r2][c2] - x[r1][c2] * x[r2][c1]) + + x[r0][c1] * (x[r1][c2] * x[r2][c0] - x[r1][c0] * x[r2][c2]) + +@@ -4171,33 +4564,30 @@ Matrix44::minorOf (const int r, const int c) const IMATH_NOEXCEPT + int c1 = 1 + (c < 2 ? 1 : 0); + int c2 = 2 + (c < 3 ? 1 : 0); + +- Matrix33 working (x[r0][c0], +- x[r1][c0], +- x[r2][c0], +- x[r0][c1], +- x[r1][c1], +- x[r2][c1], +- x[r0][c2], +- x[r1][c2], +- x[r2][c2]); ++ Matrix33 working ( ++ x[r0][c0], ++ x[r1][c0], ++ x[r2][c0], ++ x[r0][c1], ++ x[r1][c1], ++ x[r2][c1], ++ x[r0][c2], ++ x[r1][c2], ++ x[r2][c2]); + +- return working.determinant(); ++ return working.determinant (); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T +-Matrix44::determinant() const IMATH_NOEXCEPT ++Matrix44::determinant () const IMATH_NOEXCEPT + { + T sum = (T) 0; + +- if (x[0][3] != 0.) +- sum -= x[0][3] * fastMinor (1, 2, 3, 0, 1, 2); +- if (x[1][3] != 0.) +- sum += x[1][3] * fastMinor (0, 2, 3, 0, 1, 2); +- if (x[2][3] != 0.) +- sum -= x[2][3] * fastMinor (0, 1, 3, 0, 1, 2); +- if (x[3][3] != 0.) +- sum += x[3][3] * fastMinor (0, 1, 2, 0, 1, 2); ++ if (x[0][3] != 0.) sum -= x[0][3] * fastMinor (1, 2, 3, 0, 1, 2); ++ if (x[1][3] != 0.) sum += x[1][3] * fastMinor (0, 2, 3, 0, 1, 2); ++ if (x[2][3] != 0.) sum -= x[2][3] * fastMinor (0, 1, 3, 0, 1, 2); ++ if (x[3][3] != 0.) sum += x[3][3] * fastMinor (0, 1, 2, 0, 1, 2); + + return sum; + } +@@ -4245,9 +4635,9 @@ template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& + Matrix44::setAxisAngle (const Vec3& axis, S angle) IMATH_NOEXCEPT + { +- Vec3 unit (axis.normalized()); +- S sine = std::sin (angle); +- S cosine = std::cos (angle); ++ Vec3 unit (axis.normalized ()); ++ S sine = std::sin (angle); ++ S cosine = std::cos (angle); + + x[0][0] = unit.x * unit.x * (1 - cosine) + cosine; + x[0][1] = unit.x * unit.y * (1 - cosine) + unit.z * sine; +@@ -4322,7 +4712,7 @@ Matrix44::rotate (const Vec3& r) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::setScale (T s) IMATH_NOEXCEPT ++ Matrix44::setScale (T s) IMATH_NOEXCEPT + { + // + // Set the matrix to a 3D homogeneous transform scale: +@@ -4354,7 +4744,7 @@ Matrix44::setScale (T s) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::setScale (const Vec3& s) IMATH_NOEXCEPT ++ Matrix44::setScale (const Vec3& s) IMATH_NOEXCEPT + { + // + // Set the matrix to a 3D homogeneous transform scale: +@@ -4386,7 +4776,7 @@ Matrix44::setScale (const Vec3& s) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::scale (const Vec3& s) IMATH_NOEXCEPT ++ Matrix44::scale (const Vec3& s) IMATH_NOEXCEPT + { + x[0][0] *= s.x; + x[0][1] *= s.x; +@@ -4409,7 +4799,7 @@ Matrix44::scale (const Vec3& s) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::setTranslation (const Vec3& t) IMATH_NOEXCEPT ++ Matrix44::setTranslation (const Vec3& t) IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -4436,7 +4826,7 @@ Matrix44::setTranslation (const Vec3& t) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline const Vec3 +-Matrix44::translation() const IMATH_NOEXCEPT ++Matrix44::translation () const IMATH_NOEXCEPT + { + return Vec3 (x[3][0], x[3][1], x[3][2]); + } +@@ -4444,7 +4834,7 @@ Matrix44::translation() const IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::translate (const Vec3& t) IMATH_NOEXCEPT ++ Matrix44::translate (const Vec3& t) IMATH_NOEXCEPT + { + x[3][0] += t.x * x[0][0] + t.y * x[1][0] + t.z * x[2][0]; + x[3][1] += t.x * x[0][1] + t.y * x[1][1] + t.z * x[2][1]; +@@ -4457,7 +4847,7 @@ Matrix44::translate (const Vec3& t) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::setShear (const Vec3& h) IMATH_NOEXCEPT ++ Matrix44::setShear (const Vec3& h) IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = 0; +@@ -4485,7 +4875,7 @@ Matrix44::setShear (const Vec3& h) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::setShear (const Shear6& h) IMATH_NOEXCEPT ++ Matrix44::setShear (const Shear6& h) IMATH_NOEXCEPT + { + x[0][0] = 1; + x[0][1] = h.yx; +@@ -4513,7 +4903,7 @@ Matrix44::setShear (const Shear6& h) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::shear (const Vec3& h) IMATH_NOEXCEPT ++ Matrix44::shear (const Vec3& h) IMATH_NOEXCEPT + { + // + // In this case, we don't need a temp. copy of the matrix +@@ -4533,7 +4923,7 @@ Matrix44::shear (const Vec3& h) IMATH_NOEXCEPT + template + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Matrix44& +-Matrix44::shear (const Shear6& h) IMATH_NOEXCEPT ++ Matrix44::shear (const Shear6& h) IMATH_NOEXCEPT + { + Matrix44 P (*this); + +@@ -4555,25 +4945,27 @@ template + std::ostream& + operator<< (std::ostream& s, const Matrix22& m) + { +- std::ios_base::fmtflags oldFlags = s.flags(); +- int width; ++ std::ios_base::fmtflags oldFlags = s.flags (); ++ int width; + +- if (s.flags() & std::ios_base::fixed) ++ if (s.flags () & std::ios_base::fixed) + { + s.setf (std::ios_base::showpoint); +- width = static_cast (s.precision()) + 5; ++ width = static_cast (s.precision ()) + 5; + } + else + { + s.setf (std::ios_base::scientific); + s.setf (std::ios_base::showpoint); +- width = static_cast (s.precision()) + 8; ++ width = static_cast (s.precision ()) + 8; + } + +- s << "(" << std::setw (width) << m[0][0] << " " << std::setw (width) << m[0][1] << "\n" ++ s << "(" << std::setw (width) << m[0][0] << " " << std::setw (width) ++ << m[0][1] << "\n" + << + +- " " << std::setw (width) << m[1][0] << " " << std::setw (width) << m[1][1] << ")\n"; ++ " " << std::setw (width) << m[1][0] << " " << std::setw (width) ++ << m[1][1] << ")\n"; + + s.flags (oldFlags); + return s; +@@ -4583,31 +4975,31 @@ template + std::ostream& + operator<< (std::ostream& s, const Matrix33& m) + { +- std::ios_base::fmtflags oldFlags = s.flags(); +- int width; ++ std::ios_base::fmtflags oldFlags = s.flags (); ++ int width; + +- if (s.flags() & std::ios_base::fixed) ++ if (s.flags () & std::ios_base::fixed) + { + s.setf (std::ios_base::showpoint); +- width = static_cast (s.precision()) + 5; ++ width = static_cast (s.precision ()) + 5; + } + else + { + s.setf (std::ios_base::scientific); + s.setf (std::ios_base::showpoint); +- width = static_cast (s.precision()) + 8; ++ width = static_cast (s.precision ()) + 8; + } + +- s << "(" << std::setw (width) << m[0][0] << " " << std::setw (width) << m[0][1] << " " +- << std::setw (width) << m[0][2] << "\n" ++ s << "(" << std::setw (width) << m[0][0] << " " << std::setw (width) ++ << m[0][1] << " " << std::setw (width) << m[0][2] << "\n" + << + +- " " << std::setw (width) << m[1][0] << " " << std::setw (width) << m[1][1] << " " +- << std::setw (width) << m[1][2] << "\n" ++ " " << std::setw (width) << m[1][0] << " " << std::setw (width) ++ << m[1][1] << " " << std::setw (width) << m[1][2] << "\n" + << + +- " " << std::setw (width) << m[2][0] << " " << std::setw (width) << m[2][1] << " " +- << std::setw (width) << m[2][2] << ")\n"; ++ " " << std::setw (width) << m[2][0] << " " << std::setw (width) ++ << m[2][1] << " " << std::setw (width) << m[2][2] << ")\n"; + + s.flags (oldFlags); + return s; +@@ -4617,35 +5009,39 @@ template + std::ostream& + operator<< (std::ostream& s, const Matrix44& m) + { +- std::ios_base::fmtflags oldFlags = s.flags(); +- int width; ++ std::ios_base::fmtflags oldFlags = s.flags (); ++ int width; + +- if (s.flags() & std::ios_base::fixed) ++ if (s.flags () & std::ios_base::fixed) + { + s.setf (std::ios_base::showpoint); +- width = static_cast (s.precision()) + 5; ++ width = static_cast (s.precision ()) + 5; + } + else + { + s.setf (std::ios_base::scientific); + s.setf (std::ios_base::showpoint); +- width = static_cast (s.precision()) + 8; ++ width = static_cast (s.precision ()) + 8; + } + +- s << "(" << std::setw (width) << m[0][0] << " " << std::setw (width) << m[0][1] << " " +- << std::setw (width) << m[0][2] << " " << std::setw (width) << m[0][3] << "\n" ++ s << "(" << std::setw (width) << m[0][0] << " " << std::setw (width) ++ << m[0][1] << " " << std::setw (width) << m[0][2] << " " ++ << std::setw (width) << m[0][3] << "\n" + << + +- " " << std::setw (width) << m[1][0] << " " << std::setw (width) << m[1][1] << " " +- << std::setw (width) << m[1][2] << " " << std::setw (width) << m[1][3] << "\n" ++ " " << std::setw (width) << m[1][0] << " " << std::setw (width) ++ << m[1][1] << " " << std::setw (width) << m[1][2] << " " ++ << std::setw (width) << m[1][3] << "\n" + << + +- " " << std::setw (width) << m[2][0] << " " << std::setw (width) << m[2][1] << " " +- << std::setw (width) << m[2][2] << " " << std::setw (width) << m[2][3] << "\n" ++ " " << std::setw (width) << m[2][0] << " " << std::setw (width) ++ << m[2][1] << " " << std::setw (width) << m[2][2] << " " ++ << std::setw (width) << m[2][3] << "\n" + << + +- " " << std::setw (width) << m[3][0] << " " << std::setw (width) << m[3][1] << " " +- << std::setw (width) << m[3][2] << " " << std::setw (width) << m[3][3] << ")\n"; ++ " " << std::setw (width) << m[3][0] << " " << std::setw (width) ++ << m[3][1] << " " << std::setw (width) << m[3][2] << " " ++ << std::setw (width) << m[3][3] << ")\n"; + + s.flags (oldFlags); + return s; +@@ -4746,8 +5142,8 @@ operator*= (Vec3& v, const Matrix44& m) IMATH_NOEXCEPT + } + + template +-IMATH_HOSTDEVICE inline Vec3 +-IMATH_HOSTDEVICE operator* (const Vec3& v, const Matrix44& m) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE inline Vec3 IMATH_HOSTDEVICE ++operator* (const Vec3& v, const Matrix44& m) IMATH_NOEXCEPT + { + S x = S (v.x * m.x[0][0] + v.y * m.x[1][0] + v.z * m.x[2][0] + m.x[3][0]); + S y = S (v.x * m.x[0][1] + v.y * m.x[1][1] + v.z * m.x[2][1] + m.x[3][1]); +@@ -4758,13 +5154,17 @@ IMATH_HOSTDEVICE operator* (const Vec3& v, const Matrix44& m) IMATH_NOEXCE + } + + template +-IMATH_HOSTDEVICE inline const Vec4& +-IMATH_HOSTDEVICE operator*= (Vec4& v, const Matrix44& m) IMATH_NOEXCEPT +-{ +- S x = S (v.x * m.x[0][0] + v.y * m.x[1][0] + v.z * m.x[2][0] + v.w * m.x[3][0]); +- S y = S (v.x * m.x[0][1] + v.y * m.x[1][1] + v.z * m.x[2][1] + v.w * m.x[3][1]); +- S z = S (v.x * m.x[0][2] + v.y * m.x[1][2] + v.z * m.x[2][2] + v.w * m.x[3][2]); +- S w = S (v.x * m.x[0][3] + v.y * m.x[1][3] + v.z * m.x[2][3] + v.w * m.x[3][3]); ++IMATH_HOSTDEVICE inline const Vec4& IMATH_HOSTDEVICE ++operator*= (Vec4& v, const Matrix44& m) IMATH_NOEXCEPT ++{ ++ S x = S ( ++ v.x * m.x[0][0] + v.y * m.x[1][0] + v.z * m.x[2][0] + v.w * m.x[3][0]); ++ S y = S ( ++ v.x * m.x[0][1] + v.y * m.x[1][1] + v.z * m.x[2][1] + v.w * m.x[3][1]); ++ S z = S ( ++ v.x * m.x[0][2] + v.y * m.x[1][2] + v.z * m.x[2][2] + v.w * m.x[3][2]); ++ S w = S ( ++ v.x * m.x[0][3] + v.y * m.x[1][3] + v.z * m.x[2][3] + v.w * m.x[3][3]); + + v.x = x; + v.y = y; +@@ -4775,13 +5175,17 @@ IMATH_HOSTDEVICE operator*= (Vec4& v, const Matrix44& m) IMATH_NOEXCEPT + } + + template +-IMATH_HOSTDEVICE inline Vec4 +-IMATH_HOSTDEVICE operator* (const Vec4& v, const Matrix44& m) IMATH_NOEXCEPT +-{ +- S x = S (v.x * m.x[0][0] + v.y * m.x[1][0] + v.z * m.x[2][0] + v.w * m.x[3][0]); +- S y = S (v.x * m.x[0][1] + v.y * m.x[1][1] + v.z * m.x[2][1] + v.w * m.x[3][1]); +- S z = S (v.x * m.x[0][2] + v.y * m.x[1][2] + v.z * m.x[2][2] + v.w * m.x[3][2]); +- S w = S (v.x * m.x[0][3] + v.y * m.x[1][3] + v.z * m.x[2][3] + v.w * m.x[3][3]); ++IMATH_HOSTDEVICE inline Vec4 IMATH_HOSTDEVICE ++operator* (const Vec4& v, const Matrix44& m) IMATH_NOEXCEPT ++{ ++ S x = S ( ++ v.x * m.x[0][0] + v.y * m.x[1][0] + v.z * m.x[2][0] + v.w * m.x[3][0]); ++ S y = S ( ++ v.x * m.x[0][1] + v.y * m.x[1][1] + v.z * m.x[2][1] + v.w * m.x[3][1]); ++ S z = S ( ++ v.x * m.x[0][2] + v.y * m.x[1][2] + v.z * m.x[2][2] + v.w * m.x[3][2]); ++ S w = S ( ++ v.x * m.x[0][3] + v.y * m.x[1][3] + v.z * m.x[2][3] + v.w * m.x[3][3]); + + return Vec4 (x, y, z, w); + } +diff --git a/src/Imath/ImathMatrixAlgo.cpp b/src/Imath/ImathMatrixAlgo.cpp +index 746751f..0603fa7 100644 +--- a/src/Imath/ImathMatrixAlgo.cpp ++++ b/src/Imath/ImathMatrixAlgo.cpp +@@ -50,8 +50,8 @@ namespace + + class KahanSum + { +- public: +- KahanSum() : _total (0), _correction (0) {} ++public: ++ KahanSum () : _total (0), _correction (0) {} + + void operator+= (const double val) + { +@@ -61,9 +61,9 @@ class KahanSum + _total = t; + } + +- double get() const { return _total; } ++ double get () const { return _total; } + +- private: ++private: + double _total; + double _correction; + }; +@@ -72,18 +72,18 @@ class KahanSum + + template + M44d +-procrustesRotationAndTranslation (const Vec3* A, +- const Vec3* B, +- const T* weights, +- const size_t numPoints, +- const bool doScale) ++procrustesRotationAndTranslation ( ++ const Vec3* A, ++ const Vec3* B, ++ const T* weights, ++ const size_t numPoints, ++ const bool doScale) + { +- if (numPoints == 0) +- return M44d(); ++ if (numPoints == 0) return M44d (); + + // Always do the accumulation in double precision: +- V3d Acenter (0.0); +- V3d Bcenter (0.0); ++ V3d Acenter (0.0); ++ V3d Bcenter (0.0); + double weightsSum = 0.0; + + if (weights == 0) +@@ -107,8 +107,7 @@ procrustesRotationAndTranslation (const Vec3* A, + } + } + +- if (weightsSum == 0) +- return M44d(); ++ if (weightsSum == 0) return M44d (); + + Acenter /= weightsSum; + Bcenter /= weightsSum; +@@ -133,17 +132,18 @@ procrustesRotationAndTranslation (const Vec3* A, + for (size_t i = 0; i < numPoints; ++i) + { + const double w = weights[i]; +- C += outerProduct (w * ((V3d) B[i] - Bcenter), (V3d) A[i] - Acenter); ++ C += ++ outerProduct (w * ((V3d) B[i] - Bcenter), (V3d) A[i] - Acenter); + } + } + + M33d U, V; +- V3d S; +- jacobiSVD (C, U, S, V, std::numeric_limits::epsilon(), true); ++ V3d S; ++ jacobiSVD (C, U, S, V, std::numeric_limits::epsilon (), true); + + // We want Q.transposed() here since we are going to be using it in the + // Imath style (multiplying vectors on the right, v' = v*A^T): +- const M33d Qt = V * U.transposed(); ++ const M33d Qt = V * U.transposed (); + + double s = 1.0; + if (doScale && numPoints > 1) +@@ -171,12 +171,13 @@ procrustesRotationAndTranslation (const Vec3* A, + if (weights == 0) + { + for (size_t i = 0; i < numPoints; ++i) +- traceATA += ((V3d) A[i] - Acenter).length2(); ++ traceATA += ((V3d) A[i] - Acenter).length2 (); + } + else + { + for (size_t i = 0; i < numPoints; ++i) +- traceATA += ((double) weights[i]) * ((V3d) A[i] - Acenter).length2(); ++ traceATA += ++ ((double) weights[i]) * ((V3d) A[i] - Acenter).length2 (); + } + + KahanSum traceBATQ; +@@ -184,7 +185,7 @@ procrustesRotationAndTranslation (const Vec3* A, + for (int j = 0; j < 3; ++j) + traceBATQ += Qt[j][i] * C[i][j]; + +- s = traceBATQ.get() / traceATA.get(); ++ s = traceBATQ.get () / traceATA.get (); + } + + // Q is the rotation part of what we want to return. +@@ -208,22 +209,23 @@ procrustesRotationAndTranslation (const Vec3* A, + // (ofc the whole thing is transposed for Imath). + const V3d translate = Bcenter - s * Acenter * Qt; + +- return M44d (s * Qt.x[0][0], +- s * Qt.x[0][1], +- s * Qt.x[0][2], +- T (0), +- s * Qt.x[1][0], +- s * Qt.x[1][1], +- s * Qt.x[1][2], +- T (0), +- s * Qt.x[2][0], +- s * Qt.x[2][1], +- s * Qt.x[2][2], +- T (0), +- translate.x, +- translate.y, +- translate.z, +- T (1)); ++ return M44d ( ++ s * Qt.x[0][0], ++ s * Qt.x[0][1], ++ s * Qt.x[0][2], ++ T (0), ++ s * Qt.x[1][0], ++ s * Qt.x[1][1], ++ s * Qt.x[1][2], ++ T (0), ++ s * Qt.x[2][0], ++ s * Qt.x[2][1], ++ s * Qt.x[2][2], ++ T (0), ++ translate.x, ++ translate.y, ++ translate.z, ++ T (1)); + } // procrustesRotationAndTranslation + + /// +@@ -235,36 +237,36 @@ procrustesRotationAndTranslation (const Vec3* A, + + template + M44d +-procrustesRotationAndTranslation (const Vec3* A, +- const Vec3* B, +- const size_t numPoints, +- const bool doScale) ++procrustesRotationAndTranslation ( ++ const Vec3* A, ++ const Vec3* B, ++ const size_t numPoints, ++ const bool doScale) + { +- return procrustesRotationAndTranslation (A, B, (const T*) 0, numPoints, doScale); ++ return procrustesRotationAndTranslation ( ++ A, B, (const T*) 0, numPoints, doScale); + } // procrustesRotationAndTranslation + + /// TODO +-template IMATH_EXPORT M44d procrustesRotationAndTranslation (const V3d* from, +- const V3d* to, +- const size_t numPoints, +- const bool doScale); ++template IMATH_EXPORT M44d procrustesRotationAndTranslation ( ++ const V3d* from, const V3d* to, const size_t numPoints, const bool doScale); + /// TODO +-template IMATH_EXPORT M44d procrustesRotationAndTranslation (const V3f* from, +- const V3f* to, +- const size_t numPoints, +- const bool doScale); ++template IMATH_EXPORT M44d procrustesRotationAndTranslation ( ++ const V3f* from, const V3f* to, const size_t numPoints, const bool doScale); + /// TODO +-template IMATH_EXPORT M44d procrustesRotationAndTranslation (const V3d* from, +- const V3d* to, +- const double* weights, +- const size_t numPoints, +- const bool doScale); ++template IMATH_EXPORT M44d procrustesRotationAndTranslation ( ++ const V3d* from, ++ const V3d* to, ++ const double* weights, ++ const size_t numPoints, ++ const bool doScale); + /// TODO +-template IMATH_EXPORT M44d procrustesRotationAndTranslation (const V3f* from, +- const V3f* to, +- const float* weights, +- const size_t numPoints, +- const bool doScale); ++template IMATH_EXPORT M44d procrustesRotationAndTranslation ( ++ const V3f* from, ++ const V3f* to, ++ const float* weights, ++ const size_t numPoints, ++ const bool doScale); + + namespace + { +@@ -280,7 +282,8 @@ namespace + // need to explicitly construct the J matrix. + template + void +-jacobiRotateRight (IMATH_INTERNAL_NAMESPACE::Matrix33& A, const T c, const T s) ++jacobiRotateRight ( ++ IMATH_INTERNAL_NAMESPACE::Matrix33& A, const T c, const T s) + { + for (int i = 0; i < 3; ++i) + { +@@ -293,11 +296,12 @@ jacobiRotateRight (IMATH_INTERNAL_NAMESPACE::Matrix33& A, const T c, const T + + template + void +-jacobiRotateRight (IMATH_INTERNAL_NAMESPACE::Matrix44& A, +- const int j, +- const int k, +- const T c, +- const T s) ++jacobiRotateRight ( ++ IMATH_INTERNAL_NAMESPACE::Matrix44& A, ++ const int j, ++ const int k, ++ const T c, ++ const T s) + { + for (int i = 0; i < 4; ++i) + { +@@ -325,10 +329,11 @@ jacobiRotateRight (IMATH_INTERNAL_NAMESPACE::Matrix44& A, + // and the second diagonalizes the symmetric matrix. + template + bool +-twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix33& A, +- IMATH_INTERNAL_NAMESPACE::Matrix33& U, +- IMATH_INTERNAL_NAMESPACE::Matrix33& V, +- const T tol) ++twoSidedJacobiRotation ( ++ IMATH_INTERNAL_NAMESPACE::Matrix33& A, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& U, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& V, ++ const T tol) + { + // Load everything into local variables to make things easier on the + // optimizer: +@@ -349,10 +354,11 @@ twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix33& A, + T mu_2 = x - y; + + T c, s; +- if (std::abs (mu_2) <= tol * std::abs (mu_1)) // Already symmetric (to tolerance) +- { // Note that the <= is important here +- c = T (1); // because we want to bypass the computation +- s = T (0); // of rho if mu_1 = mu_2 = 0. ++ if (std::abs (mu_2) <= ++ tol * std::abs (mu_1)) // Already symmetric (to tolerance) ++ { // Note that the <= is important here ++ c = T (1); // because we want to bypass the computation ++ s = T (0); // of rho if mu_1 = mu_2 = 0. + + const T p = w; + const T r = z; +@@ -365,8 +371,7 @@ twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix33& A, + const T rho = mu_1 / mu_2; + + s = T (1) / std::sqrt (T (1) + rho * rho); +- if (rho < 0) +- s = -s; ++ if (rho < 0) s = -s; + c = s * rho; + + mu_1 = s * (x + y) + c * (z - w); // = r - p +@@ -387,9 +392,8 @@ twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix33& A, + else + { + const T rho_2 = mu_1 / mu_2; +- T t_2 = T (1) / (std::abs (rho_2) + std::sqrt (1 + rho_2 * rho_2)); +- if (rho_2 < 0) +- t_2 = -t_2; ++ T t_2 = T (1) / (std::abs (rho_2) + std::sqrt (1 + rho_2 * rho_2)); ++ if (rho_2 < 0) t_2 = -t_2; + c_2 = T (1) / std::sqrt (T (1) + t_2 * t_2); + s_2 = c_2 * t_2; + +@@ -466,12 +470,13 @@ twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix33& A, + + template + bool +-twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix44& A, +- int j, +- int k, +- IMATH_INTERNAL_NAMESPACE::Matrix44& U, +- IMATH_INTERNAL_NAMESPACE::Matrix44& V, +- const T tol) ++twoSidedJacobiRotation ( ++ IMATH_INTERNAL_NAMESPACE::Matrix44& A, ++ int j, ++ int k, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& U, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& V, ++ const T tol) + { + // Load everything into local variables to make things easier on the + // optimizer: +@@ -492,10 +497,11 @@ twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix44& A, + T mu_2 = x - y; + + T c, s; +- if (std::abs (mu_2) <= tol * std::abs (mu_1)) // Already symmetric (to tolerance) +- { // Note that the <= is important here +- c = T (1); // because we want to bypass the computation +- s = T (0); // of rho if mu_1 = mu_2 = 0. ++ if (std::abs (mu_2) <= ++ tol * std::abs (mu_1)) // Already symmetric (to tolerance) ++ { // Note that the <= is important here ++ c = T (1); // because we want to bypass the computation ++ s = T (0); // of rho if mu_1 = mu_2 = 0. + + const T p = w; + const T r = z; +@@ -508,8 +514,7 @@ twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix44& A, + const T rho = mu_1 / mu_2; + + s = T (1) / std::sqrt (T (1) + rho * rho); +- if (rho < 0) +- s = -s; ++ if (rho < 0) s = -s; + c = s * rho; + + mu_1 = s * (x + y) + c * (z - w); // = r - p +@@ -530,9 +535,8 @@ twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix44& A, + else + { + const T rho_2 = mu_1 / mu_2; +- T t_2 = T (1) / (std::abs (rho_2) + std::sqrt (1 + rho_2 * rho_2)); +- if (rho_2 < 0) +- t_2 = -t_2; ++ T t_2 = T (1) / (std::abs (rho_2) + std::sqrt (1 + rho_2 * rho_2)); ++ if (rho_2 < 0) t_2 = -t_2; + c_2 = T (1) / std::sqrt (T (1) + t_2 * t_2); + s_2 = c_2 * t_2; + +@@ -566,8 +570,7 @@ twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix44& A, + // Rotate the entries that _weren't_ involved in the 2x2 SVD: + for (int l = 0; l < 4; ++l) + { +- if (l == j || l == k) +- continue; ++ if (l == j || l == k) continue; + + // Rotate on the left by + // [ 1 ] +@@ -590,8 +593,7 @@ twoSidedJacobiRotation (IMATH_INTERNAL_NAMESPACE::Matrix44& A, + for (int l = 0; l < 4; ++l) + { + // We set the A[j/k][j/k] entries already +- if (l == j || l == k) +- continue; ++ if (l == j || l == k) continue; + + // Rotate on the right by + // [ 1 ] +@@ -659,8 +661,7 @@ maxOffDiag (const IMATH_INTERNAL_NAMESPACE::Matrix44& A) + { + for (int j = 0; j < 4; ++j) + { +- if (i != j) +- result = std::max (result, std::abs (A[i][j])); ++ if (i != j) result = std::max (result, std::abs (A[i][j])); + } + } + +@@ -669,12 +670,13 @@ maxOffDiag (const IMATH_INTERNAL_NAMESPACE::Matrix44& A) + + template + void +-twoSidedJacobiSVD (IMATH_INTERNAL_NAMESPACE::Matrix33 A, +- IMATH_INTERNAL_NAMESPACE::Matrix33& U, +- IMATH_INTERNAL_NAMESPACE::Vec3& S, +- IMATH_INTERNAL_NAMESPACE::Matrix33& V, +- const T tol, +- const bool forcePositiveDeterminant) ++twoSidedJacobiSVD ( ++ IMATH_INTERNAL_NAMESPACE::Matrix33 A, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& U, ++ IMATH_INTERNAL_NAMESPACE::Vec3& S, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& V, ++ const T tol, ++ const bool forcePositiveDeterminant) + { + // The two-sided Jacobi SVD works by repeatedly zeroing out + // off-diagonal entries of the matrix, 2 at a time. Basically, +@@ -705,22 +707,25 @@ twoSidedJacobiSVD (IMATH_INTERNAL_NAMESPACE::Matrix33 A, + // works so well, FWIW) and because (2) by applying everything to the original + // matrix A instead of computing (A^T * A) we avoid any precision loss that + // would result from that. +- U.makeIdentity(); +- V.makeIdentity(); +- +- const int maxIter = 20; // In case we get really unlucky, prevents infinite loops +- const T absTol = tol * maxOffDiag (A); // Tolerance is in terms of the maximum +- if (absTol != 0) // _off-diagonal_ entry. ++ U.makeIdentity (); ++ V.makeIdentity (); ++ ++ const int maxIter = ++ 20; // In case we get really unlucky, prevents infinite loops ++ const T absTol = ++ tol * maxOffDiag (A); // Tolerance is in terms of the maximum ++ if (absTol != 0) // _off-diagonal_ entry. + { + int numIter = 0; + do + { + ++numIter; + bool changed = twoSidedJacobiRotation (A, U, V, tol); +- changed = twoSidedJacobiRotation (A, U, V, tol) || changed; +- changed = twoSidedJacobiRotation (A, U, V, tol) || changed; +- if (!changed) +- break; ++ changed = twoSidedJacobiRotation (A, U, V, tol) || ++ changed; ++ changed = twoSidedJacobiRotation (A, U, V, tol) || ++ changed; ++ if (!changed) break; + } while (maxOffDiag (A) > absTol && numIter < maxIter); + } + +@@ -777,14 +782,14 @@ twoSidedJacobiSVD (IMATH_INTERNAL_NAMESPACE::Matrix33 A, + // if U has a negative determinant, and + // U*S*L*L*V = U*(S*L)*(L*V) + // if V has a neg. determinant. +- if (U.determinant() < 0) ++ if (U.determinant () < 0) + { + for (int i = 0; i < 3; ++i) + U[i][2] = -U[i][2]; + S.z = -S.z; + } + +- if (V.determinant() < 0) ++ if (V.determinant () < 0) + { + for (int i = 0; i < 3; ++i) + V[i][2] = -V[i][2]; +@@ -795,33 +800,35 @@ twoSidedJacobiSVD (IMATH_INTERNAL_NAMESPACE::Matrix33 A, + + template + void +-twoSidedJacobiSVD (IMATH_INTERNAL_NAMESPACE::Matrix44 A, +- IMATH_INTERNAL_NAMESPACE::Matrix44& U, +- IMATH_INTERNAL_NAMESPACE::Vec4& S, +- IMATH_INTERNAL_NAMESPACE::Matrix44& V, +- const T tol, +- const bool forcePositiveDeterminant) ++twoSidedJacobiSVD ( ++ IMATH_INTERNAL_NAMESPACE::Matrix44 A, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& U, ++ IMATH_INTERNAL_NAMESPACE::Vec4& S, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& V, ++ const T tol, ++ const bool forcePositiveDeterminant) + { + // Please see the Matrix33 version for a detailed description of the algorithm. +- U.makeIdentity(); +- V.makeIdentity(); +- +- const int maxIter = 20; // In case we get really unlucky, prevents infinite loops +- const T absTol = tol * maxOffDiag (A); // Tolerance is in terms of the maximum +- if (absTol != 0) // _off-diagonal_ entry. ++ U.makeIdentity (); ++ V.makeIdentity (); ++ ++ const int maxIter = ++ 20; // In case we get really unlucky, prevents infinite loops ++ const T absTol = ++ tol * maxOffDiag (A); // Tolerance is in terms of the maximum ++ if (absTol != 0) // _off-diagonal_ entry. + { + int numIter = 0; + do + { + ++numIter; + bool changed = twoSidedJacobiRotation (A, 0, 1, U, V, tol); +- changed = twoSidedJacobiRotation (A, 0, 2, U, V, tol) || changed; +- changed = twoSidedJacobiRotation (A, 0, 3, U, V, tol) || changed; +- changed = twoSidedJacobiRotation (A, 1, 2, U, V, tol) || changed; +- changed = twoSidedJacobiRotation (A, 1, 3, U, V, tol) || changed; +- changed = twoSidedJacobiRotation (A, 2, 3, U, V, tol) || changed; +- if (!changed) +- break; ++ changed = twoSidedJacobiRotation (A, 0, 2, U, V, tol) || changed; ++ changed = twoSidedJacobiRotation (A, 0, 3, U, V, tol) || changed; ++ changed = twoSidedJacobiRotation (A, 1, 2, U, V, tol) || changed; ++ changed = twoSidedJacobiRotation (A, 1, 3, U, V, tol) || changed; ++ changed = twoSidedJacobiRotation (A, 2, 3, U, V, tol) || changed; ++ if (!changed) break; + } while (maxOffDiag (A) > absTol && numIter < maxIter); + } + +@@ -850,8 +857,10 @@ twoSidedJacobiSVD (IMATH_INTERNAL_NAMESPACE::Matrix44 A, + // Order the singular values from largest to smallest using insertion sort: + for (int i = 1; i < 4; ++i) + { +- const IMATH_INTERNAL_NAMESPACE::Vec4 uCol (U[0][i], U[1][i], U[2][i], U[3][i]); +- const IMATH_INTERNAL_NAMESPACE::Vec4 vCol (V[0][i], V[1][i], V[2][i], V[3][i]); ++ const IMATH_INTERNAL_NAMESPACE::Vec4 uCol ( ++ U[0][i], U[1][i], U[2][i], U[3][i]); ++ const IMATH_INTERNAL_NAMESPACE::Vec4 vCol ( ++ V[0][i], V[1][i], V[2][i], V[3][i]); + const T sVal = S[i]; + + int j = i - 1; +@@ -864,8 +873,7 @@ twoSidedJacobiSVD (IMATH_INTERNAL_NAMESPACE::Matrix44 A, + S[j + 1] = S[j]; + + --j; +- if (j < 0) +- break; ++ if (j < 0) break; + } + + for (int k = 0; k < 4; ++k) +@@ -889,14 +897,14 @@ twoSidedJacobiSVD (IMATH_INTERNAL_NAMESPACE::Matrix44 A, + // if U has a negative determinant, and + // U*S*L*L*V = U*(S*L)*(L*V) + // if V has a neg. determinant. +- if (U.determinant() < 0) ++ if (U.determinant () < 0) + { + for (int i = 0; i < 4; ++i) + U[i][3] = -U[i][3]; + S[3] = -S[3]; + } + +- if (V.determinant() < 0) ++ if (V.determinant () < 0) + { + for (int i = 0; i < 4; ++i) + V[i][3] = -V[i][3]; +@@ -910,12 +918,13 @@ twoSidedJacobiSVD (IMATH_INTERNAL_NAMESPACE::Matrix44 A, + /// TODO + template + void +-jacobiSVD (const IMATH_INTERNAL_NAMESPACE::Matrix33& A, +- IMATH_INTERNAL_NAMESPACE::Matrix33& U, +- IMATH_INTERNAL_NAMESPACE::Vec3& S, +- IMATH_INTERNAL_NAMESPACE::Matrix33& V, +- const T tol, +- const bool forcePositiveDeterminant) ++jacobiSVD ( ++ const IMATH_INTERNAL_NAMESPACE::Matrix33& A, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& U, ++ IMATH_INTERNAL_NAMESPACE::Vec3& S, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& V, ++ const T tol, ++ const bool forcePositiveDeterminant) + { + twoSidedJacobiSVD (A, U, S, V, tol, forcePositiveDeterminant); + } +@@ -923,55 +932,61 @@ jacobiSVD (const IMATH_INTERNAL_NAMESPACE::Matrix33& A, + /// TODO + template + void +-jacobiSVD (const IMATH_INTERNAL_NAMESPACE::Matrix44& A, +- IMATH_INTERNAL_NAMESPACE::Matrix44& U, +- IMATH_INTERNAL_NAMESPACE::Vec4& S, +- IMATH_INTERNAL_NAMESPACE::Matrix44& V, +- const T tol, +- const bool forcePositiveDeterminant) ++jacobiSVD ( ++ const IMATH_INTERNAL_NAMESPACE::Matrix44& A, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& U, ++ IMATH_INTERNAL_NAMESPACE::Vec4& S, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& V, ++ const T tol, ++ const bool forcePositiveDeterminant) + { + twoSidedJacobiSVD (A, U, S, V, tol, forcePositiveDeterminant); + } + + /// TODO +-template IMATH_EXPORT void jacobiSVD (const IMATH_INTERNAL_NAMESPACE::Matrix33& A, +- IMATH_INTERNAL_NAMESPACE::Matrix33& U, +- IMATH_INTERNAL_NAMESPACE::Vec3& S, +- IMATH_INTERNAL_NAMESPACE::Matrix33& V, +- const float tol, +- const bool forcePositiveDeterminant); ++template IMATH_EXPORT void jacobiSVD ( ++ const IMATH_INTERNAL_NAMESPACE::Matrix33& A, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& U, ++ IMATH_INTERNAL_NAMESPACE::Vec3& S, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& V, ++ const float tol, ++ const bool forcePositiveDeterminant); + /// TODO +-template IMATH_EXPORT void jacobiSVD (const IMATH_INTERNAL_NAMESPACE::Matrix33& A, +- IMATH_INTERNAL_NAMESPACE::Matrix33& U, +- IMATH_INTERNAL_NAMESPACE::Vec3& S, +- IMATH_INTERNAL_NAMESPACE::Matrix33& V, +- const double tol, +- const bool forcePositiveDeterminant); ++template IMATH_EXPORT void jacobiSVD ( ++ const IMATH_INTERNAL_NAMESPACE::Matrix33& A, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& U, ++ IMATH_INTERNAL_NAMESPACE::Vec3& S, ++ IMATH_INTERNAL_NAMESPACE::Matrix33& V, ++ const double tol, ++ const bool forcePositiveDeterminant); + /// TODO +-template IMATH_EXPORT void jacobiSVD (const IMATH_INTERNAL_NAMESPACE::Matrix44& A, +- IMATH_INTERNAL_NAMESPACE::Matrix44& U, +- IMATH_INTERNAL_NAMESPACE::Vec4& S, +- IMATH_INTERNAL_NAMESPACE::Matrix44& V, +- const float tol, +- const bool forcePositiveDeterminant); ++template IMATH_EXPORT void jacobiSVD ( ++ const IMATH_INTERNAL_NAMESPACE::Matrix44& A, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& U, ++ IMATH_INTERNAL_NAMESPACE::Vec4& S, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& V, ++ const float tol, ++ const bool forcePositiveDeterminant); + /// TODO +-template IMATH_EXPORT void jacobiSVD (const IMATH_INTERNAL_NAMESPACE::Matrix44& A, +- IMATH_INTERNAL_NAMESPACE::Matrix44& U, +- IMATH_INTERNAL_NAMESPACE::Vec4& S, +- IMATH_INTERNAL_NAMESPACE::Matrix44& V, +- const double tol, +- const bool forcePositiveDeterminant); ++template IMATH_EXPORT void jacobiSVD ( ++ const IMATH_INTERNAL_NAMESPACE::Matrix44& A, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& U, ++ IMATH_INTERNAL_NAMESPACE::Vec4& S, ++ IMATH_INTERNAL_NAMESPACE::Matrix44& V, ++ const double tol, ++ const bool forcePositiveDeterminant); + + namespace + { + + template + inline void +-jacobiRotateRight (TM& A, const typename TM::BaseType s, const typename TM::BaseType tau) ++jacobiRotateRight ( ++ TM& A, const typename TM::BaseType s, const typename TM::BaseType tau) + { + typedef typename TM::BaseType T; + +- for (unsigned int i = 0; i < TM::dimensions(); ++i) ++ for (unsigned int i = 0; i < TM::dimensions (); ++i) + { + const T nu1 = A[i][j]; + const T nu2 = A[i][k]; +@@ -1006,7 +1021,8 @@ jacobiRotation (Matrix33& A, Matrix33& V, Vec3& Z, const T tol) + return false; + } + const T rho = mu1 / mu2; +- const T t = (rho < 0 ? T (-1) : T (1)) / (std::abs (rho) + std::sqrt (1 + rho * rho)); ++ const T t = (rho < 0 ? T (-1) : T (1)) / ++ (std::abs (rho) + std::sqrt (1 + rho * rho)); + const T c = T (1) / std::sqrt (T (1) + t * t); + const T s = t * c; + const T tau = s / (T (1) + c); +@@ -1024,12 +1040,12 @@ jacobiRotation (Matrix33& A, Matrix33& V, Vec3& Z, const T tol) + + // We only update upper triagnular elements of A, since + // A is supposed to be symmetric. +- T& offd1 = l < j ? A[l][j] : A[j][l]; +- T& offd2 = l < k ? A[l][k] : A[k][l]; +- const T nu1 = offd1; +- const T nu2 = offd2; +- offd1 = nu1 - s * (nu2 + tau * nu1); +- offd2 = nu2 + s * (nu1 - tau * nu2); ++ T& offd1 = l < j ? A[l][j] : A[j][l]; ++ T& offd2 = l < k ? A[l][k] : A[k][l]; ++ const T nu1 = offd1; ++ const T nu2 = offd2; ++ offd1 = nu1 - s * (nu2 + tau * nu1); ++ offd2 = nu2 + s * (nu1 - tau * nu2); + + // Apply rotation to V + jacobiRotateRight (V, s, tau); +@@ -1058,7 +1074,8 @@ jacobiRotation (Matrix44& A, Matrix44& V, Vec4& Z, const T tol) + } + + const T rho = mu1 / mu2; +- const T t = (rho < 0 ? T (-1) : T (1)) / (std::abs (rho) + std::sqrt (1 + rho * rho)); ++ const T t = (rho < 0 ? T (-1) : T (1)) / ++ (std::abs (rho) + std::sqrt (1 + rho * rho)); + const T c = T (1) / std::sqrt (T (1) + t * t); + const T s = c * t; + const T tau = s / (T (1) + c); +@@ -1071,19 +1088,19 @@ jacobiRotation (Matrix44& A, Matrix44& V, Vec4& Z, const T tol) + A[j][k] = 0; + + { +- T& offd1 = l1 < j ? A[l1][j] : A[j][l1]; +- T& offd2 = l1 < k ? A[l1][k] : A[k][l1]; +- const T nu1 = offd1; +- const T nu2 = offd2; ++ T& offd1 = l1 < j ? A[l1][j] : A[j][l1]; ++ T& offd2 = l1 < k ? A[l1][k] : A[k][l1]; ++ const T nu1 = offd1; ++ const T nu2 = offd2; + offd1 -= s * (nu2 + tau * nu1); + offd2 += s * (nu1 - tau * nu2); + } + + { +- T& offd1 = l2 < j ? A[l2][j] : A[j][l2]; +- T& offd2 = l2 < k ? A[l2][k] : A[k][l2]; +- const T nu1 = offd1; +- const T nu2 = offd2; ++ T& offd1 = l2 < j ? A[l2][j] : A[j][l2]; ++ T& offd2 = l2 < k ? A[l2][k] : A[k][l2]; ++ const T nu1 = offd1; ++ const T nu2 = offd2; + offd1 -= s * (nu2 + tau * nu1); + offd2 += s * (nu1 - tau * nu2); + } +@@ -1098,9 +1115,9 @@ IMATH_CONSTEXPR14 inline typename TM::BaseType + maxOffDiagSymm (const TM& A) + { + typedef typename TM::BaseType T; +- T result = 0; +- for (unsigned int i = 0; i < TM::dimensions(); ++i) +- for (unsigned int j = i + 1; j < TM::dimensions(); ++j) ++ T result = 0; ++ for (unsigned int i = 0; i < TM::dimensions (); ++i) ++ for (unsigned int j = i + 1; j < TM::dimensions (); ++j) + result = std::max (result, std::abs (A[i][j])); + + return result; +@@ -1112,15 +1129,17 @@ template + void + jacobiEigenSolver (Matrix33& A, Vec3& S, Matrix33& V, const T tol) + { +- V.makeIdentity(); ++ V.makeIdentity (); + for (int i = 0; i < 3; ++i) + { + S[i] = A[i][i]; + } + +- const int maxIter = 20; // In case we get really unlucky, prevents infinite loops +- const T absTol = tol * maxOffDiagSymm (A); // Tolerance is in terms of the maximum +- if (absTol != 0) // _off-diagonal_ entry. ++ const int maxIter = ++ 20; // In case we get really unlucky, prevents infinite loops ++ const T absTol = ++ tol * maxOffDiagSymm (A); // Tolerance is in terms of the maximum ++ if (absTol != 0) // _off-diagonal_ entry. + { + int numIter = 0; + do +@@ -1141,8 +1160,7 @@ jacobiEigenSolver (Matrix33& A, Vec3& S, Matrix33& V, const T tol) + { + A[i][i] = S[i] += Z[i]; + } +- if (!changed) +- break; ++ if (!changed) break; + } while (maxOffDiagSymm (A) > absTol && numIter < maxIter); + } + } +@@ -1151,34 +1169,35 @@ template + void + jacobiEigenSolver (Matrix44& A, Vec4& S, Matrix44& V, const T tol) + { +- V.makeIdentity(); ++ V.makeIdentity (); + + for (int i = 0; i < 4; ++i) + { + S[i] = A[i][i]; + } + +- const int maxIter = 20; // In case we get really unlucky, prevents infinite loops +- const T absTol = tol * maxOffDiagSymm (A); // Tolerance is in terms of the maximum +- if (absTol != 0) // _off-diagonal_ entry. ++ const int maxIter = ++ 20; // In case we get really unlucky, prevents infinite loops ++ const T absTol = ++ tol * maxOffDiagSymm (A); // Tolerance is in terms of the maximum ++ if (absTol != 0) // _off-diagonal_ entry. + { + int numIter = 0; + do + { + ++numIter; + Vec4 Z (0, 0, 0, 0); +- bool changed = jacobiRotation<0, 1, 2, 3> (A, V, Z, tol); +- changed = jacobiRotation<0, 2, 1, 3> (A, V, Z, tol) || changed; +- changed = jacobiRotation<0, 3, 1, 2> (A, V, Z, tol) || changed; +- changed = jacobiRotation<1, 2, 0, 3> (A, V, Z, tol) || changed; +- changed = jacobiRotation<1, 3, 0, 2> (A, V, Z, tol) || changed; +- changed = jacobiRotation<2, 3, 0, 1> (A, V, Z, tol) || changed; ++ bool changed = jacobiRotation<0, 1, 2, 3> (A, V, Z, tol); ++ changed = jacobiRotation<0, 2, 1, 3> (A, V, Z, tol) || changed; ++ changed = jacobiRotation<0, 3, 1, 2> (A, V, Z, tol) || changed; ++ changed = jacobiRotation<1, 2, 0, 3> (A, V, Z, tol) || changed; ++ changed = jacobiRotation<1, 3, 0, 2> (A, V, Z, tol) || changed; ++ changed = jacobiRotation<2, 3, 0, 1> (A, V, Z, tol) || changed; + for (int i = 0; i < 4; ++i) + { + A[i][i] = S[i] += Z[i]; + } +- if (!changed) +- break; ++ if (!changed) break; + } while (maxOffDiagSymm (A) > absTol && numIter < maxIter); + } + } +@@ -1192,13 +1211,12 @@ maxEigenVector (TM& A, TV& V) + jacobiEigenSolver (A, S, MV); + + int maxIdx (0); +- for (unsigned int i = 1; i < TV::dimensions(); ++i) ++ for (unsigned int i = 1; i < TV::dimensions (); ++i) + { +- if (std::abs (S[i]) > std::abs (S[maxIdx])) +- maxIdx = i; ++ if (std::abs (S[i]) > std::abs (S[maxIdx])) maxIdx = i; + } + +- for (unsigned int i = 0; i < TV::dimensions(); ++i) ++ for (unsigned int i = 0; i < TV::dimensions (); ++i) + V[i] = MV[i][maxIdx]; + } + +@@ -1211,35 +1229,43 @@ minEigenVector (TM& A, TV& V) + jacobiEigenSolver (A, S, MV); + + int minIdx (0); +- for (unsigned int i = 1; i < TV::dimensions(); ++i) ++ for (unsigned int i = 1; i < TV::dimensions (); ++i) + { +- if (std::abs (S[i]) < std::abs (S[minIdx])) +- minIdx = i; ++ if (std::abs (S[i]) < std::abs (S[minIdx])) minIdx = i; + } + +- for (unsigned int i = 0; i < TV::dimensions(); ++i) ++ for (unsigned int i = 0; i < TV::dimensions (); ++i) + V[i] = MV[i][minIdx]; + } + +-template IMATH_EXPORT void +-jacobiEigenSolver (Matrix33& A, Vec3& S, Matrix33& V, const float tol); +-template IMATH_EXPORT void +-jacobiEigenSolver (Matrix33& A, Vec3& S, Matrix33& V, const double tol); +-template IMATH_EXPORT void +-jacobiEigenSolver (Matrix44& A, Vec4& S, Matrix44& V, const float tol); +-template IMATH_EXPORT void +-jacobiEigenSolver (Matrix44& A, Vec4& S, Matrix44& V, const double tol); ++template IMATH_EXPORT void jacobiEigenSolver ( ++ Matrix33& A, Vec3& S, Matrix33& V, const float tol); ++template IMATH_EXPORT void jacobiEigenSolver ( ++ Matrix33& A, ++ Vec3& S, ++ Matrix33& V, ++ const double tol); ++template IMATH_EXPORT void jacobiEigenSolver ( ++ Matrix44& A, Vec4& S, Matrix44& V, const float tol); ++template IMATH_EXPORT void jacobiEigenSolver ( ++ Matrix44& A, ++ Vec4& S, ++ Matrix44& V, ++ const double tol); + + template IMATH_EXPORT void maxEigenVector (Matrix33& A, Vec3& S); + template IMATH_EXPORT void maxEigenVector (Matrix44& A, Vec4& S); +-template IMATH_EXPORT void maxEigenVector (Matrix33& A, Vec3& S); +-template IMATH_EXPORT void maxEigenVector (Matrix44& A, Vec4& S); ++template IMATH_EXPORT void ++maxEigenVector (Matrix33& A, Vec3& S); ++template IMATH_EXPORT void ++maxEigenVector (Matrix44& A, Vec4& S); + + template IMATH_EXPORT void minEigenVector (Matrix33& A, Vec3& S); + template IMATH_EXPORT void minEigenVector (Matrix44& A, Vec4& S); +-template IMATH_EXPORT void minEigenVector (Matrix33& A, Vec3& S); +-template IMATH_EXPORT void minEigenVector (Matrix44& A, Vec4& S); +- ++template IMATH_EXPORT void ++minEigenVector (Matrix33& A, Vec3& S); ++template IMATH_EXPORT void ++minEigenVector (Matrix44& A, Vec4& S); + + IMATH_INTERNAL_NAMESPACE_SOURCE_EXIT + +diff --git a/src/Imath/ImathMatrixAlgo.h b/src/Imath/ImathMatrixAlgo.h +index a788af8..cea305b 100644 +--- a/src/Imath/ImathMatrixAlgo.h ++++ b/src/Imath/ImathMatrixAlgo.h +@@ -87,19 +87,21 @@ IMATH_EXPORT_CONST M44d identity44d; + // Declarations for 4x4 matrix. + // + +-/// Extract the scaling component of the given 4x4 matrix. ++/// Extract the scaling component of the given 4x4 matrix. + /// + /// @param[in] mat The input matrix + /// @param[out] scl The extracted scale, i.e. the output value + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the scale could be extracted, false if the matrix is degenerate. +-template bool extractScaling (const Matrix44& mat, Vec3& scl, bool exc = true); ++template ++bool extractScaling (const Matrix44& mat, Vec3& scl, bool exc = true); + + /// Return the given 4x4 matrix with scaling removed. + /// + /// @param[in] mat The input matrix + /// @param[in] exc If true, throw an exception if the scaling in `mat` +-template Matrix44 sansScaling (const Matrix44& mat, bool exc = true); ++template ++Matrix44 sansScaling (const Matrix44& mat, bool exc = true); + + /// Remove scaling from the given 4x4 matrix in place. Return true if the + /// scale could be successfully extracted, false if the matrix is +@@ -119,13 +121,16 @@ template bool removeScaling (Matrix44& mat, bool exc = true); + /// @param[out] shr The extracted shear + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the scale could be extracted, false if the matrix is degenerate. +-template bool extractScalingAndShear (const Matrix44& mat, Vec3& scl, Vec3& shr, bool exc = true); ++template ++bool extractScalingAndShear ( ++ const Matrix44& mat, Vec3& scl, Vec3& shr, bool exc = true); + + /// Return the given 4x4 matrix with scaling and shear removed. + /// + /// @param[in] mat The input matrix + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. +-template Matrix44 sansScalingAndShear (const Matrix44& mat, bool exc = true); ++template ++Matrix44 sansScalingAndShear (const Matrix44& mat, bool exc = true); + + /// Extract scaling and shear from the given 4x4 matrix in-place. + /// +@@ -133,14 +138,16 @@ template Matrix44 sansScalingAndShear (const Matrix44& mat, bool + /// @param[in] mat The return value if `result` is degenerate + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + template +-void sansScalingAndShear (Matrix44& result, const Matrix44& mat, bool exc = true); ++void sansScalingAndShear ( ++ Matrix44& result, const Matrix44& mat, bool exc = true); + + /// Remove scaling and shear from the given 4x4 matrix in place. + // + /// @param[in,out] mat The matrix to operate on + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the scale could be extracted, false if the matrix is degenerate. +-template bool removeScalingAndShear (Matrix44& mat, bool exc = true); ++template ++bool removeScalingAndShear (Matrix44& mat, bool exc = true); + + /// Remove scaling and shear from the given 4x4 matrix in place, returning + /// the extracted values. +@@ -151,8 +158,8 @@ template bool removeScalingAndShear (Matrix44& mat, bool exc = true + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the scale could be extracted, false if the matrix is degenerate. + template +-bool +-extractAndRemoveScalingAndShear (Matrix44& mat, Vec3& scl, Vec3& shr, bool exc = true); ++bool extractAndRemoveScalingAndShear ( ++ Matrix44& mat, Vec3& scl, Vec3& shr, bool exc = true); + + /// Extract the rotation from the given 4x4 matrix in the form of XYZ + /// euler angles. +@@ -185,16 +192,17 @@ template Quat extractQuat (const Matrix44& mat); + /// @param[out] r The extracted rotation + /// @param[out] t The extracted translation + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. +-/// @param[in] rOrder The order with which to extract the rotation ++/// @param[in] rOrder The order with which to extract the rotation + /// @return True if the values could be extracted, false if the matrix is degenerate. + template +-bool extractSHRT (const Matrix44& mat, +- Vec3& s, +- Vec3& h, +- Vec3& r, +- Vec3& t, +- bool exc /*= true*/, +- typename Euler::Order rOrder); ++bool extractSHRT ( ++ const Matrix44& mat, ++ Vec3& s, ++ Vec3& h, ++ Vec3& r, ++ Vec3& t, ++ bool exc /*= true*/, ++ typename Euler::Order rOrder); + + /// Extract the scaling, shear, rotation, and translation components + /// of the given 4x4 matrix. +@@ -207,12 +215,13 @@ bool extractSHRT (const Matrix44& mat, + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the values could be extracted, false if the matrix is degenerate. + template +-bool extractSHRT (const Matrix44& mat, +- Vec3& s, +- Vec3& h, +- Vec3& r, +- Vec3& t, +- bool exc = true); ++bool extractSHRT ( ++ const Matrix44& mat, ++ Vec3& s, ++ Vec3& h, ++ Vec3& r, ++ Vec3& t, ++ bool exc = true); + + /// Extract the scaling, shear, rotation, and translation components + /// of the given 4x4 matrix. +@@ -225,26 +234,30 @@ bool extractSHRT (const Matrix44& mat, + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the values could be extracted, false if the matrix is degenerate. + template +-bool extractSHRT (const Matrix44& mat, +- Vec3& s, +- Vec3& h, +- Euler& r, +- Vec3& t, +- bool exc = true); ++bool extractSHRT ( ++ const Matrix44& mat, ++ Vec3& s, ++ Vec3& h, ++ Euler& r, ++ Vec3& t, ++ bool exc = true); + + /// Return true if the given scale can be removed from the given row + /// matrix, false if `scl` is small enough that the operation would + /// overflow. If `exc` is true, throw an exception on overflow. +-template bool checkForZeroScaleInRow (const T& scl, const Vec3& row, bool exc = true); ++template ++bool checkForZeroScaleInRow (const T& scl, const Vec3& row, bool exc = true); + + /// Return the 4x4 outer product two 4-vectors +-template Matrix44 outerProduct (const Vec4& a, const Vec4& b); ++template ++Matrix44 outerProduct (const Vec4& a, const Vec4& b); + + /// + /// Return a 4x4 matrix that rotates the vector `fromDirection` to `toDirection` + /// + template +-Matrix44 rotationMatrix (const Vec3& fromDirection, const Vec3& toDirection); ++Matrix44 ++rotationMatrix (const Vec3& fromDirection, const Vec3& toDirection); + + /// + /// Return a 4x4 matrix that rotates the `fromDir` vector +@@ -252,8 +265,8 @@ Matrix44 rotationMatrix (const Vec3& fromDirection, const Vec3& toDirec + /// specify that you want the up vector to be pointing + /// in a certain direction 1upDir`. + template +-Matrix44 +-rotationMatrixWithUpDir (const Vec3& fromDir, const Vec3& toDir, const Vec3& upDir); ++Matrix44 rotationMatrixWithUpDir ( ++ const Vec3& fromDir, const Vec3& toDir, const Vec3& upDir); + + /// + /// Construct a 4x4 matrix that rotates the z-axis so that it points +@@ -269,7 +282,8 @@ rotationMatrixWithUpDir (const Vec3& fromDir, const Vec3& toDir, const Vec + /// @param[in] targetDir The target direction vector + /// @param[in] upDir The up direction vector + template +-void alignZAxisWithTargetDir (Matrix44& result, Vec3 targetDir, Vec3 upDir); ++void ++alignZAxisWithTargetDir (Matrix44& result, Vec3 targetDir, Vec3 upDir); + + /// Compute an orthonormal direct 4x4 frame from a position, an x axis + /// direction and a normal to the y axis. If the x axis and normal are +@@ -281,11 +295,12 @@ void alignZAxisWithTargetDir (Matrix44& result, Vec3 targetDir, Vec3 up + /// @param[in] normal A normal to the y axis of the frame + /// @return The orthonormal frame + template +-Matrix44 computeLocalFrame (const Vec3& p, const Vec3& xDir, const Vec3& normal); ++Matrix44 computeLocalFrame ( ++ const Vec3& p, const Vec3& xDir, const Vec3& normal); + + /// Add a translate/rotate/scale offset to a 4x4 input frame + /// and put it in another frame of reference +-/// ++/// + /// @param[in] inMat Input frame + /// @param[in] tOffset Translation offset + /// @param[in] rOffset Rotation offset in degrees +@@ -293,41 +308,47 @@ Matrix44 computeLocalFrame (const Vec3& p, const Vec3& xDir, const Vec3 + /// @param[in] ref Frame of reference + /// @return The offsetted frame + template +-Matrix44 addOffset (const Matrix44& inMat, +- const Vec3& tOffset, +- const Vec3& rOffset, +- const Vec3& sOffset, +- const Vec3& ref); ++Matrix44 addOffset ( ++ const Matrix44& inMat, ++ const Vec3& tOffset, ++ const Vec3& rOffset, ++ const Vec3& sOffset, ++ const Vec3& ref); + + /// Compute 4x4 translate/rotate/scale matrix from `A` with the + /// rotate/scale of `B`. +-/// ++/// + /// @param[in] keepRotateA If true, keep rotate from matrix `A`, use `B` otherwise + /// @param[in] keepScaleA If true, keep scale from matrix `A`, use `B` otherwise + /// @param[in] A Matrix A + /// @param[in] B Matrix B + /// @return Matrix `A` with tweaked rotation/scale + template +-Matrix44 +-computeRSMatrix (bool keepRotateA, bool keepScaleA, const Matrix44& A, const Matrix44& B); ++Matrix44 computeRSMatrix ( ++ bool keepRotateA, ++ bool keepScaleA, ++ const Matrix44& A, ++ const Matrix44& B); + + // + // Declarations for 3x3 matrix. + // + +-/// Extract the scaling component of the given 3x3 matrix. ++/// Extract the scaling component of the given 3x3 matrix. + /// + /// @param[in] mat The input matrix + /// @param[out] scl The extracted scale, i.e. the output value + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the scale could be extracted, false if the matrix is degenerate. +-template bool extractScaling (const Matrix33& mat, Vec2& scl, bool exc = true); ++template ++bool extractScaling (const Matrix33& mat, Vec2& scl, bool exc = true); + + /// Return the given 3x3 matrix with scaling removed. + /// + /// @param[in] mat The input matrix + /// @param[in] exc If true, throw an exception if the scaling in `mat` +-template Matrix33 sansScaling (const Matrix33& mat, bool exc = true); ++template ++Matrix33 sansScaling (const Matrix33& mat, bool exc = true); + + /// Remove scaling from the given 3x3 matrix in place. Return true if the + /// scale could be successfully extracted, false if the matrix is +@@ -348,21 +369,23 @@ template bool removeScaling (Matrix33& mat, bool exc = true); + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the scale could be extracted, false if the matrix is degenerate. + template +-bool extractScalingAndShear (const Matrix33& mat, Vec2& scl, T& shr, bool exc = true); ++bool extractScalingAndShear ( ++ const Matrix33& mat, Vec2& scl, T& shr, bool exc = true); + + /// Return the given 3x3 matrix with scaling and shear removed. + /// + /// @param[in] mat The input matrix + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. +-template Matrix33 sansScalingAndShear (const Matrix33& mat, bool exc = true); +- ++template ++Matrix33 sansScalingAndShear (const Matrix33& mat, bool exc = true); + + /// Remove scaling and shear from the given 3x3e matrix in place. + // + /// @param[in,out] mat The matrix to operate on + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the scale could be extracted, false if the matrix is degenerate. +-template bool removeScalingAndShear (Matrix33& mat, bool exc = true); ++template ++bool removeScalingAndShear (Matrix33& mat, bool exc = true); + + /// Remove scaling and shear from the given 3x3 matrix in place, returning + /// the extracted values. +@@ -373,7 +396,8 @@ template bool removeScalingAndShear (Matrix33& mat, bool exc = true + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the scale could be extracted, false if the matrix is degenerate. + template +-bool extractAndRemoveScalingAndShear (Matrix33& mat, Vec2& scl, T& shr, bool exc = true); ++bool extractAndRemoveScalingAndShear ( ++ Matrix33& mat, Vec2& scl, T& shr, bool exc = true); + + /// Extract the rotation from the given 2x2 matrix + /// +@@ -400,15 +424,23 @@ template void extractEuler (const Matrix33& mat, T& rot); + /// @param[in] exc If true, throw an exception if the scaling in `mat` is very close to zero. + /// @return True if the values could be extracted, false if the matrix is degenerate. + template +-bool extractSHRT (const Matrix33& mat, Vec2& s, T& h, T& r, Vec2& t, bool exc = true); ++bool extractSHRT ( ++ const Matrix33& mat, ++ Vec2& s, ++ T& h, ++ T& r, ++ Vec2& t, ++ bool exc = true); + + /// Return true if the given scale can be removed from the given row + /// matrix, false if `scl` is small enough that the operation would + /// overflow. If `exc` is true, throw an exception on overflow. +-template bool checkForZeroScaleInRow (const T& scl, const Vec2& row, bool exc = true); ++template ++bool checkForZeroScaleInRow (const T& scl, const Vec2& row, bool exc = true); + + /// Return the 3xe outer product two 3-vectors +-template Matrix33 outerProduct (const Vec3& a, const Vec3& b); ++template ++Matrix33 outerProduct (const Vec3& a, const Vec3& b); + + //------------------------------ + // Implementation for 4x4 Matrix +@@ -418,11 +450,10 @@ template + bool + extractScaling (const Matrix44& mat, Vec3& scl, bool exc) + { +- Vec3 shr; ++ Vec3 shr; + Matrix44 M (mat); + +- if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) +- return false; ++ if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) return false; + + return true; + } +@@ -436,8 +467,7 @@ sansScaling (const Matrix44& mat, bool exc) + Vec3 rot; + Vec3 tran; + +- if (!extractSHRT (mat, scl, shr, rot, tran, exc)) +- return mat; ++ if (!extractSHRT (mat, scl, shr, rot, tran, exc)) return mat; + + Matrix44 M; + +@@ -457,10 +487,9 @@ removeScaling (Matrix44& mat, bool exc) + Vec3 rot; + Vec3 tran; + +- if (!extractSHRT (mat, scl, shr, rot, tran, exc)) +- return false; ++ if (!extractSHRT (mat, scl, shr, rot, tran, exc)) return false; + +- mat.makeIdentity(); ++ mat.makeIdentity (); + mat.translate (tran); + mat.rotate (rot); + mat.shear (shr); +@@ -470,12 +499,12 @@ removeScaling (Matrix44& mat, bool exc) + + template + bool +-extractScalingAndShear (const Matrix44& mat, Vec3& scl, Vec3& shr, bool exc) ++extractScalingAndShear ( ++ const Matrix44& mat, Vec3& scl, Vec3& shr, bool exc) + { + Matrix44 M (mat); + +- if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) +- return false; ++ if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) return false; + + return true; + } +@@ -484,12 +513,11 @@ template + Matrix44 + sansScalingAndShear (const Matrix44& mat, bool exc) + { +- Vec3 scl; +- Vec3 shr; ++ Vec3 scl; ++ Vec3 shr; + Matrix44 M (mat); + +- if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) +- return mat; ++ if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) return mat; + + return M; + } +@@ -501,8 +529,7 @@ sansScalingAndShear (Matrix44& result, const Matrix44& mat, bool exc) + Vec3 scl; + Vec3 shr; + +- if (!extractAndRemoveScalingAndShear (result, scl, shr, exc)) +- result = mat; ++ if (!extractAndRemoveScalingAndShear (result, scl, shr, exc)) result = mat; + } + + template +@@ -512,15 +539,15 @@ removeScalingAndShear (Matrix44& mat, bool exc) + Vec3 scl; + Vec3 shr; + +- if (!extractAndRemoveScalingAndShear (mat, scl, shr, exc)) +- return false; ++ if (!extractAndRemoveScalingAndShear (mat, scl, shr, exc)) return false; + + return true; + } + + template + bool +-extractAndRemoveScalingAndShear (Matrix44& mat, Vec3& scl, Vec3& shr, bool exc) ++extractAndRemoveScalingAndShear ( ++ Matrix44& mat, Vec3& scl, Vec3& shr, bool exc) + { + // + // This implementation follows the technique described in the paper by +@@ -558,9 +585,8 @@ extractAndRemoveScalingAndShear (Matrix44& mat, Vec3& scl, Vec3& shr, b + } + + // Compute X scale factor. +- scl.x = row[0].length(); +- if (!checkForZeroScaleInRow (scl.x, row[0], exc)) +- return false; ++ scl.x = row[0].length (); ++ if (!checkForZeroScaleInRow (scl.x, row[0], exc)) return false; + + // Normalize first row. + row[0] /= scl.x; +@@ -580,9 +606,8 @@ extractAndRemoveScalingAndShear (Matrix44& mat, Vec3& scl, Vec3& shr, b + row[1] -= shr[0] * row[0]; + + // Now, compute Y scale. +- scl.y = row[1].length(); +- if (!checkForZeroScaleInRow (scl.y, row[1], exc)) +- return false; ++ scl.y = row[1].length (); ++ if (!checkForZeroScaleInRow (scl.y, row[1], exc)) return false; + + // Normalize 2nd row and correct the XY shear factor for Y scaling. + row[1] /= scl.y; +@@ -595,9 +620,8 @@ extractAndRemoveScalingAndShear (Matrix44& mat, Vec3& scl, Vec3& shr, b + row[2] -= shr[2] * row[1]; + + // Next, get Z scale. +- scl.z = row[2].length(); +- if (!checkForZeroScaleInRow (scl.z, row[2], exc)) +- return false; ++ scl.z = row[2].length (); ++ if (!checkForZeroScaleInRow (scl.z, row[2], exc)) return false; + + // Normalize 3rd row and correct the XZ and YZ shear factors for Z scaling. + row[2] /= scl.z; +@@ -643,11 +667,27 @@ extractEulerXYZ (const Matrix44& mat, Vec3& rot) + Vec3 j (mat[1][0], mat[1][1], mat[1][2]); + Vec3 k (mat[2][0], mat[2][1], mat[2][2]); + +- i.normalize(); +- j.normalize(); +- k.normalize(); +- +- Matrix44 M (i[0], i[1], i[2], 0, j[0], j[1], j[2], 0, k[0], k[1], k[2], 0, 0, 0, 0, 1); ++ i.normalize (); ++ j.normalize (); ++ k.normalize (); ++ ++ Matrix44 M ( ++ i[0], ++ i[1], ++ i[2], ++ 0, ++ j[0], ++ j[1], ++ j[2], ++ 0, ++ k[0], ++ k[1], ++ k[2], ++ 0, ++ 0, ++ 0, ++ 0, ++ 1); + + // + // Extract the first angle, rot.x. +@@ -686,11 +726,27 @@ extractEulerZYX (const Matrix44& mat, Vec3& rot) + Vec3 j (mat[1][0], mat[1][1], mat[1][2]); + Vec3 k (mat[2][0], mat[2][1], mat[2][2]); + +- i.normalize(); +- j.normalize(); +- k.normalize(); +- +- Matrix44 M (i[0], i[1], i[2], 0, j[0], j[1], j[2], 0, k[0], k[1], k[2], 0, 0, 0, 0, 1); ++ i.normalize (); ++ j.normalize (); ++ k.normalize (); ++ ++ Matrix44 M ( ++ i[0], ++ i[1], ++ i[2], ++ 0, ++ j[0], ++ j[1], ++ j[2], ++ 0, ++ k[0], ++ k[1], ++ k[2], ++ 0, ++ 0, ++ 0, ++ 0, ++ 1); + + // + // Extract the first angle, rot.x. +@@ -723,12 +779,12 @@ extractQuat (const Matrix44& mat) + { + Matrix44 rot; + +- T tr, s; +- T q[4]; +- int i, j, k; ++ T tr, s; ++ T q[4]; ++ int i, j, k; + Quat quat; + +- int nxt[3] = { 1, 2, 0 }; ++ int nxt[3] = {1, 2, 0}; + tr = mat[0][0] + mat[1][1] + mat[2][2]; + + // check the diagonal +@@ -746,18 +802,15 @@ extractQuat (const Matrix44& mat) + { + // diagonal is negative + i = 0; +- if (mat[1][1] > mat[0][0]) +- i = 1; +- if (mat[2][2] > mat[i][i]) +- i = 2; ++ if (mat[1][1] > mat[0][0]) i = 1; ++ if (mat[2][2] > mat[i][i]) i = 2; + + j = nxt[i]; + k = nxt[j]; + s = std::sqrt ((mat[i][i] - (mat[j][j] + mat[k][k])) + T (1.0)); + + q[i] = s * T (0.5); +- if (s != T (0.0)) +- s = T (0.5) / s; ++ if (s != T (0.0)) s = T (0.5) / s; + + q[3] = (mat[j][k] - mat[k][j]) * s; + q[j] = (mat[i][j] + mat[j][i]) * s; +@@ -774,19 +827,19 @@ extractQuat (const Matrix44& mat) + + template + bool +-extractSHRT (const Matrix44& mat, +- Vec3& s, +- Vec3& h, +- Vec3& r, +- Vec3& t, +- bool exc /* = true */, +- typename Euler::Order rOrder /* = Euler::XYZ */) ++extractSHRT ( ++ const Matrix44& mat, ++ Vec3& s, ++ Vec3& h, ++ Vec3& r, ++ Vec3& t, ++ bool exc /* = true */, ++ typename Euler::Order rOrder /* = Euler::XYZ */) + { + Matrix44 rot; + + rot = mat; +- if (!extractAndRemoveScalingAndShear (rot, s, h, exc)) +- return false; ++ if (!extractAndRemoveScalingAndShear (rot, s, h, exc)) return false; + + extractEulerXYZ (rot, r); + +@@ -798,7 +851,7 @@ extractSHRT (const Matrix44& mat, + { + Euler eXYZ (r, Euler::XYZ); + Euler e (eXYZ, rOrder); +- r = e.toXYZVector(); ++ r = e.toXYZVector (); + } + + return true; +@@ -806,21 +859,28 @@ extractSHRT (const Matrix44& mat, + + template + bool +-extractSHRT (const Matrix44& mat, Vec3& s, Vec3& h, Vec3& r, Vec3& t, bool exc) ++extractSHRT ( ++ const Matrix44& mat, ++ Vec3& s, ++ Vec3& h, ++ Vec3& r, ++ Vec3& t, ++ bool exc) + { + return extractSHRT (mat, s, h, r, t, exc, Euler::XYZ); + } + + template + bool +-extractSHRT (const Matrix44& mat, +- Vec3& s, +- Vec3& h, +- Euler& r, +- Vec3& t, +- bool exc /* = true */) ++extractSHRT ( ++ const Matrix44& mat, ++ Vec3& s, ++ Vec3& h, ++ Euler& r, ++ Vec3& t, ++ bool exc /* = true */) + { +- return extractSHRT (mat, s, h, r, t, exc, r.order()); ++ return extractSHRT (mat, s, h, r, t, exc, r.order ()); + } + + template +@@ -829,7 +889,8 @@ checkForZeroScaleInRow (const T& scl, const Vec3& row, bool exc /* = true */) + { + for (int i = 0; i < 3; i++) + { +- if ((abs (scl) < 1 && abs (row[i]) >= std::numeric_limits::max() * abs (scl))) ++ if ((abs (scl) < 1 && ++ abs (row[i]) >= std::numeric_limits::max () * abs (scl))) + { + if (exc) + throw std::domain_error ("Cannot remove zero scaling " +@@ -846,22 +907,23 @@ template + Matrix44 + outerProduct (const Vec4& a, const Vec4& b) + { +- return Matrix44 (a.x * b.x, +- a.x * b.y, +- a.x * b.z, +- a.x * b.w, +- a.y * b.x, +- a.y * b.y, +- a.y * b.z, +- a.x * b.w, +- a.z * b.x, +- a.z * b.y, +- a.z * b.z, +- a.x * b.w, +- a.w * b.x, +- a.w * b.y, +- a.w * b.z, +- a.w * b.w); ++ return Matrix44 ( ++ a.x * b.x, ++ a.x * b.y, ++ a.x * b.z, ++ a.x * b.w, ++ a.y * b.x, ++ a.y * b.y, ++ a.y * b.z, ++ a.x * b.w, ++ a.z * b.x, ++ a.z * b.y, ++ a.z * b.z, ++ a.x * b.w, ++ a.w * b.x, ++ a.w * b.y, ++ a.w * b.z, ++ a.w * b.w); + } + + template +@@ -870,12 +932,13 @@ rotationMatrix (const Vec3& from, const Vec3& to) + { + Quat q; + q.setRotation (from, to); +- return q.toMatrix44(); ++ return q.toMatrix44 (); + } + + template + Matrix44 +-rotationMatrixWithUpDir (const Vec3& fromDir, const Vec3& toDir, const Vec3& upDir) ++rotationMatrixWithUpDir ( ++ const Vec3& fromDir, const Vec3& toDir, const Vec3& upDir) + { + // + // The goal is to obtain a rotation matrix that takes +@@ -886,15 +949,15 @@ rotationMatrixWithUpDir (const Vec3& fromDir, const Vec3& toDir, const Vec + // + + // The from direction must be non-zero; but we allow zero to and up dirs. +- if (fromDir.length() == 0) +- return Matrix44(); ++ if (fromDir.length () == 0) ++ return Matrix44 (); + + else + { + Matrix44 zAxis2FromDir (UNINITIALIZED); + alignZAxisWithTargetDir (zAxis2FromDir, fromDir, Vec3 (0, 1, 0)); + +- Matrix44 fromDir2zAxis = zAxis2FromDir.transposed(); ++ Matrix44 fromDir2zAxis = zAxis2FromDir.transposed (); + + Matrix44 zAxis2ToDir (UNINITIALIZED); + alignZAxisWithTargetDir (zAxis2ToDir, toDir, upDir); +@@ -911,15 +974,13 @@ alignZAxisWithTargetDir (Matrix44& result, Vec3 targetDir, Vec3 upDir) + // Ensure that the target direction is non-zero. + // + +- if (targetDir.length() == 0) +- targetDir = Vec3 (0, 0, 1); ++ if (targetDir.length () == 0) targetDir = Vec3 (0, 0, 1); + + // + // Ensure that the up direction is non-zero. + // + +- if (upDir.length() == 0) +- upDir = Vec3 (0, 1, 0); ++ if (upDir.length () == 0) upDir = Vec3 (0, 1, 0); + + // + // Check for degeneracies. If the upDir and targetDir are parallel +@@ -927,11 +988,10 @@ alignZAxisWithTargetDir (Matrix44& result, Vec3 targetDir, Vec3 upDir) + // not parallel or opposite to the targetDir. + // + +- if (upDir.cross (targetDir).length() == 0) ++ if (upDir.cross (targetDir).length () == 0) + { + upDir = targetDir.cross (Vec3 (1, 0, 0)); +- if (upDir.length() == 0) +- upDir = targetDir.cross (Vec3 (0, 0, 1)); ++ if (upDir.length () == 0) upDir = targetDir.cross (Vec3 (0, 0, 1)); + } + + // +@@ -948,9 +1008,9 @@ alignZAxisWithTargetDir (Matrix44& result, Vec3 targetDir, Vec3 upDir) + // + + Vec3 row[3]; +- row[0] = targetPerpDir.normalized(); +- row[1] = targetUpDir.normalized(); +- row[2] = targetDir.normalized(); ++ row[0] = targetPerpDir.normalized (); ++ row[1] = targetUpDir.normalized (); ++ row[2] = targetDir.normalized (); + + result.x[0][0] = row[0][0]; + result.x[0][1] = row[0][1]; +@@ -985,9 +1045,9 @@ Matrix44 + computeLocalFrame (const Vec3& p, const Vec3& xDir, const Vec3& normal) + { + Vec3 _xDir (xDir); +- Vec3 x = _xDir.normalize(); +- Vec3 y = (normal % x).normalize(); +- Vec3 z = (x % y).normalize(); ++ Vec3 x = _xDir.normalize (); ++ Vec3 y = (normal % x).normalize (); ++ Vec3 z = (x % y).normalize (); + + Matrix44 L; + L[0][0] = x[0]; +@@ -1024,11 +1084,12 @@ computeLocalFrame (const Vec3& p, const Vec3& xDir, const Vec3& normal) + /// @return The offsetted frame + template + Matrix44 +-addOffset (const Matrix44& inMat, +- const Vec3& tOffset, +- const Vec3& rOffset, +- const Vec3& sOffset, +- const Matrix44& ref) ++addOffset ( ++ const Matrix44& inMat, ++ const Vec3& tOffset, ++ const Vec3& rOffset, ++ const Vec3& sOffset, ++ const Matrix44& ref) + { + Matrix44 O; + +@@ -1057,7 +1118,11 @@ addOffset (const Matrix44& inMat, + // Return Matrix A with tweaked rotation/scale + template + Matrix44 +-computeRSMatrix (bool keepRotateA, bool keepScaleA, const Matrix44& A, const Matrix44& B) ++computeRSMatrix ( ++ bool keepRotateA, ++ bool keepScaleA, ++ const Matrix44& A, ++ const Matrix44& B) + { + Vec3 as, ah, ar, at; + extractSHRT (A, as, ah, ar, at); +@@ -1065,14 +1130,12 @@ computeRSMatrix (bool keepRotateA, bool keepScaleA, const Matrix44& A, const + Vec3 bs, bh, br, bt; + extractSHRT (B, bs, bh, br, bt); + +- if (!keepRotateA) +- ar = br; ++ if (!keepRotateA) ar = br; + +- if (!keepScaleA) +- as = bs; ++ if (!keepScaleA) as = bs; + + Matrix44 mat; +- mat.makeIdentity(); ++ mat.makeIdentity (); + mat.translate (at); + mat.rotate (ar); + mat.scale (as); +@@ -1088,11 +1151,10 @@ template + bool + extractScaling (const Matrix33& mat, Vec2& scl, bool exc) + { +- T shr; ++ T shr; + Matrix33 M (mat); + +- if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) +- return false; ++ if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) return false; + + return true; + } +@@ -1102,12 +1164,11 @@ Matrix33 + sansScaling (const Matrix33& mat, bool exc) + { + Vec2 scl; +- T shr; +- T rot; ++ T shr; ++ T rot; + Vec2 tran; + +- if (!extractSHRT (mat, scl, shr, rot, tran, exc)) +- return mat; ++ if (!extractSHRT (mat, scl, shr, rot, tran, exc)) return mat; + + Matrix33 M; + +@@ -1123,14 +1184,13 @@ bool + removeScaling (Matrix33& mat, bool exc) + { + Vec2 scl; +- T shr; +- T rot; ++ T shr; ++ T rot; + Vec2 tran; + +- if (!extractSHRT (mat, scl, shr, rot, tran, exc)) +- return false; ++ if (!extractSHRT (mat, scl, shr, rot, tran, exc)) return false; + +- mat.makeIdentity(); ++ mat.makeIdentity (); + mat.translate (tran); + mat.rotate (rot); + mat.shear (shr); +@@ -1144,8 +1204,7 @@ extractScalingAndShear (const Matrix33& mat, Vec2& scl, T& shr, bool exc) + { + Matrix33 M (mat); + +- if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) +- return false; ++ if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) return false; + + return true; + } +@@ -1154,12 +1213,11 @@ template + Matrix33 + sansScalingAndShear (const Matrix33& mat, bool exc) + { +- Vec2 scl; +- T shr; ++ Vec2 scl; ++ T shr; + Matrix33 M (mat); + +- if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) +- return mat; ++ if (!extractAndRemoveScalingAndShear (M, scl, shr, exc)) return mat; + + return M; + } +@@ -1169,17 +1227,17 @@ bool + removeScalingAndShear (Matrix33& mat, bool exc) + { + Vec2 scl; +- T shr; ++ T shr; + +- if (!extractAndRemoveScalingAndShear (mat, scl, shr, exc)) +- return false; ++ if (!extractAndRemoveScalingAndShear (mat, scl, shr, exc)) return false; + + return true; + } + + template + bool +-extractAndRemoveScalingAndShear (Matrix33& mat, Vec2& scl, T& shr, bool exc) ++extractAndRemoveScalingAndShear ( ++ Matrix33& mat, Vec2& scl, T& shr, bool exc) + { + Vec2 row[2]; + +@@ -1210,9 +1268,8 @@ extractAndRemoveScalingAndShear (Matrix33& mat, Vec2& scl, T& shr, bool ex + } + + // Compute X scale factor. +- scl.x = row[0].length(); +- if (!checkForZeroScaleInRow (scl.x, row[0], exc)) +- return false; ++ scl.x = row[0].length (); ++ if (!checkForZeroScaleInRow (scl.x, row[0], exc)) return false; + + // Normalize first row. + row[0] /= scl.x; +@@ -1231,9 +1288,8 @@ extractAndRemoveScalingAndShear (Matrix33& mat, Vec2& scl, T& shr, bool ex + row[1] -= shr * row[0]; + + // Now, compute Y scale. +- scl.y = row[1].length(); +- if (!checkForZeroScaleInRow (scl.y, row[1], exc)) +- return false; ++ scl.y = row[1].length (); ++ if (!checkForZeroScaleInRow (scl.y, row[1], exc)) return false; + + // Normalize 2nd row and correct the XY shear factor for Y scaling. + row[1] /= scl.y; +@@ -1275,8 +1331,8 @@ extractEuler (const Matrix22& mat, T& rot) + Vec2 i (mat[0][0], mat[0][1]); + Vec2 j (mat[1][0], mat[1][1]); + +- i.normalize(); +- j.normalize(); ++ i.normalize (); ++ j.normalize (); + + // + // Extract the angle, rot. +@@ -1296,8 +1352,8 @@ extractEuler (const Matrix33& mat, T& rot) + Vec2 i (mat[0][0], mat[0][1]); + Vec2 j (mat[1][0], mat[1][1]); + +- i.normalize(); +- j.normalize(); ++ i.normalize (); ++ j.normalize (); + + // + // Extract the angle, rot. +@@ -1308,13 +1364,13 @@ extractEuler (const Matrix33& mat, T& rot) + + template + bool +-extractSHRT (const Matrix33& mat, Vec2& s, T& h, T& r, Vec2& t, bool exc) ++extractSHRT ( ++ const Matrix33& mat, Vec2& s, T& h, T& r, Vec2& t, bool exc) + { + Matrix33 rot; + + rot = mat; +- if (!extractAndRemoveScalingAndShear (rot, s, h, exc)) +- return false; ++ if (!extractAndRemoveScalingAndShear (rot, s, h, exc)) return false; + + extractEuler (rot, r); + +@@ -1331,10 +1387,12 @@ checkForZeroScaleInRow (const T& scl, const Vec2& row, bool exc /* = true */) + { + for (int i = 0; i < 2; i++) + { +- if ((abs (scl) < 1 && abs (row[i]) >= std::numeric_limits::max() * abs (scl))) ++ if ((abs (scl) < 1 && ++ abs (row[i]) >= std::numeric_limits::max () * abs (scl))) + { + if (exc) +- throw std::domain_error ("Cannot remove zero scaling from matrix."); ++ throw std::domain_error ( ++ "Cannot remove zero scaling from matrix."); + else + return false; + } +@@ -1348,15 +1406,16 @@ template + Matrix33 + outerProduct (const Vec3& a, const Vec3& b) + { +- return Matrix33 (a.x * b.x, +- a.x * b.y, +- a.x * b.z, +- a.y * b.x, +- a.y * b.y, +- a.y * b.z, +- a.z * b.x, +- a.z * b.y, +- a.z * b.z); ++ return Matrix33 ( ++ a.x * b.x, ++ a.x * b.y, ++ a.x * b.z, ++ a.y * b.x, ++ a.y * b.y, ++ a.y * b.z, ++ a.z * b.x, ++ a.z * b.y, ++ a.z * b.z); + } + + /// Computes the translation and rotation that brings the 'from' points +@@ -1375,12 +1434,12 @@ outerProduct (const Vec3& a, const Vec3& b) + /// @param doScaling If true, include a scaling transformation + /// @return The procrustes transformation + template +-M44d +-procrustesRotationAndTranslation (const Vec3* A, +- const Vec3* B, +- const T* weights, +- const size_t numPoints, +- const bool doScaling = false); ++M44d procrustesRotationAndTranslation ( ++ const Vec3* A, ++ const Vec3* B, ++ const T* weights, ++ const size_t numPoints, ++ const bool doScaling = false); + + /// Computes the translation and rotation that brings the 'from' points + /// as close as possible to the 'to' points under the Frobenius norm. +@@ -1397,11 +1456,11 @@ procrustesRotationAndTranslation (const Vec3* A, + /// @param doScaling If true, include a scaling transformation + /// @return The procrustes transformation + template +-M44d +-procrustesRotationAndTranslation (const Vec3* A, +- const Vec3* B, +- const size_t numPoints, +- const bool doScaling = false); ++M44d procrustesRotationAndTranslation ( ++ const Vec3* A, ++ const Vec3* B, ++ const size_t numPoints, ++ const bool doScaling = false); + + /// Compute the SVD of a 3x3 matrix using Jacobi transformations. This method + /// should be quite accurate (competitive with LAPACK) even for poorly +@@ -1419,12 +1478,13 @@ procrustesRotationAndTranslation (const Vec3* A, + /// + /// Currently only available for single- and double-precision matrices. + template +-void jacobiSVD (const Matrix33& A, +- Matrix33& U, +- Vec3& S, +- Matrix33& V, +- const T tol = std::numeric_limits::epsilon(), +- const bool forcePositiveDeterminant = false); ++void jacobiSVD ( ++ const Matrix33& A, ++ Matrix33& U, ++ Vec3& S, ++ Matrix33& V, ++ const T tol = std::numeric_limits::epsilon (), ++ const bool forcePositiveDeterminant = false); + + /// Compute the SVD of a 3x3 matrix using Jacobi transformations. This method + /// should be quite accurate (competitive with LAPACK) even for poorly +@@ -1442,12 +1502,13 @@ void jacobiSVD (const Matrix33& A, + /// + /// Currently only available for single- and double-precision matrices. + template +-void jacobiSVD (const Matrix44& A, +- Matrix44& U, +- Vec4& S, +- Matrix44& V, +- const T tol = std::numeric_limits::epsilon(), +- const bool forcePositiveDeterminant = false); ++void jacobiSVD ( ++ const Matrix44& A, ++ Matrix44& U, ++ Vec4& S, ++ Matrix44& V, ++ const T tol = std::numeric_limits::epsilon (), ++ const bool forcePositiveDeterminant = false); + + /// Compute the eigenvalues (S) and the eigenvectors (V) of a real + /// symmetric matrix using Jacobi transformation, using a given +@@ -1459,7 +1520,8 @@ void jacobiSVD (const Matrix44& A, + /// Input matrix A must be symmetric. A is also modified during + /// the computation so that upper diagonal entries of A become zero. + template +-void jacobiEigenSolver (Matrix33& A, Vec3& S, Matrix33& V, const T tol); ++void ++jacobiEigenSolver (Matrix33& A, Vec3& S, Matrix33& V, const T tol); + + /// Compute the eigenvalues (S) and the eigenvectors (V) of + /// a real symmetric matrix using Jacobi transformation. +@@ -1473,7 +1535,7 @@ template + inline void + jacobiEigenSolver (Matrix33& A, Vec3& S, Matrix33& V) + { +- jacobiEigenSolver (A, S, V, std::numeric_limits::epsilon()); ++ jacobiEigenSolver (A, S, V, std::numeric_limits::epsilon ()); + } + + /// Compute the eigenvalues (S) and the eigenvectors (V) of a real +@@ -1486,7 +1548,8 @@ jacobiEigenSolver (Matrix33& A, Vec3& S, Matrix33& V) + /// Input matrix A must be symmetric. A is also modified during + /// the computation so that upper diagonal entries of A become zero. + template +-void jacobiEigenSolver (Matrix44& A, Vec4& S, Matrix44& V, const T tol); ++void ++jacobiEigenSolver (Matrix44& A, Vec4& S, Matrix44& V, const T tol); + + /// Compute the eigenvalues (S) and the eigenvectors (V) of + /// a real symmetric matrix using Jacobi transformation. +@@ -1500,7 +1563,7 @@ template + inline void + jacobiEigenSolver (Matrix44& A, Vec4& S, Matrix44& V) + { +- jacobiEigenSolver (A, S, V, std::numeric_limits::epsilon()); ++ jacobiEigenSolver (A, S, V, std::numeric_limits::epsilon ()); + } + + /// Compute a eigenvector corresponding to the abs max eigenvalue +diff --git a/src/Imath/ImathNamespace.h b/src/Imath/ImathNamespace.h +index 913241c..3b7c801 100644 +--- a/src/Imath/ImathNamespace.h ++++ b/src/Imath/ImathNamespace.h +@@ -79,15 +79,15 @@ using namespace IMATH_INTERNAL_NAMESPACE; + // project source code. + // + +-#define IMATH_INTERNAL_NAMESPACE_HEADER_ENTER \ +- namespace IMATH_INTERNAL_NAMESPACE \ +- { +-#define IMATH_INTERNAL_NAMESPACE_HEADER_EXIT } ++# define IMATH_INTERNAL_NAMESPACE_HEADER_ENTER \ ++ namespace IMATH_INTERNAL_NAMESPACE \ ++ { ++# define IMATH_INTERNAL_NAMESPACE_HEADER_EXIT } + +-#define IMATH_INTERNAL_NAMESPACE_SOURCE_ENTER \ +- namespace IMATH_INTERNAL_NAMESPACE \ +- { +-#define IMATH_INTERNAL_NAMESPACE_SOURCE_EXIT } ++# define IMATH_INTERNAL_NAMESPACE_SOURCE_ENTER \ ++ namespace IMATH_INTERNAL_NAMESPACE \ ++ { ++# define IMATH_INTERNAL_NAMESPACE_SOURCE_EXIT } + + #endif // __cplusplus + +diff --git a/src/Imath/ImathPlane.h b/src/Imath/ImathPlane.h +index 9ec1e83..71f215e 100644 +--- a/src/Imath/ImathPlane.h ++++ b/src/Imath/ImathPlane.h +@@ -30,14 +30,13 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class IMATH_EXPORT_TEMPLATE_TYPE Plane3 + { +- public: +- ++public: + /// @{ + /// @name Direct access to member fields +- ++ + /// The normal to the plane + Vec3 normal; +- ++ + /// The distance from the origin to the plane + T distance; + +@@ -47,59 +46,70 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Plane3 + /// @name Constructors + + /// Uninitialized by default +- IMATH_HOSTDEVICE Plane3() IMATH_NOEXCEPT {} ++ IMATH_HOSTDEVICE Plane3 () IMATH_NOEXCEPT {} + + /// Initialize with a normal and distance +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Plane3 (const Vec3& normal, T distance) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Plane3 (const Vec3& normal, T distance) IMATH_NOEXCEPT; + + /// Initialize with a point and a normal +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Plane3 (const Vec3& point, const Vec3& normal) IMATH_NOEXCEPT; +- ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Plane3 (const Vec3& point, const Vec3& normal) IMATH_NOEXCEPT; ++ + /// Initialize with three points +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Plane3 (const Vec3& point1, +- const Vec3& point2, +- const Vec3& point3) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Plane3 ( ++ const Vec3& point1, ++ const Vec3& point2, ++ const Vec3& point3) IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Manipulation +- ++ + /// Set via a given normal and distance +- IMATH_HOSTDEVICE void set (const Vec3& normal, T distance) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ set (const Vec3& normal, T distance) IMATH_NOEXCEPT; + + /// Set via a given point and normal +- IMATH_HOSTDEVICE void set (const Vec3& point, const Vec3& normal) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ set (const Vec3& point, const Vec3& normal) IMATH_NOEXCEPT; + + /// Set via three points +- IMATH_HOSTDEVICE void set (const Vec3& point1, const Vec3& point2, const Vec3& point3) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE void ++ set (const Vec3& point1, const Vec3& point2, const Vec3& point3) ++ IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Utility Methods +- ++ + /// Determine if a line intersects the plane. + /// @param line The line + /// @param[out] intersection The point of intersection + /// @return True if the line intersects the plane. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool +- intersect (const Line3& line, Vec3& intersection) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersect ( ++ const Line3& line, Vec3& intersection) const IMATH_NOEXCEPT; + + /// Determine if a line intersects the plane. + /// @param line The line + /// @param[out] parameter The parametric value of the point of intersection + /// @return True if the line intersects the plane. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersectT (const Line3& line, T& parameter) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersectT (const Line3& line, T& parameter) const IMATH_NOEXCEPT; + + /// Return the distance from a point to the plane. +- IMATH_HOSTDEVICE constexpr T distanceTo (const Vec3& point) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T ++ distanceTo (const Vec3& point) const IMATH_NOEXCEPT; + + /// Reflect the given point around the plane. +- IMATH_HOSTDEVICE constexpr Vec3 reflectPoint (const Vec3& point) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 ++ reflectPoint (const Vec3& point) const IMATH_NOEXCEPT; + + /// Reflect the direction vector around the plane +- IMATH_HOSTDEVICE constexpr Vec3 reflectVector (const Vec3& vec) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 ++ reflectVector (const Vec3& vec) const IMATH_NOEXCEPT; + + /// @} + }; +@@ -115,29 +125,35 @@ typedef Plane3 Plane3d; + //--------------- + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Plane3::Plane3 (const Vec3& p0, const Vec3& p1, const Vec3& p2) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Plane3::Plane3 ( ++ const Vec3& p0, const Vec3& p1, const Vec3& p2) IMATH_NOEXCEPT + { + set (p0, p1, p2); + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Plane3::Plane3 (const Vec3& n, T d) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Plane3::Plane3 ( ++ const Vec3& n, T d) IMATH_NOEXCEPT + { + set (n, d); + } + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Plane3::Plane3 (const Vec3& p, const Vec3& n) IMATH_NOEXCEPT ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Plane3::Plane3 ( ++ const Vec3& p, const Vec3& n) IMATH_NOEXCEPT + { + set (p, n); + } + + template + IMATH_HOSTDEVICE inline void +-Plane3::set (const Vec3& point1, const Vec3& point2, const Vec3& point3) IMATH_NOEXCEPT ++Plane3::set ( ++ const Vec3& point1, ++ const Vec3& point2, ++ const Vec3& point3) IMATH_NOEXCEPT + { + normal = (point2 - point1) % (point3 - point1); +- normal.normalize(); ++ normal.normalize (); + distance = normal ^ point1; + } + +@@ -146,7 +162,7 @@ IMATH_HOSTDEVICE inline void + Plane3::set (const Vec3& point, const Vec3& n) IMATH_NOEXCEPT + { + normal = n; +- normal.normalize(); ++ normal.normalize (); + distance = normal ^ point; + } + +@@ -155,7 +171,7 @@ IMATH_HOSTDEVICE inline void + Plane3::set (const Vec3& n, T d) IMATH_NOEXCEPT + { + normal = n; +- normal.normalize(); ++ normal.normalize (); + distance = d; + } + +@@ -185,8 +201,7 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool + Plane3::intersect (const Line3& line, Vec3& point) const IMATH_NOEXCEPT + { + T d = normal ^ line.dir; +- if (d == 0.0) +- return false; ++ if (d == 0.0) return false; + T t = -((normal ^ line.pos) - distance) / d; + point = line (t); + return true; +@@ -197,8 +212,7 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline bool + Plane3::intersectT (const Line3& line, T& t) const IMATH_NOEXCEPT + { + T d = normal ^ line.dir; +- if (d == 0.0) +- return false; ++ if (d == 0.0) return false; + t = -((normal ^ line.pos) - distance) / d; + return true; + } +@@ -221,11 +235,11 @@ operator* (const Plane3& plane, const Matrix44& M) IMATH_NOEXCEPT + // Could also compute M but that would suck. + // + +- Vec3 dir1 = Vec3 (1, 0, 0) % plane.normal; +- T dir1Len = dir1 ^ dir1; ++ Vec3 dir1 = Vec3 (1, 0, 0) % plane.normal; ++ T dir1Len = dir1 ^ dir1; + +- Vec3 tmp = Vec3 (0, 1, 0) % plane.normal; +- T tmpLen = tmp ^ tmp; ++ Vec3 tmp = Vec3 (0, 1, 0) % plane.normal; ++ T tmpLen = tmp ^ tmp; + + if (tmpLen > dir1Len) + { +@@ -236,10 +250,7 @@ operator* (const Plane3& plane, const Matrix44& M) IMATH_NOEXCEPT + tmp = Vec3 (0, 0, 1) % plane.normal; + tmpLen = tmp ^ tmp; + +- if (tmpLen > dir1Len) +- { +- dir1 = tmp; +- } ++ if (tmpLen > dir1Len) { dir1 = tmp; } + + Vec3 dir2 = dir1 % plane.normal; + Vec3 point = plane.distance * plane.normal; +diff --git a/src/Imath/ImathPlatform.h b/src/Imath/ImathPlatform.h +index 5dc32fd..437b95e 100644 +--- a/src/Imath/ImathPlatform.h ++++ b/src/Imath/ImathPlatform.h +@@ -25,27 +25,27 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + // + // Helpful macros for checking which C++ standard we are compiling with. + // +-#if (__cplusplus >= 202002L) +-# define IMATH_CPLUSPLUS_VERSION 20 +-#elif (__cplusplus >= 201703L) +-# define IMATH_CPLUSPLUS_VERSION 17 +-#elif (__cplusplus >= 201402L) || (defined(_MSC_VER) && _MSC_VER >= 1914) +-# define IMATH_CPLUSPLUS_VERSION 14 +-#elif (__cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1900) +-# define IMATH_CPLUSPLUS_VERSION 11 +-#else +-# error "This version of Imath is meant to work only with C++11 and above" +-#endif +- ++# if (__cplusplus >= 202002L) ++# define IMATH_CPLUSPLUS_VERSION 20 ++# elif (__cplusplus >= 201703L) ++# define IMATH_CPLUSPLUS_VERSION 17 ++# elif (__cplusplus >= 201402L) || (defined(_MSC_VER) && _MSC_VER >= 1914) ++# define IMATH_CPLUSPLUS_VERSION 14 ++# elif (__cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1900) ++# define IMATH_CPLUSPLUS_VERSION 11 ++# else ++# error \ ++ "This version of Imath is meant to work only with C++11 and above" ++# endif + + // + // Constexpr C++14 conditional definition + // +-#if (IMATH_CPLUSPLUS_VERSION >= 14) +- #define IMATH_CONSTEXPR14 constexpr +-#else +- #define IMATH_CONSTEXPR14 /* can not be constexpr before c++14 */ +-#endif ++# if (IMATH_CPLUSPLUS_VERSION >= 14) ++# define IMATH_CONSTEXPR14 constexpr ++# else ++# define IMATH_CONSTEXPR14 /* can not be constexpr before c++14 */ ++# endif + + #endif // __cplusplus + +@@ -64,7 +64,8 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + // + //----------------------------------------------------------------------------- + +-#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER) || defined(__INTEL_COMPILER) ++#if defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER) || \ ++ defined(__INTEL_COMPILER) + # define IMATH_RESTRICT __restrict + #else + # define IMATH_RESTRICT +diff --git a/src/Imath/ImathQuat.h b/src/Imath/ImathQuat.h +index 19e7f32..00d1932 100644 +--- a/src/Imath/ImathQuat.h ++++ b/src/Imath/ImathQuat.h +@@ -41,13 +41,12 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class IMATH_EXPORT_TEMPLATE_TYPE Quat + { +- public: +- ++public: + /// @{ + /// @name Direct access to elements +- ++ + /// The real part +- T r; ++ T r; + + /// The imaginary vector + Vec3 v; +@@ -56,7 +55,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Quat + + /// Element access: q[0] is the real part, (q[1],q[2],q[3]) is the + /// imaginary part. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T& operator[] (int index) IMATH_NOEXCEPT; // as 4D vector ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T& ++ operator[] (int index) IMATH_NOEXCEPT; // as 4D vector + + /// Element access: q[0] is the real part, (q[1],q[2],q[3]) is the + /// imaginary part. +@@ -66,13 +66,14 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Quat + /// @name Constructors + + /// Default constructor is the identity quat +- IMATH_HOSTDEVICE constexpr Quat() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Quat () IMATH_NOEXCEPT; + + /// Copy constructor + IMATH_HOSTDEVICE constexpr Quat (const Quat& q) IMATH_NOEXCEPT; + + /// Construct from a quaternion of a another base type +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat (const Quat& q) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat (const Quat& q) IMATH_NOEXCEPT; + + /// Initialize with real part `s` and imaginary vector 1(i,j,k)` + IMATH_HOSTDEVICE constexpr Quat (T s, T i, T j, T k) IMATH_NOEXCEPT; +@@ -81,130 +82,152 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Quat + IMATH_HOSTDEVICE constexpr Quat (T s, Vec3 d) IMATH_NOEXCEPT; + + /// The identity quaternion +- IMATH_HOSTDEVICE constexpr static Quat identity() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr static Quat identity () IMATH_NOEXCEPT; + + /// Assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& operator= (const Quat& q) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& ++ operator= (const Quat& q) IMATH_NOEXCEPT; + + /// Destructor +- IMATH_HOSTDEVICE ~Quat() IMATH_NOEXCEPT = default; ++ IMATH_HOSTDEVICE ~Quat () IMATH_NOEXCEPT = default; + + /// @} + + /// @{ +- /// @name Basic Algebra +- /// ++ /// @name Basic Algebra ++ /// + /// Note that the operator return values are *NOT* normalized + // + + /// Quaternion multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& operator*= (const Quat& q) IMATH_NOEXCEPT; +- ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& ++ operator*= (const Quat& q) IMATH_NOEXCEPT; ++ + /// Scalar multiplication: multiply both real and imaginary parts + /// by the given scalar. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& operator*= (T t) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& ++ operator*= (T t) IMATH_NOEXCEPT; + + /// Quaterion division, using the inverse() +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& operator/= (const Quat& q) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& ++ operator/= (const Quat& q) IMATH_NOEXCEPT; + + /// Scalar division: multiply both real and imaginary parts + /// by the given scalar. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& operator/= (T t) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& ++ operator/= (T t) IMATH_NOEXCEPT; + + /// Quaternion addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& operator+= (const Quat& q) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& ++ operator+= (const Quat& q) IMATH_NOEXCEPT; + + /// Quaternion subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& operator-= (const Quat& q) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Quat& ++ operator-= (const Quat& q) IMATH_NOEXCEPT; + + /// Equality +- template IMATH_HOSTDEVICE constexpr bool operator== (const Quat& q) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Quat& q) const IMATH_NOEXCEPT; + + /// Inequality +- template IMATH_HOSTDEVICE constexpr bool operator!= (const Quat& q) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Quat& q) const IMATH_NOEXCEPT; + + /// @} + +- + /// @{ + /// @name Query +- ++ + /// Return the R4 length +- IMATH_HOSTDEVICE constexpr T length() const IMATH_NOEXCEPT; // in R4 ++ IMATH_HOSTDEVICE constexpr T length () const IMATH_NOEXCEPT; // in R4 + + /// Return the angle of the axis/angle representation +- IMATH_HOSTDEVICE constexpr T angle() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T angle () const IMATH_NOEXCEPT; + + /// Return the axis of the axis/angle representation +- IMATH_HOSTDEVICE constexpr Vec3 axis() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 axis () const IMATH_NOEXCEPT; + + /// Return a 3x3 rotation matrix +- IMATH_HOSTDEVICE constexpr Matrix33 toMatrix33() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix33 toMatrix33 () const IMATH_NOEXCEPT; + + /// Return a 4x4 rotation matrix +- IMATH_HOSTDEVICE constexpr Matrix44 toMatrix44() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Matrix44 toMatrix44 () const IMATH_NOEXCEPT; + + /// Return the logarithm of the quaterion +- IMATH_HOSTDEVICE Quat log() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Quat log () const IMATH_NOEXCEPT; + + /// Return the exponent of the quaterion +- IMATH_HOSTDEVICE Quat exp() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Quat exp () const IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Utility Methods +- ++ + /// Invert in place: this = 1 / this. + /// @return const reference to this. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat& invert() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat& invert () IMATH_NOEXCEPT; + + /// Return 1/this, leaving this unchanged. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat inverse() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat inverse () const IMATH_NOEXCEPT; + + /// Normalize in place + /// @return const reference to this. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat& normalize() IMATH_NOEXCEPT; +- ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat& normalize () IMATH_NOEXCEPT; ++ + /// Return a normalized quaternion, leaving this unmodified. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat normalized() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat ++ normalized () const IMATH_NOEXCEPT; + + /// Rotate the given point by the quaterion. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 rotateVector (const Vec3& original) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 ++ rotateVector (const Vec3& original) const IMATH_NOEXCEPT; + + /// Return the Euclidean inner product. +- IMATH_HOSTDEVICE constexpr T euclideanInnerProduct (const Quat& q) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T ++ euclideanInnerProduct (const Quat& q) const IMATH_NOEXCEPT; + + /// Set the quaterion to be a rotation around the given axis by the + /// given angle. + /// @return const reference to this. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat& setAxisAngle (const Vec3& axis, T radians) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat& ++ setAxisAngle (const Vec3& axis, T radians) IMATH_NOEXCEPT; + + /// Set the quaternion to be a rotation that transforms the + /// direction vector `fromDirection` to `toDirection` + /// @return const reference to this. + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat& +- setRotation (const Vec3& fromDirection, const Vec3& toDirection) IMATH_NOEXCEPT; ++ setRotation (const Vec3& fromDirection, const Vec3& toDirection) ++ IMATH_NOEXCEPT; + + /// @} +- ++ + /// The base type: In templates that accept a parameter `V`, you + /// can refer to `T` as `V::BaseType` + typedef T BaseType; + +- private: +- IMATH_HOSTDEVICE void setRotationInternal (const Vec3& f0, const Vec3& t0, Quat& q) IMATH_NOEXCEPT; ++private: ++ IMATH_HOSTDEVICE void setRotationInternal ( ++ const Vec3& f0, const Vec3& t0, Quat& q) IMATH_NOEXCEPT; + }; + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat slerp (const Quat& q1, const Quat& q2, T t) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat ++slerp (const Quat& q1, const Quat& q2, T t) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat slerpShortestArc (const Quat& q1, const Quat& q2, T t) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat ++slerpShortestArc (const Quat& q1, const Quat& q2, T t) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat +-squad (const Quat& q1, const Quat& q2, const Quat& qa, const Quat& qb, T t) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Quat squad ( ++ const Quat& q1, ++ const Quat& q2, ++ const Quat& qa, ++ const Quat& qb, ++ T t) IMATH_NOEXCEPT; + + /// + /// From advanced Animation and Rendering Techniques by Watt and Watt, +@@ -213,41 +236,51 @@ squad (const Quat& q1, const Quat& q2, const Quat& qa, const Quat& q + /// computing the inner quadrangle points (qa and qb) to guarantee + /// tangent continuity. + template +-IMATH_HOSTDEVICE void intermediate (const Quat& q0, +- const Quat& q1, +- const Quat& q2, +- const Quat& q3, +- Quat& qa, +- Quat& qb) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE void intermediate ( ++ const Quat& q0, ++ const Quat& q1, ++ const Quat& q2, ++ const Quat& q3, ++ Quat& qa, ++ Quat& qb) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE constexpr Matrix33 operator* (const Matrix33& M, const Quat& q) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Matrix33 ++operator* (const Matrix33& M, const Quat& q) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE constexpr Matrix33 operator* (const Quat& q, const Matrix33& M) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Matrix33 ++operator* (const Quat& q, const Matrix33& M) IMATH_NOEXCEPT; + + template std::ostream& operator<< (std::ostream& o, const Quat& q); + + template +-IMATH_HOSTDEVICE constexpr Quat operator* (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Quat ++operator* (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE constexpr Quat operator/ (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Quat ++operator/ (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE constexpr Quat operator/ (const Quat& q, T t) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Quat ++operator/ (const Quat& q, T t) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE constexpr Quat operator* (const Quat& q, T t) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Quat ++operator* (const Quat& q, T t) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE constexpr Quat operator* (T t, const Quat& q) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Quat ++operator* (T t, const Quat& q) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE constexpr Quat operator+ (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Quat ++operator+ (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE constexpr Quat operator- (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE constexpr Quat ++operator- (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT; + + template + IMATH_HOSTDEVICE constexpr Quat operator~ (const Quat& q) IMATH_NOEXCEPT; +@@ -256,7 +289,8 @@ template + IMATH_HOSTDEVICE constexpr Quat operator- (const Quat& q) IMATH_NOEXCEPT; + + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 operator* (const Vec3& v, const Quat& q) IMATH_NOEXCEPT; ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 ++operator* (const Vec3& v, const Quat& q) IMATH_NOEXCEPT; + + /// Quaternion of type float + typedef Quat Quatf; +@@ -269,41 +303,51 @@ typedef Quat Quatd; + //--------------- + + template +-IMATH_HOSTDEVICE constexpr inline Quat::Quat() IMATH_NOEXCEPT : r (1), v (0, 0, 0) ++IMATH_HOSTDEVICE constexpr inline Quat::Quat () IMATH_NOEXCEPT : r (1), ++ v (0, 0, 0) + { + // empty + } + + template + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Quat::Quat (const Quat& q) IMATH_NOEXCEPT : r (q.r), v (q.v) ++IMATH_HOSTDEVICE ++ IMATH_CONSTEXPR14 inline Quat::Quat (const Quat& q) IMATH_NOEXCEPT ++ : r (q.r), ++ v (q.v) + { + // empty + } + + template +-IMATH_HOSTDEVICE constexpr inline Quat::Quat (T s, T i, T j, T k) IMATH_NOEXCEPT : r (s), v (i, j, k) ++IMATH_HOSTDEVICE constexpr inline Quat::Quat (T s, T i, T j, T k) ++ IMATH_NOEXCEPT : r (s), ++ v (i, j, k) + { + // empty + } + + template +-IMATH_HOSTDEVICE constexpr inline Quat::Quat (T s, Vec3 d) IMATH_NOEXCEPT : r (s), v (d) ++IMATH_HOSTDEVICE constexpr inline Quat::Quat (T s, Vec3 d) IMATH_NOEXCEPT ++ : r (s), ++ v (d) + { + // empty + } + + template +-IMATH_HOSTDEVICE constexpr inline Quat::Quat (const Quat& q) IMATH_NOEXCEPT : r (q.r), v (q.v) ++IMATH_HOSTDEVICE constexpr inline Quat::Quat (const Quat& q) ++ IMATH_NOEXCEPT : r (q.r), ++ v (q.v) + { + // empty + } + + template + IMATH_HOSTDEVICE constexpr inline Quat +-Quat::identity() IMATH_NOEXCEPT ++Quat::identity () IMATH_NOEXCEPT + { +- return Quat(); ++ return Quat (); + } + + template +@@ -338,7 +382,7 @@ template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Quat& + Quat::operator/= (const Quat& q) IMATH_NOEXCEPT + { +- *this = *this * q.inverse(); ++ *this = *this * q.inverse (); + return *this; + } + +@@ -409,16 +453,16 @@ operator^ (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline T +-Quat::length() const IMATH_NOEXCEPT ++Quat::length () const IMATH_NOEXCEPT + { + return std::sqrt (r * r + (v ^ v)); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Quat& +-Quat::normalize() IMATH_NOEXCEPT ++ Quat::normalize () IMATH_NOEXCEPT + { +- if (T l = length()) ++ if (T l = length ()) + { + r /= l; + v /= l; +@@ -434,17 +478,16 @@ Quat::normalize() IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Quat +-Quat::normalized() const IMATH_NOEXCEPT ++ Quat::normalized () const IMATH_NOEXCEPT + { +- if (T l = length()) +- return Quat (r / l, v / l); ++ if (T l = length ()) return Quat (r / l, v / l); + +- return Quat(); ++ return Quat (); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Quat +-Quat::inverse() const IMATH_NOEXCEPT ++ Quat::inverse () const IMATH_NOEXCEPT + { + // + // 1 Q* +@@ -458,7 +501,7 @@ Quat::inverse() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Quat& +-Quat::invert() IMATH_NOEXCEPT ++ Quat::invert () IMATH_NOEXCEPT + { + T qdot = (*this) ^ (*this); + r /= qdot; +@@ -500,11 +543,11 @@ template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T + angle4D (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT + { +- Quat d = q1 - q2; +- T lengthD = std::sqrt (d ^ d); ++ Quat d = q1 - q2; ++ T lengthD = std::sqrt (d ^ d); + +- Quat s = q1 + q2; +- T lengthS = std::sqrt (s ^ s); ++ Quat s = q1 + q2; ++ T lengthS = std::sqrt (s ^ s); + + return 2 * std::atan2 (lengthD, lengthS); + } +@@ -536,7 +579,7 @@ slerp (const Quat& q1, const Quat& q2, T t) IMATH_NOEXCEPT + Quat q = sinx_over_x (s * a) / sinx_over_x (a) * s * q1 + + sinx_over_x (t * a) / sinx_over_x (a) * t * q2; + +- return q.normalized(); ++ return q.normalized (); + } + + /// +@@ -573,7 +616,12 @@ slerpShortestArc (const Quat& q1, const Quat& q2, T t) IMATH_NOEXCEPT + /// qb. + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Quat +-spline (const Quat& q0, const Quat& q1, const Quat& q2, const Quat& q3, T t) IMATH_NOEXCEPT ++ spline ( ++ const Quat& q0, ++ const Quat& q1, ++ const Quat& q2, ++ const Quat& q3, ++ T t) IMATH_NOEXCEPT + { + Quat qa = intermediate (q0, q1, q2); + Quat qb = intermediate (q1, q2, q3); +@@ -591,7 +639,12 @@ spline (const Quat& q0, const Quat& q1, const Quat& q2, const Quat& + /// quaternions. + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Quat +-squad (const Quat& q1, const Quat& qa, const Quat& qb, const Quat& q2, T t) IMATH_NOEXCEPT ++ squad ( ++ const Quat& q1, ++ const Quat& qa, ++ const Quat& qb, ++ const Quat& q2, ++ T t) IMATH_NOEXCEPT + { + Quat r1 = slerp (q1, q2, t); + Quat r2 = slerp (qa, qb, t); +@@ -604,20 +657,21 @@ squad (const Quat& q1, const Quat& qa, const Quat& qb, const Quat& q + /// and `q2`. + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Quat +-intermediate (const Quat& q0, const Quat& q1, const Quat& q2) IMATH_NOEXCEPT ++intermediate (const Quat& q0, const Quat& q1, const Quat& q2) ++ IMATH_NOEXCEPT + { +- Quat q1inv = q1.inverse(); ++ Quat q1inv = q1.inverse (); + Quat c1 = q1inv * q2; + Quat c2 = q1inv * q0; +- Quat c3 = (T) (-0.25) * (c2.log() + c1.log()); +- Quat qa = q1 * c3.exp(); +- qa.normalize(); ++ Quat c3 = (T) (-0.25) * (c2.log () + c1.log ()); ++ Quat qa = q1 * c3.exp (); ++ qa.normalize (); + return qa; + } + + template + IMATH_HOSTDEVICE inline Quat +-Quat::log() const IMATH_NOEXCEPT ++Quat::log () const IMATH_NOEXCEPT + { + // + // For unit quaternion, from Advanced Animation and +@@ -626,13 +680,14 @@ Quat::log() const IMATH_NOEXCEPT + + T theta = std::acos (std::min (r, (T) 1.0)); + +- if (theta == 0) +- return Quat (0, v); ++ if (theta == 0) return Quat (0, v); + + T sintheta = std::sin (theta); + + T k; +- if (std::abs(sintheta) < 1 && std::abs(theta) >= std::numeric_limits::max() * std::abs(sintheta)) ++ if (std::abs (sintheta) < 1 && ++ std::abs (theta) >= ++ std::numeric_limits::max () * std::abs (sintheta)) + k = 1; + else + k = theta / sintheta; +@@ -642,7 +697,7 @@ Quat::log() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline Quat +-Quat::exp() const IMATH_NOEXCEPT ++Quat::exp () const IMATH_NOEXCEPT + { + // + // For pure quaternion (zero scalar part): +@@ -650,11 +705,12 @@ Quat::exp() const IMATH_NOEXCEPT + // Techniques by Watt and Watt, Page 366: + // + +- T theta = v.length(); ++ T theta = v.length (); + T sintheta = std::sin (theta); + + T k; +- if (abs (theta) < 1 && abs (sintheta) >= std::numeric_limits::max() * abs (theta)) ++ if (abs (theta) < 1 && ++ abs (sintheta) >= std::numeric_limits::max () * abs (theta)) + k = 1; + else + k = sintheta / theta; +@@ -666,16 +722,16 @@ Quat::exp() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline T +-Quat::angle() const IMATH_NOEXCEPT ++Quat::angle () const IMATH_NOEXCEPT + { +- return 2 * std::atan2 (v.length(), r); ++ return 2 * std::atan2 (v.length (), r); + } + + template + IMATH_HOSTDEVICE constexpr inline Vec3 +-Quat::axis() const IMATH_NOEXCEPT ++Quat::axis () const IMATH_NOEXCEPT + { +- return v.normalized(); ++ return v.normalized (); + } + + template +@@ -683,7 +739,7 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Quat& + Quat::setAxisAngle (const Vec3& axis, T radians) IMATH_NOEXCEPT + { + r = std::cos (radians / 2); +- v = axis.normalized() * std::sin (radians / 2); ++ v = axis.normalized () * std::sin (radians / 2); + return *this; + } + +@@ -707,8 +763,8 @@ Quat::setRotation (const Vec3& from, const Vec3& to) IMATH_NOEXCEPT + // Normalize from and to, yielding f0 and t0. + // + +- Vec3 f0 = from.normalized(); +- Vec3 t0 = to.normalized(); ++ Vec3 f0 = from.normalized (); ++ Vec3 t0 = to.normalized (); + + if ((f0 ^ t0) >= 0) + { +@@ -726,7 +782,7 @@ Quat::setRotation (const Vec3& from, const Vec3& to) IMATH_NOEXCEPT + // from f0 to h0, then from h0 to t0. + // + +- Vec3 h0 = (f0 + t0).normalized(); ++ Vec3 h0 = (f0 + t0).normalized (); + + if ((h0 ^ h0) != 0) + { +@@ -750,11 +806,11 @@ Quat::setRotation (const Vec3& from, const Vec3& to) IMATH_NOEXCEPT + Vec3 f02 = f0 * f0; + + if (f02.x <= f02.y && f02.x <= f02.z) +- v = (f0 % Vec3 (1, 0, 0)).normalized(); ++ v = (f0 % Vec3 (1, 0, 0)).normalized (); + else if (f02.y <= f02.z) +- v = (f0 % Vec3 (0, 1, 0)).normalized(); ++ v = (f0 % Vec3 (0, 1, 0)).normalized (); + else +- v = (f0 % Vec3 (0, 0, 1)).normalized(); ++ v = (f0 % Vec3 (0, 0, 1)).normalized (); + } + } + +@@ -763,7 +819,8 @@ Quat::setRotation (const Vec3& from, const Vec3& to) IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline void +-Quat::setRotationInternal (const Vec3& f0, const Vec3& t0, Quat& q) IMATH_NOEXCEPT ++Quat::setRotationInternal (const Vec3& f0, const Vec3& t0, Quat& q) ++ IMATH_NOEXCEPT + { + // + // The following is equivalent to setAxisAngle(n,2*phi), +@@ -782,7 +839,7 @@ Quat::setRotationInternal (const Vec3& f0, const Vec3& t0, Quat& q) + // The angle between f0 and h0 is phi. + // + +- Vec3 h0 = (f0 + t0).normalized(); ++ Vec3 h0 = (f0 + t0).normalized (); + + // + // Store the rotation axis and rotation angle. +@@ -794,41 +851,43 @@ Quat::setRotationInternal (const Vec3& f0, const Vec3& t0, Quat& q) + + template + IMATH_HOSTDEVICE constexpr inline Matrix33 +-Quat::toMatrix33() const IMATH_NOEXCEPT ++Quat::toMatrix33 () const IMATH_NOEXCEPT + { +- return Matrix33 (1 - 2 * (v.y * v.y + v.z * v.z), +- 2 * (v.x * v.y + v.z * r), +- 2 * (v.z * v.x - v.y * r), ++ return Matrix33 ( ++ 1 - 2 * (v.y * v.y + v.z * v.z), ++ 2 * (v.x * v.y + v.z * r), ++ 2 * (v.z * v.x - v.y * r), + +- 2 * (v.x * v.y - v.z * r), +- 1 - 2 * (v.z * v.z + v.x * v.x), +- 2 * (v.y * v.z + v.x * r), ++ 2 * (v.x * v.y - v.z * r), ++ 1 - 2 * (v.z * v.z + v.x * v.x), ++ 2 * (v.y * v.z + v.x * r), + +- 2 * (v.z * v.x + v.y * r), +- 2 * (v.y * v.z - v.x * r), +- 1 - 2 * (v.y * v.y + v.x * v.x)); ++ 2 * (v.z * v.x + v.y * r), ++ 2 * (v.y * v.z - v.x * r), ++ 1 - 2 * (v.y * v.y + v.x * v.x)); + } + + template + IMATH_HOSTDEVICE constexpr inline Matrix44 +-Quat::toMatrix44() const IMATH_NOEXCEPT +-{ +- return Matrix44 (1 - 2 * (v.y * v.y + v.z * v.z), +- 2 * (v.x * v.y + v.z * r), +- 2 * (v.z * v.x - v.y * r), +- 0, +- 2 * (v.x * v.y - v.z * r), +- 1 - 2 * (v.z * v.z + v.x * v.x), +- 2 * (v.y * v.z + v.x * r), +- 0, +- 2 * (v.z * v.x + v.y * r), +- 2 * (v.y * v.z - v.x * r), +- 1 - 2 * (v.y * v.y + v.x * v.x), +- 0, +- 0, +- 0, +- 0, +- 1); ++Quat::toMatrix44 () const IMATH_NOEXCEPT ++{ ++ return Matrix44 ( ++ 1 - 2 * (v.y * v.y + v.z * v.z), ++ 2 * (v.x * v.y + v.z * r), ++ 2 * (v.z * v.x - v.y * r), ++ 0, ++ 2 * (v.x * v.y - v.z * r), ++ 1 - 2 * (v.z * v.z + v.x * v.x), ++ 2 * (v.y * v.z + v.x * r), ++ 0, ++ 2 * (v.z * v.x + v.y * r), ++ 2 * (v.y * v.z - v.x * r), ++ 1 - 2 * (v.y * v.y + v.x * v.x), ++ 0, ++ 0, ++ 0, ++ 0, ++ 1); + } + + /// Transform the quaternion by the matrix +@@ -837,7 +896,7 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix33 + operator* (const Matrix33& M, const Quat& q) IMATH_NOEXCEPT + { +- return M * q.toMatrix33(); ++ return M * q.toMatrix33 (); + } + + /// Transform the matrix by the quaterion: +@@ -846,7 +905,7 @@ template + IMATH_HOSTDEVICE constexpr inline Matrix33 + operator* (const Quat& q, const Matrix33& M) IMATH_NOEXCEPT + { +- return q.toMatrix33() * M; ++ return q.toMatrix33 () * M; + } + + /// Stream output as "(r x y z)" +@@ -854,7 +913,8 @@ template + std::ostream& + operator<< (std::ostream& o, const Quat& q) + { +- return o << "(" << q.r << " " << q.v.x << " " << q.v.y << " " << q.v.z << ")"; ++ return o << "(" << q.r << " " << q.v.x << " " << q.v.y << " " << q.v.z ++ << ")"; + } + + /// Quaterion multiplication +@@ -862,7 +922,8 @@ template + IMATH_HOSTDEVICE constexpr inline Quat + operator* (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT + { +- return Quat (q1.r * q2.r - (q1.v ^ q2.v), q1.r * q2.v + q1.v * q2.r + q1.v % q2.v); ++ return Quat ( ++ q1.r * q2.r - (q1.v ^ q2.v), q1.r * q2.v + q1.v * q2.r + q1.v % q2.v); + } + + /// Quaterion division +@@ -870,7 +931,7 @@ template + IMATH_HOSTDEVICE constexpr inline Quat + operator/ (const Quat& q1, const Quat& q2) IMATH_NOEXCEPT + { +- return q1 * q2.inverse(); ++ return q1 * q2.inverse (); + } + + /// Quaterion division +@@ -935,7 +996,7 @@ operator- (const Quat& q) IMATH_NOEXCEPT + /// @return v * q + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Vec3 +-operator* (const Vec3& v, const Quat& q) IMATH_NOEXCEPT ++ operator* (const Vec3& v, const Quat& q) IMATH_NOEXCEPT + { + Vec3 a = q.v % v; + Vec3 b = q.v % a; +diff --git a/src/Imath/ImathRandom.cpp b/src/Imath/ImathRandom.cpp +index 87c47cf..880b2df 100644 +--- a/src/Imath/ImathRandom.cpp ++++ b/src/Imath/ImathRandom.cpp +@@ -21,7 +21,7 @@ namespace + // Static state used by Imath::drand48(), Imath::lrand48() and Imath::srand48() + // + +-unsigned short staticState[3] = { 0, 0, 0 }; ++unsigned short staticState[3] = {0, 0, 0}; + + void + rand48Next (unsigned short state[3]) +@@ -90,7 +90,7 @@ erand48 (unsigned short state[3]) + + union + { +- double d; ++ double d; + uint64_t i; + } u; + +@@ -107,7 +107,7 @@ erand48 (unsigned short state[3]) + + /// Return erand48() + double +-drand48() ++drand48 () + { + return IMATH_INTERNAL_NAMESPACE::erand48 (staticState); + } +@@ -126,7 +126,7 @@ nrand48 (unsigned short state[3]) + + /// Return nrand48() + long int +-lrand48() ++lrand48 () + { + return IMATH_INTERNAL_NAMESPACE::nrand48 (staticState); + } +@@ -140,7 +140,7 @@ srand48 (long int seed) + } + + float +-Rand32::nextf() ++Rand32::nextf () + { + // + // Generate single-precision floating-point values between 0.0 and 1.0: +@@ -155,11 +155,11 @@ Rand32::nextf() + // between 0.0 and 1.0-FLT_EPSILON. + // + +- next(); ++ next (); + + union + { +- float f; ++ float f; + unsigned int i; + } u; + +diff --git a/src/Imath/ImathRandom.h b/src/Imath/ImathRandom.h +index 8ece0d6..82a622c 100644 +--- a/src/Imath/ImathRandom.h ++++ b/src/Imath/ImathRandom.h +@@ -31,8 +31,7 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + /// length of 2^32. + class IMATH_EXPORT Rand32 + { +- public: +- ++public: + /// Constructor, given a seed + IMATH_HOSTDEVICE Rand32 (unsigned long int seed = 0); + +@@ -40,19 +39,19 @@ class IMATH_EXPORT Rand32 + IMATH_HOSTDEVICE void init (unsigned long int seed); + + /// Get the next value in the sequence (range: [false, true]) +- IMATH_HOSTDEVICE bool nextb(); ++ IMATH_HOSTDEVICE bool nextb (); + + /// Get the next value in the sequence (range: [0 ... 0xffffffff]) +- IMATH_HOSTDEVICE unsigned long int nexti(); ++ IMATH_HOSTDEVICE unsigned long int nexti (); + + /// Get the next value in the sequence (range: [0 ... 1[) +- IMATH_HOSTDEVICE float nextf(); ++ IMATH_HOSTDEVICE float nextf (); + + /// Get the next value in the sequence (range [rangeMin ... rangeMax[) + IMATH_HOSTDEVICE float nextf (float rangeMin, float rangeMax); + +- private: +- IMATH_HOSTDEVICE void next(); ++private: ++ IMATH_HOSTDEVICE void next (); + + unsigned long int _state; + }; +@@ -62,8 +61,7 @@ class IMATH_EXPORT Rand32 + /// uniformly distributed sequence. + class Rand48 + { +- public: +- ++public: + /// Constructor + IMATH_HOSTDEVICE Rand48 (unsigned long int seed = 0); + +@@ -71,28 +69,30 @@ class Rand48 + IMATH_HOSTDEVICE void init (unsigned long int seed); + + /// Get the next value in the sequence (range: [false, true]) +- IMATH_HOSTDEVICE bool nextb(); ++ IMATH_HOSTDEVICE bool nextb (); + + /// Get the next value in the sequence (range: [0 ... 0x7fffffff]) +- IMATH_HOSTDEVICE long int nexti(); ++ IMATH_HOSTDEVICE long int nexti (); + + /// Get the next value in the sequence (range: [0 ... 1[) +- IMATH_HOSTDEVICE double nextf(); ++ IMATH_HOSTDEVICE double nextf (); + + /// Get the next value in the sequence (range [rangeMin ... rangeMax[) + IMATH_HOSTDEVICE double nextf (double rangeMin, double rangeMax); + +- private: ++private: + unsigned short int _state[3]; + }; + + /// Return random points uniformly distributed in a sphere with + /// radius 1 around the origin (distance from origin <= 1). +-template IMATH_HOSTDEVICE Vec solidSphereRand (Rand& rand); ++template ++IMATH_HOSTDEVICE Vec solidSphereRand (Rand& rand); + + /// Return random points uniformly distributed on the surface of + /// a sphere with radius 1 around the origin. +-template IMATH_HOSTDEVICE Vec hollowSphereRand (Rand& rand); ++template ++IMATH_HOSTDEVICE Vec hollowSphereRand (Rand& rand); + + /// Return random numbers with a normal (Gaussian) + /// distribution with zero mean and unit variance. +@@ -101,18 +101,19 @@ template IMATH_HOSTDEVICE float gaussRand (Rand& rand); + /// Return random points whose distance from the origin + /// has a normal (Gaussian) distribution with zero mean + /// and unit variance. +-template IMATH_HOSTDEVICE Vec gaussSphereRand (Rand& rand); ++template ++IMATH_HOSTDEVICE Vec gaussSphereRand (Rand& rand); + + //--------------------------------- + // erand48(), nrand48() and friends + //--------------------------------- + + /// @cond Doxygen_Suppress +-IMATH_HOSTDEVICE IMATH_EXPORT double erand48 (unsigned short state[3]); +-IMATH_HOSTDEVICE IMATH_EXPORT double drand48(); ++IMATH_HOSTDEVICE IMATH_EXPORT double erand48 (unsigned short state[3]); ++IMATH_HOSTDEVICE IMATH_EXPORT double drand48 (); + IMATH_HOSTDEVICE IMATH_EXPORT long int nrand48 (unsigned short state[3]); +-IMATH_HOSTDEVICE IMATH_EXPORT long int lrand48(); +-IMATH_HOSTDEVICE IMATH_EXPORT void srand48 (long int seed); ++IMATH_HOSTDEVICE IMATH_EXPORT long int lrand48 (); ++IMATH_HOSTDEVICE IMATH_EXPORT void srand48 (long int seed); + /// @endcond + + //--------------- +@@ -131,30 +132,30 @@ IMATH_HOSTDEVICE inline Rand32::Rand32 (unsigned long int seed) + } + + IMATH_HOSTDEVICE inline void +-Rand32::next() ++Rand32::next () + { + _state = 1664525L * _state + 1013904223L; + } + + IMATH_HOSTDEVICE inline bool +-Rand32::nextb() ++Rand32::nextb () + { +- next(); ++ next (); + // Return the 31st (most significant) bit, by and-ing with 2 ^ 31. + return !!(_state & 2147483648UL); + } + + IMATH_HOSTDEVICE inline unsigned long int +-Rand32::nexti() ++Rand32::nexti () + { +- next(); ++ next (); + return _state & 0xffffffff; + } + + IMATH_HOSTDEVICE inline float + Rand32::nextf (float rangeMin, float rangeMax) + { +- float f = nextf(); ++ float f = nextf (); + return rangeMin * (1 - f) + rangeMax * f; + } + +@@ -174,19 +175,19 @@ IMATH_HOSTDEVICE inline Rand48::Rand48 (unsigned long int seed) + } + + IMATH_HOSTDEVICE inline bool +-Rand48::nextb() ++Rand48::nextb () + { + return nrand48 (_state) & 1; + } + + IMATH_HOSTDEVICE inline long int +-Rand48::nexti() ++Rand48::nexti () + { + return nrand48 (_state); + } + + IMATH_HOSTDEVICE inline double +-Rand48::nextf() ++Rand48::nextf () + { + return erand48 (_state); + } +@@ -194,7 +195,7 @@ Rand48::nextf() + IMATH_HOSTDEVICE inline double + Rand48::nextf (double rangeMin, double rangeMax) + { +- double f = nextf(); ++ double f = nextf (); + return rangeMin * (1 - f) + rangeMax * f; + } + +@@ -206,9 +207,9 @@ solidSphereRand (Rand& rand) + + do + { +- for (unsigned int i = 0; i < Vec::dimensions(); i++) ++ for (unsigned int i = 0; i < Vec::dimensions (); i++) + v[i] = (typename Vec::BaseType) rand.nextf (-1, 1); +- } while (v.length2() > 1); ++ } while (v.length2 () > 1); + + return v; + } +@@ -217,15 +218,15 @@ template + IMATH_HOSTDEVICE Vec + hollowSphereRand (Rand& rand) + { +- Vec v; ++ Vec v; + typename Vec::BaseType length; + + do + { +- for (unsigned int i = 0; i < Vec::dimensions(); i++) ++ for (unsigned int i = 0; i < Vec::dimensions (); i++) + v[i] = (typename Vec::BaseType) rand.nextf (-1, 1); + +- length = v.length(); ++ length = v.length (); + } while (length > 1 || length == 0); + + return v / length; +diff --git a/src/Imath/ImathRoots.h b/src/Imath/ImathRoots.h +index 6632bec..97abd39 100644 +--- a/src/Imath/ImathRoots.h ++++ b/src/Imath/ImathRoots.h +@@ -40,7 +40,8 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + /// + /// @return 1 if the equation has a solution, 0 if there is no + /// solution, and -1 if all real numbers are solutions. +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveLinear (T a, T b, T& x); ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveLinear (T a, T b, T& x); + + /// + /// Solve for x in the quadratic equation: +@@ -50,7 +51,8 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveLinear (T a, T b, + /// @return 2 if the equation has two solutions, 1 if the equation has + /// a single solution, 0 if there is no solution, and -1 if all real + /// numbers are solutions. +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveQuadratic (T a, T b, T c, T x[2]); ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveQuadratic (T a, T b, T c, T x[2]); + template + + /// +@@ -64,7 +66,8 @@ template + /// + /// @return 0 if there is no solution, and -1 if all real + /// numbers are solutions, otherwise return the number of solutions. +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveNormalizedCubic (T r, T s, T t, T x[3]); ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int ++solveNormalizedCubic (T r, T s, T t, T x[3]); + + /// + /// Solve for x in the cubic equation: +@@ -77,7 +80,8 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveNormalizedCubic (T r, T s, T t, T x[ + /// + /// @return 0 if there is no solution, and -1 if all real + /// numbers are solutions, otherwise return the number of solutions. +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveCubic (T a, T b, T c, T d, T x[3]); ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 int solveCubic (T a, T b, T c, T d, T x[3]); + + //--------------- + // Implementation +@@ -106,10 +110,7 @@ template + IMATH_CONSTEXPR14 int + solveQuadratic (T a, T b, T c, T x[2]) + { +- if (a == 0) +- { +- return solveLinear (b, c, x[0]); +- } ++ if (a == 0) { return solveLinear (b, c, x[0]); } + else + { + T D = b * b - 4 * a * c; +@@ -156,7 +157,7 @@ solveNormalizedCubic (T r, T s, T t, T x[3]) + if (D > 0) + { + auto real_root = [] (T a, T x) -> T { +- T sign = std::copysign(T(1), a); ++ T sign = std::copysign (T (1), a); + return sign * std::pow (sign * a, T (1) / x); + }; + +@@ -167,27 +168,30 @@ solveNormalizedCubic (T r, T s, T t, T x[3]) + return 1; + } + +- namespace CN = COMPLEX_NAMESPACE; +- CN::complex u = CN::pow (-q / 2 + CN::sqrt (CN::complex (D)), T (1) / T (3)); ++ namespace CN = COMPLEX_NAMESPACE; ++ CN::complex u = ++ CN::pow (-q / 2 + CN::sqrt (CN::complex (D)), T (1) / T (3)); + CN::complex v = -p / (T (3) * u); + + const T sqrt3 = T (1.73205080756887729352744634150587); // enough digits + // for long double + CN::complex y0 (u + v); +- CN::complex y1 (-(u + v) / T (2) + (u - v) / T (2) * CN::complex (0, sqrt3)); +- CN::complex y2 (-(u + v) / T (2) - (u - v) / T (2) * CN::complex (0, sqrt3)); ++ CN::complex y1 ( ++ -(u + v) / T (2) + (u - v) / T (2) * CN::complex (0, sqrt3)); ++ CN::complex y2 ( ++ -(u + v) / T (2) - (u - v) / T (2) * CN::complex (0, sqrt3)); + + if (D == 0) + { +- x[0] = y0.real() - r / 3; +- x[1] = y1.real() - r / 3; ++ x[0] = y0.real () - r / 3; ++ x[1] = y1.real () - r / 3; + return 2; + } + else + { +- x[0] = y0.real() - r / 3; +- x[1] = y1.real() - r / 3; +- x[2] = y2.real() - r / 3; ++ x[0] = y0.real () - r / 3; ++ x[1] = y1.real () - r / 3; ++ x[2] = y2.real () - r / 3; + return 3; + } + } +@@ -196,10 +200,7 @@ template + IMATH_CONSTEXPR14 int + solveCubic (T a, T b, T c, T d, T x[3]) + { +- if (a == 0) +- { +- return solveQuadratic (b, c, d, x); +- } ++ if (a == 0) { return solveQuadratic (b, c, d, x); } + else + { + return solveNormalizedCubic (b / a, c / a, d / a, x); +diff --git a/src/Imath/ImathShear.h b/src/Imath/ImathShear.h +index 0c4d463..f6e6fef 100644 +--- a/src/Imath/ImathShear.h ++++ b/src/Imath/ImathShear.h +@@ -50,13 +50,13 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + /// lower/upper (depending on column/row major) triangle of the + /// matrix. Houdini is the same as Maya (see + /// https://www.sidefx.com/docs/houdini/props/obj.html) in this +-/// respect. ++/// respect. + /// + /// There's another way to look at it. A general affine transformation + /// in 3D has 12 degrees of freedom - 12 "available" elements in the + /// 4x4 matrix since a single row/column must be (0,0,0,1). If you + /// add up the degrees of freedom from Maya: +-/// ++/// + /// - 3 translation + /// - 3 rotation + /// - 3 scale +@@ -69,7 +69,7 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + /// represented in those standard 12 degrees of freedom. Here's a + /// python example of how to do that: + /// +-/// ++/// + /// >>> import imath + /// >>> M = imath.M44f() + /// >>> s = imath.V3f() +@@ -89,7 +89,7 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + /// V3f(0, -0, 0.785398185) + /// >>> t + /// V3f(0, 0, 0) +-/// ++/// + /// That shows how to decompose a transform matrix with one of those + /// "extra" shear coefficients into those standard 12 degrees of + /// freedom. But it's not necessarily intuitive; in this case, a +@@ -109,13 +109,12 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + /// transformation matrix doesn't necessarily mean that the matrix has + /// 12 true degrees of freedom, but the standard + /// translation/rotation/scale/shear matrices have the right +-/// construction to ensure that. +-/// ++/// construction to ensure that. ++/// + + template class IMATH_EXPORT_TEMPLATE_TYPE Shear6 + { +- public: +- ++public: + /// @{ + /// @name Direct access to members + +@@ -133,8 +132,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Shear6 + /// @name Constructors and Assignment + + /// Initialize to 0 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6(); +- ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (); ++ + /// Initialize to the given XY, XZ, YZ values + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (T XY, T XZ, T YZ); + +@@ -146,96 +145,104 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Shear6 + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Vec3& v); + + /// Initialize to the given (XY XZ YZ YX ZX ZY) values +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (T XY, +- T XZ, +- T YZ, +- T YX, +- T ZX, +- T ZY); ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Shear6 (T XY, T XZ, T YZ, T YX, T ZX, T ZY); + + /// Copy constructor + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Shear6& h); + + /// Construct from a Shear6 object of another base type +- template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Shear6& h); ++ template ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Shear6 (const Shear6& h); + + /// Assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator= (const Shear6& h); ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& ++ operator= (const Shear6& h); + + /// Assignment from vector + template +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator= (const Vec3& v); ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& ++ operator= (const Vec3& v); + + /// Destructor +- IMATH_HOSTDEVICE ~Shear6() = default; ++ IMATH_HOSTDEVICE ~Shear6 () = default; + + /// @} +- ++ + /// @{ + /// @name Compatibility with Sb + + /// Set the value +- template IMATH_HOSTDEVICE void setValue (S XY, S XZ, S YZ, S YX, S ZX, S ZY); ++ template ++ IMATH_HOSTDEVICE void setValue (S XY, S XZ, S YZ, S YX, S ZX, S ZY); + + /// Set the value + template IMATH_HOSTDEVICE void setValue (const Shear6& h); + + /// Return the values + template +- IMATH_HOSTDEVICE void getValue (S& XY, S& XZ, S& YZ, S& YX, S& ZX, S& ZY) const; ++ IMATH_HOSTDEVICE void ++ getValue (S& XY, S& XZ, S& YZ, S& YX, S& ZX, S& ZY) const; + + /// Return the value in `h` + template IMATH_HOSTDEVICE void getValue (Shear6& h) const; + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE T* getValue(); ++ IMATH_HOSTDEVICE T* getValue (); + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE const T* getValue() const; ++ IMATH_HOSTDEVICE const T* getValue () const; + + /// @} + + /// @{ + /// @name Arithmetic and Comparison +- ++ + /// Equality +- template IMATH_HOSTDEVICE constexpr bool operator== (const Shear6& h) const; ++ template ++ IMATH_HOSTDEVICE constexpr bool operator== (const Shear6& h) const; + + /// Inequality +- template IMATH_HOSTDEVICE constexpr bool operator!= (const Shear6& h) const; ++ template ++ IMATH_HOSTDEVICE constexpr bool operator!= (const Shear6& h) const; + + /// Compare two shears and test if they are "approximately equal": + /// @return True if the coefficients of this and h are the same with + /// an absolute error of no more than e, i.e., for all i + /// abs (this[i] - h[i]) <= e +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError (const Shear6& h, T e) const; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithAbsError (const Shear6& h, T e) const; + + /// Compare two shears and test if they are "approximately equal": + /// @return True if the coefficients of this and h are the same with + /// a relative error of no more than e, i.e., for all i + /// abs (this[i] - h[i]) <= e * abs (this[i]) +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError (const Shear6& h, T e) const; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithRelError (const Shear6& h, T e) const; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator+= (const Shear6& h); ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& ++ operator+= (const Shear6& h); + + /// Component-wise addition + IMATH_HOSTDEVICE constexpr Shear6 operator+ (const Shear6& h) const; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator-= (const Shear6& h); ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& ++ operator-= (const Shear6& h); + + /// Component-wise subtraction + IMATH_HOSTDEVICE constexpr Shear6 operator- (const Shear6& h) const; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE constexpr Shear6 operator-() const; ++ IMATH_HOSTDEVICE constexpr Shear6 operator- () const; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& negate(); ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& negate (); + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator*= (const Shear6& h); ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& ++ operator*= (const Shear6& h); + /// Scalar multiplication + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator*= (T a); + +@@ -246,7 +253,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Shear6 + IMATH_HOSTDEVICE constexpr Shear6 operator* (T a) const; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator/= (const Shear6& h); ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& ++ operator/= (const Shear6& h); + + /// Scalar division + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Shear6& operator/= (T a); +@@ -258,26 +266,38 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Shear6 + IMATH_HOSTDEVICE constexpr Shear6 operator/ (T a) const; + + /// @} +- ++ + /// @{ + /// @name Numerical Limits +- ++ + /// Largest possible negative value +- IMATH_HOSTDEVICE constexpr static T baseTypeLowest() IMATH_NOEXCEPT { return std::numeric_limits::lowest(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeLowest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::lowest (); ++ } + + /// Largest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeMax() IMATH_NOEXCEPT { return std::numeric_limits::max(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeMax () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::max (); ++ } + + /// Smallest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeSmallest() IMATH_NOEXCEPT { return std::numeric_limits::min(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeSmallest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::min (); ++ } + + /// Smallest possible e for which 1+e != 1 +- IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon() IMATH_NOEXCEPT { return std::numeric_limits::epsilon(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::epsilon (); ++ } + + /// @} + + /// Return the number of dimensions, i.e. 6 +- IMATH_HOSTDEVICE constexpr static unsigned int dimensions() { return 6; } ++ IMATH_HOSTDEVICE constexpr static unsigned int dimensions () { return 6; } + + /// The base type: In templates that accept a parameter `V` (could + /// be a Color4), you can refer to `T` as `V::BaseType` +@@ -285,7 +305,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Shear6 + }; + + /// Stream output, as "(xy xz yz yx zx zy)" +-template std::ostream& operator<< (std::ostream& s, const Shear6& h); ++template ++std::ostream& operator<< (std::ostream& s, const Shear6& h); + + /// Reverse multiplication: scalar * Shear6 + template +@@ -321,12 +342,14 @@ Shear6::operator[] (int i) const + return (&xy)[i]; // NOSONAR - suppress SonarCloud bug report. + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6() ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 () + { + xy = xz = yz = yx = zx = zy = 0; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 (T XY, T XZ, T YZ) ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 (T XY, T XZ, T YZ) + { + xy = XY; + xz = XZ; +@@ -336,7 +359,8 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 ( + zy = 0; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 (const Vec3& v) ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 (const Vec3& v) + { + xy = v.x; + xz = v.y; +@@ -358,7 +382,9 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 (const Vec3& v) + zy = 0; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 (T XY, T XZ, T YZ, T YX, T ZX, T ZY) ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 ( ++ T XY, T XZ, T YZ, T YX, T ZX, T ZY) + { + xy = XY; + xz = XZ; +@@ -368,7 +394,8 @@ template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 ( + zy = ZY; + } + +-template IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 (const Shear6& h) ++template ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Shear6::Shear6 (const Shear6& h) + { + xy = h.xy; + xz = h.xz; +@@ -471,14 +498,14 @@ Shear6::getValue (Shear6& h) const + + template + IMATH_HOSTDEVICE inline T* +-Shear6::getValue() ++Shear6::getValue () + { + return (T*) &xy; + } + + template + IMATH_HOSTDEVICE inline const T* +-Shear6::getValue() const ++Shear6::getValue () const + { + return (const T*) &xy; + } +@@ -488,7 +515,8 @@ template + IMATH_HOSTDEVICE constexpr inline bool + Shear6::operator== (const Shear6& h) const + { +- return xy == h.xy && xz == h.xz && yz == h.yz && yx == h.yx && zx == h.zx && zy == h.zy; ++ return xy == h.xy && xz == h.xz && yz == h.yz && yx == h.yx && zx == h.zx && ++ zy == h.zy; + } + + template +@@ -496,7 +524,8 @@ template + IMATH_HOSTDEVICE constexpr inline bool + Shear6::operator!= (const Shear6& h) const + { +- return xy != h.xy || xz != h.xz || yz != h.yz || yx != h.yx || zx != h.zx || zy != h.zy; ++ return xy != h.xy || xz != h.xz || yz != h.yz || yx != h.yx || zx != h.zx || ++ zy != h.zy; + } + + template +@@ -538,7 +567,8 @@ template + IMATH_HOSTDEVICE constexpr inline Shear6 + Shear6::operator+ (const Shear6& h) const + { +- return Shear6 (xy + h.xy, xz + h.xz, yz + h.yz, yx + h.yx, zx + h.zx, zy + h.zy); ++ return Shear6 ( ++ xy + h.xy, xz + h.xz, yz + h.yz, yx + h.yx, zx + h.zx, zy + h.zy); + } + + template +@@ -558,19 +588,20 @@ template + IMATH_HOSTDEVICE constexpr inline Shear6 + Shear6::operator- (const Shear6& h) const + { +- return Shear6 (xy - h.xy, xz - h.xz, yz - h.yz, yx - h.yx, zx - h.zx, zy - h.zy); ++ return Shear6 ( ++ xy - h.xy, xz - h.xz, yz - h.yz, yx - h.yx, zx - h.zx, zy - h.zy); + } + + template + IMATH_HOSTDEVICE constexpr inline Shear6 +-Shear6::operator-() const ++Shear6::operator- () const + { + return Shear6 (-xy, -xz, -yz, -yx, -zx, -zy); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Shear6& +-Shear6::negate() ++ Shear6::negate () + { + xy = -xy; + xz = -xz; +@@ -611,7 +642,8 @@ template + IMATH_HOSTDEVICE constexpr inline Shear6 + Shear6::operator* (const Shear6& h) const + { +- return Shear6 (xy * h.xy, xz * h.xz, yz * h.yz, yx * h.yx, zx * h.zx, zy * h.zy); ++ return Shear6 ( ++ xy * h.xy, xz * h.xz, yz * h.yz, yx * h.yx, zx * h.zx, zy * h.zy); + } + + template +@@ -651,7 +683,8 @@ template + IMATH_HOSTDEVICE constexpr inline Shear6 + Shear6::operator/ (const Shear6& h) const + { +- return Shear6 (xy / h.xy, xz / h.xz, yz / h.yz, yx / h.yx, zx / h.zx, zy / h.zy); ++ return Shear6 ( ++ xy / h.xy, xz / h.xz, yz / h.yz, yx / h.yx, zx / h.zx, zy / h.zy); + } + + template +@@ -669,8 +702,8 @@ template + std::ostream& + operator<< (std::ostream& s, const Shear6& h) + { +- return s << '(' << h.xy << ' ' << h.xz << ' ' << h.yz << h.yx << ' ' << h.zx << ' ' << h.zy +- << ')'; ++ return s << '(' << h.xy << ' ' << h.xz << ' ' << h.yz << h.yx << ' ' << h.zx ++ << ' ' << h.zy << ')'; + } + + //----------------------------------------- +@@ -681,7 +714,8 @@ template + IMATH_HOSTDEVICE constexpr inline Shear6 + operator* (S a, const Shear6& h) + { +- return Shear6 (a * h.xy, a * h.xz, a * h.yz, a * h.yx, a * h.zx, a * h.zy); ++ return Shear6 ( ++ a * h.xy, a * h.xz, a * h.yz, a * h.yx, a * h.zx, a * h.zy); + } + + IMATH_INTERNAL_NAMESPACE_HEADER_EXIT +diff --git a/src/Imath/ImathSphere.h b/src/Imath/ImathSphere.h +index 0680de7..3d5031b 100644 +--- a/src/Imath/ImathSphere.h ++++ b/src/Imath/ImathSphere.h +@@ -25,11 +25,10 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + template class IMATH_EXPORT_TEMPLATE_TYPE Sphere3 + { +- public: +- ++public: + /// @{ + /// @name Direct access to member fields +- ++ + /// Center + Vec3 center; + +@@ -42,25 +41,27 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Sphere3 + /// @name Constructors + + /// Default is center at (0,0,0) and radius of 0. +- IMATH_HOSTDEVICE constexpr Sphere3() : center (0, 0, 0), radius (0) {} ++ IMATH_HOSTDEVICE constexpr Sphere3 () : center (0, 0, 0), radius (0) {} + + /// Initialize to a given center and radius +- IMATH_HOSTDEVICE constexpr Sphere3 (const Vec3& c, T r) : center (c), radius (r) {} ++ IMATH_HOSTDEVICE constexpr Sphere3 (const Vec3& c, T r) ++ : center (c), radius (r) ++ {} + + /// @} +- ++ + /// @{ + /// @name Manipulation +- ++ + /// Set the center and radius of the sphere so that it tightly + /// encloses Box b. + IMATH_HOSTDEVICE void circumscribe (const Box>& box); + + /// @} +- ++ + /// @{ + /// @name Utility Methods +- ++ + /// If the sphere and line `l` intersect, then compute the + /// smallest `t` with `t>=0` so that `l(t)` is a point on the sphere. + /// +@@ -78,7 +79,8 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Sphere3 + /// @param[out] t The parameter of the line at the intersection point + /// @return True if the sphere and line intersect, false if they + /// do not. +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersectT (const Line3& l, T& t) const; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ intersectT (const Line3& l, T& t) const; + + /// @} + }; +@@ -98,7 +100,7 @@ IMATH_HOSTDEVICE inline void + Sphere3::circumscribe (const Box>& box) + { + center = T (0.5) * (box.min + box.max); +- radius = (box.max - center).length(); ++ radius = (box.max - center).length (); + } + + template +@@ -108,8 +110,8 @@ Sphere3::intersectT (const Line3& line, T& t) const + bool doesIntersect = true; + + Vec3 v = line.pos - center; +- T B = T (2.0) * (line.dir ^ v); +- T C = (v ^ v) - (radius * radius); ++ T B = T (2.0) * (line.dir ^ v); ++ T C = (v ^ v) - (radius * radius); + + // compute discriminant + // if negative, there is no intersection +@@ -136,8 +138,7 @@ Sphere3::intersectT (const Line3& line, T& t) const + t = (-B + sqroot) * T (0.5); + } + +- if (t < 0.0) +- doesIntersect = false; ++ if (t < 0.0) doesIntersect = false; + } + + return doesIntersect; +diff --git a/src/Imath/ImathTypeTraits.h b/src/Imath/ImathTypeTraits.h +index 4e8447d..60c85e1 100644 +--- a/src/Imath/ImathTypeTraits.h ++++ b/src/Imath/ImathTypeTraits.h +@@ -16,21 +16,19 @@ + + IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + +- + /// Define Imath::enable_if_t to be std for C++14, equivalent for C++11. + #if (IMATH_CPLUSPLUS_VERSION >= 14) +- using std::enable_if_t; // Use C++14 std::enable_if_t ++using std::enable_if_t; // Use C++14 std::enable_if_t + #else +- // Define enable_if_t for C++11 +- template +- using enable_if_t = typename std::enable_if::type; ++// Define enable_if_t for C++11 ++template ++using enable_if_t = typename std::enable_if::type; + #endif + +- + /// An enable_if helper to be used in template parameters which results in + /// much shorter symbols. +-#define IMATH_ENABLE_IF(...) IMATH_INTERNAL_NAMESPACE::enable_if_t<(__VA_ARGS__), int> = 0 +- ++#define IMATH_ENABLE_IF(...) \ ++ IMATH_INTERNAL_NAMESPACE::enable_if_t<(__VA_ARGS__), int> = 0 + + #if IMATH_FOREIGN_VECTOR_INTEROP + +@@ -75,138 +73,162 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + /// struct Imath::has_subscript : public std::false_type { }; + /// + +- + /// `has_xy::value` will be true if type `T` has member variables + /// `.x` and `.y`, all of type `Base`, and the size of a `T` is exactly big + /// enough to hold 2 Base values. +-template +-struct has_xy { ++template struct has_xy ++{ + private: + typedef char Yes[1]; + typedef char No[2]; + + // Valid only if .x, .y exist and are the right type: return a Yes. +- template::value), +- IMATH_ENABLE_IF(std::is_same::value)> +- static Yes& test(int); ++ template < ++ typename C, ++ IMATH_ENABLE_IF (std::is_same::value), ++ IMATH_ENABLE_IF (std::is_same::value)> ++ static Yes& test (int); + + // Fallback, default to returning a No. +- template static No& test(...); ++ template static No& test (...); ++ + public: +- enum { value = (sizeof(test(0)) == sizeof(Yes) +- && sizeof(T) == 2*sizeof(Base)) +- }; ++ enum ++ { ++ value = ++ (sizeof (test (0)) == sizeof (Yes) && ++ sizeof (T) == 2 * sizeof (Base)) ++ }; + }; + +- + /// `has_xyz::value` will be true if type `T` has member variables + /// `.x`, `.y`, and `.z`, all of type `Base`, and the size of a `T` is + /// exactly big enough to hold 3 Base values. +-template +-struct has_xyz { ++template struct has_xyz ++{ + private: + typedef char Yes[1]; + typedef char No[2]; + + // Valid only if .x, .y, .z exist and are the right type: return a Yes. +- template::value), +- IMATH_ENABLE_IF(std::is_same::value), +- IMATH_ENABLE_IF(std::is_same::value)> +- static Yes& test(int); ++ template < ++ typename C, ++ IMATH_ENABLE_IF (std::is_same::value), ++ IMATH_ENABLE_IF (std::is_same::value), ++ IMATH_ENABLE_IF (std::is_same::value)> ++ static Yes& test (int); + + // Fallback, default to returning a No. +- template static No& test(...); ++ template static No& test (...); ++ + public: +- enum { value = (sizeof(test(0)) == sizeof(Yes) +- && sizeof(T) == 3*sizeof(Base)) +- }; ++ enum ++ { ++ value = ++ (sizeof (test (0)) == sizeof (Yes) && ++ sizeof (T) == 3 * sizeof (Base)) ++ }; + }; + +- + /// `has_xyzw::value` will be true if type `T` has member variables + /// `.x`, `.y`, `.z`, and `.w`, all of type `Base`, and the size of a `T` is + /// exactly big enough to hold 4 Base values. +-template +-struct has_xyzw { ++template struct has_xyzw ++{ + private: + typedef char Yes[1]; + typedef char No[2]; + + // Valid only if .x, .y, .z, .w exist and are the right type: return a Yes. +- template::value), +- IMATH_ENABLE_IF(std::is_same::value), +- IMATH_ENABLE_IF(std::is_same::value), +- IMATH_ENABLE_IF(std::is_same::value)> +- static Yes& test(int); ++ template < ++ typename C, ++ IMATH_ENABLE_IF (std::is_same::value), ++ IMATH_ENABLE_IF (std::is_same::value), ++ IMATH_ENABLE_IF (std::is_same::value), ++ IMATH_ENABLE_IF (std::is_same::value)> ++ static Yes& test (int); + + // Fallback, default to returning a No. +- template static No& test(...); ++ template static No& test (...); ++ + public: +- enum { value = (sizeof(test(0)) == sizeof(Yes) +- && sizeof(T) == 4*sizeof(Base)) +- }; ++ enum ++ { ++ value = ++ (sizeof (test (0)) == sizeof (Yes) && ++ sizeof (T) == 4 * sizeof (Base)) ++ }; + }; + +- +- + /// `has_subscript::value` will be true if type `T` has + /// subscripting syntax, a `T[int]` returns a `Base`, and the size of a `T` + /// is exactly big enough to hold `Nelem` `Base` values. +-template +-struct has_subscript { ++template struct has_subscript ++{ + private: + typedef char Yes[1]; + typedef char No[2]; + + // Valid only if T[] is possible and is the right type: return a Yes. +- template::type, Base>::value)> +- static Yes& test(int); ++ template < ++ typename C, ++ IMATH_ENABLE_IF (std::is_same< ++ typename std::decay::type, ++ Base>::value)> ++ static Yes& test (int); + + // Fallback, default to returning a No. +- template static No& test(...); ++ template static No& test (...); ++ + public: +- enum { value = (sizeof(test(0)) == sizeof(Yes) +- && sizeof(T) == Nelem*sizeof(Base)) +- }; ++ enum ++ { ++ value = ++ (sizeof (test (0)) == sizeof (Yes) && ++ sizeof (T) == Nelem * sizeof (Base)) ++ }; + }; + +- + /// C arrays of just the right length also are qualified for has_subscript. +-template +-struct has_subscript : public std::true_type { }; +- +- ++template ++struct has_subscript : public std::true_type ++{}; + + /// `has_double_subscript::value` will be true if type `T` + /// has 2-level subscripting syntax, a `T[int][int]` returns a `Base`, and + /// the size of a `T` is exactly big enough to hold `R*C` `Base` values. + template +-struct has_double_subscript { ++struct has_double_subscript ++{ + private: + typedef char Yes[1]; + typedef char No[2]; + + // Valid only if T[][] is possible and is the right type: return a Yes. +- template::type, Base>::value)> +- static Yes& test(int); ++ template < ++ typename C, ++ IMATH_ENABLE_IF (std::is_same< ++ typename std::decay::type, ++ Base>::value)> ++ static Yes& test (int); + + // Fallback, default to returning a No. +- template static No& test(...); ++ template static No& test (...); ++ + public: +- enum { value = (sizeof(test(0)) == sizeof(Yes) +- && sizeof(T) == (Rows*Cols)*sizeof(Base)) +- }; ++ enum ++ { ++ value = ++ (sizeof (test (0)) == sizeof (Yes) && ++ sizeof (T) == (Rows * Cols) * sizeof (Base)) ++ }; + }; + +- + /// C arrays of just the right length also are qualified for has_double_subscript. +-template +-struct has_double_subscript : public std::true_type { }; ++template ++struct has_double_subscript ++ : public std::true_type ++{}; + + /// @} + +diff --git a/src/Imath/ImathVec.h b/src/Imath/ImathVec.h +index 12862bd..93d1fba 100644 +--- a/src/Imath/ImathVec.h ++++ b/src/Imath/ImathVec.h +@@ -1,7 +1,7 @@ + // + // SPDX-License-Identifier: BSD-3-Clause + // Copyright Contributors to the OpenEXR Project. +-// ++// + + // + // 2D, 3D and 4D point/vector class templates +@@ -44,26 +44,25 @@ enum IMATH_EXPORT_ENUM InfException + + template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 + { +- public: +- ++public: + /// @{ + /// @name Direct access to elements +- ++ + T x, y; + + /// @} +- +- /// Element access by index. ++ ++ /// Element access by index. + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T& operator[] (int i) IMATH_NOEXCEPT; + +- /// Element access by index. ++ /// Element access by index. + IMATH_HOSTDEVICE constexpr const T& operator[] (int i) const IMATH_NOEXCEPT; + + /// @{ + /// @name Constructors and Assignment + + /// Uninitialized by default +- IMATH_HOSTDEVICE Vec2() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Vec2 () IMATH_NOEXCEPT; + + /// Initialize to a scalar `(a,a)` + IMATH_HOSTDEVICE constexpr explicit Vec2 (T a) IMATH_NOEXCEPT; +@@ -75,14 +74,15 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 + IMATH_HOSTDEVICE constexpr Vec2 (const Vec2& v) IMATH_NOEXCEPT; + + /// Construct from Vec2 of another base type +- template IMATH_HOSTDEVICE constexpr Vec2 (const Vec2& v) IMATH_NOEXCEPT; +- ++ template ++ IMATH_HOSTDEVICE constexpr Vec2 (const Vec2& v) IMATH_NOEXCEPT; + + /// Assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& operator= (const Vec2& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& ++ operator= (const Vec2& v) IMATH_NOEXCEPT; + + /// Destructor +- ~Vec2() IMATH_NOEXCEPT = default; ++ ~Vec2 () IMATH_NOEXCEPT = default; + + /// @} + +@@ -102,26 +102,33 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 + /// including any Imath header files. + /// + +- template::value)> ++ template ::value)> + IMATH_HOSTDEVICE explicit constexpr Vec2 (const V& v) IMATH_NOEXCEPT +- : Vec2(T(v.x), T(v.y)) { } +- +- template::value +- && !has_xy::value)> +- IMATH_HOSTDEVICE explicit Vec2 (const V& v) : Vec2(T(v[0]), T(v[1])) { } +- +- template::value)> +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& operator= (const V& v) IMATH_NOEXCEPT { +- x = T(v.x); +- y = T(v.y); ++ : Vec2 (T (v.x), T (v.y)) ++ {} ++ ++ template < ++ typename V, ++ IMATH_ENABLE_IF (has_subscript::value && !has_xy::value)> ++ IMATH_HOSTDEVICE explicit Vec2 (const V& v) : Vec2 (T (v[0]), T (v[1])) ++ {} ++ ++ template ::value)> ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& ++ operator= (const V& v) IMATH_NOEXCEPT ++ { ++ x = T (v.x); ++ y = T (v.y); + return *this; + } + +- template::value +- && !has_xy::value)> +- IMATH_HOSTDEVICE const Vec2& operator= (const V& v) { +- x = T(v[0]); +- y = T(v[1]); ++ template < ++ typename V, ++ IMATH_ENABLE_IF (has_subscript::value && !has_xy::value)> ++ IMATH_HOSTDEVICE const Vec2& operator= (const V& v) ++ { ++ x = T (v[0]); ++ y = T (v[1]); + return *this; + } + #endif +@@ -133,45 +140,53 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 + template IMATH_HOSTDEVICE void setValue (S a, S b) IMATH_NOEXCEPT; + + /// Set the value +- template IMATH_HOSTDEVICE void setValue (const Vec2& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void setValue (const Vec2& v) IMATH_NOEXCEPT; + + /// Return the value in `a` and `b` +- template IMATH_HOSTDEVICE void getValue (S& a, S& b) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void getValue (S& a, S& b) const IMATH_NOEXCEPT; + + /// Return the value in `v` +- template IMATH_HOSTDEVICE void getValue (Vec2& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void getValue (Vec2& v) const IMATH_NOEXCEPT; + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE T* getValue() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T* getValue () IMATH_NOEXCEPT; + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE const T* getValue() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const T* getValue () const IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Arithmetic and Comparison +- +- /// Equality +- template IMATH_HOSTDEVICE constexpr bool operator== (const Vec2& v) const IMATH_NOEXCEPT; + ++ /// Equality ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Vec2& v) const IMATH_NOEXCEPT; + + /// Inequality +- template IMATH_HOSTDEVICE constexpr bool operator!= (const Vec2& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Vec2& v) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and `m` are the same + /// with an absolute error of no more than e, i.e., for all i, j: + /// + /// abs (this[i][j] - m[i][j]) <= e +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError (const Vec2& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithAbsError (const Vec2& v, T e) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and m are the same with + /// a relative error of no more than e, i.e., for all i, j: + /// + /// abs (this[i] - v[i][j]) <= e * abs (this[i][j]) +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError (const Vec2& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithRelError (const Vec2& v, T e) const IMATH_NOEXCEPT; + + /// Dot product + IMATH_HOSTDEVICE constexpr T dot (const Vec2& v) const IMATH_NOEXCEPT; +@@ -188,43 +203,53 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 + IMATH_HOSTDEVICE constexpr T operator% (const Vec2& v) const IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& operator+= (const Vec2& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& ++ operator+= (const Vec2& v) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE constexpr Vec2 operator+ (const Vec2& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec2 ++ operator+ (const Vec2& v) const IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& operator-= (const Vec2& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& ++ operator-= (const Vec2& v) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE constexpr Vec2 operator- (const Vec2& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec2 ++ operator- (const Vec2& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE constexpr Vec2 operator-() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec2 operator- () const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& negate() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& negate () IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& operator*= (const Vec2& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& ++ operator*= (const Vec2& v) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& operator*= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& ++ operator*= (T a) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE constexpr Vec2 operator* (const Vec2& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec2 ++ operator* (const Vec2& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication + IMATH_HOSTDEVICE constexpr Vec2 operator* (T a) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& operator/= (const Vec2& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& ++ operator/= (const Vec2& v) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& operator/= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec2& ++ operator/= (T a) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE constexpr Vec2 operator/ (const Vec2& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec2 ++ operator/ (const Vec2& v) const IMATH_NOEXCEPT; + + /// Component-wise division + IMATH_HOSTDEVICE constexpr Vec2 operator/ (T a) const IMATH_NOEXCEPT; +@@ -235,65 +260,79 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 + /// @name Query and Manipulation + + /// Return the Euclidean norm +- IMATH_HOSTDEVICE T length() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT; + + /// Return the square of the Euclidean norm, i.e. the dot product + /// with itself. +- IMATH_HOSTDEVICE constexpr T length2() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT; + + /// Normalize in place. If length()==0, return a null vector. +- IMATH_HOSTDEVICE const Vec2& normalize() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const Vec2& normalize () IMATH_NOEXCEPT; + + /// Normalize in place. If length()==0, throw an exception. +- const Vec2& normalizeExc(); +- ++ const Vec2& normalizeExc (); ++ + /// Normalize without any checks for length()==0. Slightly faster + /// than the other normalization routines, but if v.length() is + /// 0.0, the result is undefined. +- IMATH_HOSTDEVICE const Vec2& normalizeNonNull() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const Vec2& normalizeNonNull () IMATH_NOEXCEPT; + + /// Return a normalized vector. Does not modify *this. +- IMATH_HOSTDEVICE Vec2 normalized() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Vec2 normalized () const IMATH_NOEXCEPT; + + /// Return a normalized vector. Does not modify *this. Throw an + /// exception if length()==0. +- Vec2 normalizedExc() const; ++ Vec2 normalizedExc () const; + + /// Return a normalized vector. Does not modify *this, and does + /// not check for length()==0. Slightly faster than the other + /// normalization routines, but if v.length() is 0.0, the result + /// is undefined. +- IMATH_HOSTDEVICE Vec2 normalizedNonNull() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Vec2 normalizedNonNull () const IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Numeric Limits +- ++ + /// Largest possible negative value +- IMATH_HOSTDEVICE constexpr static T baseTypeLowest() IMATH_NOEXCEPT { return std::numeric_limits::lowest(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeLowest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::lowest (); ++ } + + /// Largest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeMax() IMATH_NOEXCEPT { return std::numeric_limits::max(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeMax () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::max (); ++ } + + /// Smallest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeSmallest() IMATH_NOEXCEPT { return std::numeric_limits::min(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeSmallest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::min (); ++ } + + /// Smallest possible e for which 1+e != 1 +- IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon() IMATH_NOEXCEPT { return std::numeric_limits::epsilon(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::epsilon (); ++ } + + /// @} +- ++ + /// Return the number of dimensions, i.e. 2 +- IMATH_HOSTDEVICE constexpr static unsigned int dimensions() IMATH_NOEXCEPT { return 2; } ++ IMATH_HOSTDEVICE constexpr static unsigned int dimensions () IMATH_NOEXCEPT ++ { ++ return 2; ++ } + + /// The base type: In templates that accept a parameter `V`, you + /// can refer to `T` as `V::BaseType` + typedef T BaseType; + +- private: +- +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T lengthTiny() const IMATH_NOEXCEPT; ++private: ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T lengthTiny () const IMATH_NOEXCEPT; + }; + + /// +@@ -302,27 +341,26 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec2 + + template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 + { +- public: +- ++public: + /// @{ + /// @name Direct access to elements + + T x, y, z; + + /// @} +- +- /// Element access by index. ++ ++ /// Element access by index. + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T& operator[] (int i) IMATH_NOEXCEPT; + +- /// Element access by index. ++ /// Element access by index. + IMATH_HOSTDEVICE constexpr const T& operator[] (int i) const IMATH_NOEXCEPT; + + /// @{ + /// @name Constructors and Assignment + + /// Uninitialized by default +- IMATH_HOSTDEVICE Vec3() IMATH_NOEXCEPT; +- ++ IMATH_HOSTDEVICE Vec3 () IMATH_NOEXCEPT; ++ + /// Initialize to a scalar `(a,a,a)` + IMATH_HOSTDEVICE constexpr explicit Vec3 (T a) IMATH_NOEXCEPT; + +@@ -333,23 +371,27 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 + IMATH_HOSTDEVICE constexpr Vec3 (const Vec3& v) IMATH_NOEXCEPT; + + /// Construct from Vec3 of another base type +- template IMATH_HOSTDEVICE constexpr Vec3 (const Vec3& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr Vec3 (const Vec3& v) IMATH_NOEXCEPT; + + /// Vec4 to Vec3 conversion: divide x, y and z by w, even if w is + /// 0. The result depends on how the environment handles + /// floating-point exceptions. +- template IMATH_HOSTDEVICE explicit constexpr Vec3 (const Vec4& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE explicit constexpr Vec3 (const Vec4& v) IMATH_NOEXCEPT; + + /// Vec4 to Vec3 conversion: divide x, y and z by w. Throws an + /// exception if w is zero or if division by w would overflow. + template +- explicit IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 (const Vec4& v, InfException); ++ explicit IMATH_HOSTDEVICE IMATH_CONSTEXPR14 ++ Vec3 (const Vec4& v, InfException); + + /// Assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator= (const Vec3& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& ++ operator= (const Vec3& v) IMATH_NOEXCEPT; + + /// Destructor +- ~Vec3() IMATH_NOEXCEPT = default; ++ ~Vec3 () IMATH_NOEXCEPT = default; + + /// @} + +@@ -369,30 +411,39 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 + /// including any Imath header files. + /// + +- template::value)> ++ template ::value)> + IMATH_HOSTDEVICE explicit constexpr Vec3 (const V& v) IMATH_NOEXCEPT +- : Vec3(T(v.x), T(v.y), T(v.z)) { } ++ : Vec3 (T (v.x), T (v.y), T (v.z)) ++ {} + +- template::value +- && !has_xyz::value)> +- IMATH_HOSTDEVICE explicit Vec3 (const V& v) : Vec3(T(v[0]), T(v[1]), T(v[2])) { } ++ template < ++ typename V, ++ IMATH_ENABLE_IF ( ++ has_subscript::value && !has_xyz::value)> ++ IMATH_HOSTDEVICE explicit Vec3 (const V& v) ++ : Vec3 (T (v[0]), T (v[1]), T (v[2])) ++ {} + + /// Interoperability assignment from another type that behaves as if it + /// were an equivalent vector. +- template::value)> +- IMATH_HOSTDEVICE const Vec3& operator= (const V& v) IMATH_NOEXCEPT { +- x = T(v.x); +- y = T(v.y); +- z = T(v.z); ++ template ::value)> ++ IMATH_HOSTDEVICE const Vec3& operator= (const V& v) IMATH_NOEXCEPT ++ { ++ x = T (v.x); ++ y = T (v.y); ++ z = T (v.z); + return *this; + } + +- template::value +- && !has_xyz::value)> +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator= (const V& v) { +- x = T(v[0]); +- y = T(v[1]); +- z = T(v[2]); ++ template < ++ typename V, ++ IMATH_ENABLE_IF ( ++ has_subscript::value && !has_xyz::value)> ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator= (const V& v) ++ { ++ x = T (v[0]); ++ y = T (v[1]); ++ z = T (v[2]); + return *this; + } + /// @} +@@ -402,47 +453,57 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 + /// @name Compatibility with Sb + + /// Set the value +- template IMATH_HOSTDEVICE void setValue (S a, S b, S c) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void setValue (S a, S b, S c) IMATH_NOEXCEPT; + + /// Set the value +- template IMATH_HOSTDEVICE void setValue (const Vec3& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void setValue (const Vec3& v) IMATH_NOEXCEPT; + + /// Return the value in `a`, `b`, and `c` +- template IMATH_HOSTDEVICE void getValue (S& a, S& b, S& c) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void getValue (S& a, S& b, S& c) const IMATH_NOEXCEPT; + + /// Return the value in `v` +- template IMATH_HOSTDEVICE void getValue (Vec3& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE void getValue (Vec3& v) const IMATH_NOEXCEPT; + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE T* getValue() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T* getValue () IMATH_NOEXCEPT; + + /// Return a raw pointer to the array of values +- IMATH_HOSTDEVICE const T* getValue() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const T* getValue () const IMATH_NOEXCEPT; + + /// @} + + /// @{ + /// @name Arithmetic and Comparison +- ++ + /// Equality +- template IMATH_HOSTDEVICE constexpr bool operator== (const Vec3& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Vec3& v) const IMATH_NOEXCEPT; + + /// Inequality +- template IMATH_HOSTDEVICE constexpr bool operator!= (const Vec3& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Vec3& v) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and `m` are the same + /// with an absolute error of no more than e, i.e., for all i, j: + /// + /// abs (this[i][j] - m[i][j]) <= e +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError (const Vec3& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithAbsError (const Vec3& v, T e) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and m are the same with + /// a relative error of no more than e, i.e., for all i, j: + /// + /// abs (this[i] - v[i][j]) <= e * abs (this[i][j]) +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError (const Vec3& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithRelError (const Vec3& v, T e) const IMATH_NOEXCEPT; + + /// Dot product + IMATH_HOSTDEVICE constexpr T dot (const Vec3& v) const IMATH_NOEXCEPT; +@@ -454,49 +515,61 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 + IMATH_HOSTDEVICE constexpr Vec3 cross (const Vec3& v) const IMATH_NOEXCEPT; + + /// Right-handed cross product +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator%= (const Vec3& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& ++ operator%= (const Vec3& v) IMATH_NOEXCEPT; + + /// Right-handed cross product +- IMATH_HOSTDEVICE constexpr Vec3 operator% (const Vec3& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 ++ operator% (const Vec3& v) const IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator+= (const Vec3& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& ++ operator+= (const Vec3& v) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE constexpr Vec3 operator+ (const Vec3& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 ++ operator+ (const Vec3& v) const IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator-= (const Vec3& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& ++ operator-= (const Vec3& v) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE constexpr Vec3 operator- (const Vec3& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 ++ operator- (const Vec3& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE constexpr Vec3 operator-() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 operator- () const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& negate() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& negate () IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator*= (const Vec3& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& ++ operator*= (const Vec3& v) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator*= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& ++ operator*= (T a) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE constexpr Vec3 operator* (const Vec3& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 ++ operator* (const Vec3& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication + IMATH_HOSTDEVICE constexpr Vec3 operator* (T a) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator/= (const Vec3& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& ++ operator/= (const Vec3& v) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& operator/= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec3& ++ operator/= (T a) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE constexpr Vec3 operator/ (const Vec3& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec3 ++ operator/ (const Vec3& v) const IMATH_NOEXCEPT; + + /// Component-wise division + IMATH_HOSTDEVICE constexpr Vec3 operator/ (T a) const IMATH_NOEXCEPT; +@@ -507,35 +580,36 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 + /// @name Query and Manipulation + + /// Return the Euclidean norm +- IMATH_HOSTDEVICE T length() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT; + + /// Return the square of the Euclidean norm, i.e. the dot product + /// with itself. +- IMATH_HOSTDEVICE constexpr T length2() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT; + + /// Normalize in place. If length()==0, return a null vector. +- IMATH_HOSTDEVICE const Vec3& normalize() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const Vec3& normalize () IMATH_NOEXCEPT; + + /// Normalize in place. If length()==0, throw an exception. +- const Vec3& normalizeExc(); ++ const Vec3& normalizeExc (); + + /// Normalize without any checks for length()==0. Slightly faster + /// than the other normalization routines, but if v.length() is + /// 0.0, the result is undefined. +- IMATH_HOSTDEVICE const Vec3& normalizeNonNull() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const Vec3& normalizeNonNull () IMATH_NOEXCEPT; + + /// Return a normalized vector. Does not modify *this. +- IMATH_HOSTDEVICE Vec3 normalized() const IMATH_NOEXCEPT; // does not modify *this ++ IMATH_HOSTDEVICE Vec3 ++ normalized () const IMATH_NOEXCEPT; // does not modify *this + + /// Return a normalized vector. Does not modify *this. Throw an + /// exception if length()==0. +- Vec3 normalizedExc() const; ++ Vec3 normalizedExc () const; + + /// Return a normalized vector. Does not modify *this, and does + /// not check for length()==0. Slightly faster than the other + /// normalization routines, but if v.length() is 0.0, the result + /// is undefined. +- IMATH_HOSTDEVICE Vec3 normalizedNonNull() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Vec3 normalizedNonNull () const IMATH_NOEXCEPT; + + /// @} + +@@ -543,28 +617,43 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 + /// @name Numeric Limits + + /// Largest possible negative value +- IMATH_HOSTDEVICE constexpr static T baseTypeLowest() IMATH_NOEXCEPT { return std::numeric_limits::lowest(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeLowest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::lowest (); ++ } + + /// Largest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeMax() IMATH_NOEXCEPT { return std::numeric_limits::max(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeMax () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::max (); ++ } + + /// Smallest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeSmallest() IMATH_NOEXCEPT { return std::numeric_limits::min(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeSmallest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::min (); ++ } + + /// Smallest possible e for which 1+e != 1 +- IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon() IMATH_NOEXCEPT { return std::numeric_limits::epsilon(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::epsilon (); ++ } + + /// @} +- ++ + /// Return the number of dimensions, i.e. 3 +- IMATH_HOSTDEVICE constexpr static unsigned int dimensions() IMATH_NOEXCEPT { return 3; } ++ IMATH_HOSTDEVICE constexpr static unsigned int dimensions () IMATH_NOEXCEPT ++ { ++ return 3; ++ } + + /// The base type: In templates that accept a parameter `V`, you + /// can refer to `T` as `V::BaseType` + typedef T BaseType; + +- private: +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T lengthTiny() const IMATH_NOEXCEPT; ++private: ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T lengthTiny () const IMATH_NOEXCEPT; + }; + + /// +@@ -573,26 +662,25 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec3 + + template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 + { +- public: +- ++public: + /// @{ + /// @name Direct access to elements + + T x, y, z, w; + + /// @} +- +- /// Element access by index. ++ ++ /// Element access by index. + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T& operator[] (int i) IMATH_NOEXCEPT; + +- /// Element access by index. ++ /// Element access by index. + IMATH_HOSTDEVICE constexpr const T& operator[] (int i) const IMATH_NOEXCEPT; + + /// @{ + /// @name Constructors and Assignment + + /// Uninitialized by default +- IMATH_HOSTDEVICE Vec4() IMATH_NOEXCEPT; // no initialization ++ IMATH_HOSTDEVICE Vec4 () IMATH_NOEXCEPT; // no initialization + + /// Initialize to a scalar `(a,a,a,a)` + IMATH_HOSTDEVICE constexpr explicit Vec4 (T a) IMATH_NOEXCEPT; +@@ -604,16 +692,19 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 + IMATH_HOSTDEVICE constexpr Vec4 (const Vec4& v) IMATH_NOEXCEPT; + + /// Construct from Vec4 of another base type +- template IMATH_HOSTDEVICE constexpr Vec4 (const Vec4& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr Vec4 (const Vec4& v) IMATH_NOEXCEPT; + + /// Vec3 to Vec4 conversion, sets w to 1. +- template IMATH_HOSTDEVICE explicit constexpr Vec4 (const Vec3& v) IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE explicit constexpr Vec4 (const Vec3& v) IMATH_NOEXCEPT; + + /// Assignment +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator= (const Vec4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& ++ operator= (const Vec4& v) IMATH_NOEXCEPT; + + /// Destructor +- ~Vec4() IMATH_NOEXCEPT = default; ++ ~Vec4 () IMATH_NOEXCEPT = default; + + /// @} + +@@ -633,30 +724,40 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 + /// including any Imath header files. + /// + +- template::value)> ++ template ::value)> + IMATH_HOSTDEVICE explicit constexpr Vec4 (const V& v) IMATH_NOEXCEPT +- : Vec4(T(v.x), T(v.y), T(v.z), T(v.w)) { } +- +- template::value +- && !has_xyzw::value)> +- IMATH_HOSTDEVICE explicit Vec4 (const V& v) : Vec4(T(v[0]), T(v[1]), T(v[2]), T(v[3])) { } +- +- template::value)> +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator= (const V& v) IMATH_NOEXCEPT { +- x = T(v.x); +- y = T(v.y); +- z = T(v.z); +- w = T(v.w); ++ : Vec4 (T (v.x), T (v.y), T (v.z), T (v.w)) ++ {} ++ ++ template < ++ typename V, ++ IMATH_ENABLE_IF ( ++ has_subscript::value && !has_xyzw::value)> ++ IMATH_HOSTDEVICE explicit Vec4 (const V& v) ++ : Vec4 (T (v[0]), T (v[1]), T (v[2]), T (v[3])) ++ {} ++ ++ template ::value)> ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& ++ operator= (const V& v) IMATH_NOEXCEPT ++ { ++ x = T (v.x); ++ y = T (v.y); ++ z = T (v.z); ++ w = T (v.w); + return *this; + } + +- template::value +- && !has_xyzw::value)> +- IMATH_HOSTDEVICE const Vec4& operator= (const V& v) { +- x = T(v[0]); +- y = T(v[1]); +- z = T(v[2]); +- w = T(v[3]); ++ template < ++ typename V, ++ IMATH_ENABLE_IF ( ++ has_subscript::value && !has_xyzw::value)> ++ IMATH_HOSTDEVICE const Vec4& operator= (const V& v) ++ { ++ x = T (v[0]); ++ y = T (v[1]); ++ z = T (v[2]); ++ w = T (v[3]); + return *this; + } + /// @} +@@ -664,26 +765,32 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 + + /// @{ + /// @name Arithmetic and Comparison +- ++ + /// Equality +- template IMATH_HOSTDEVICE constexpr bool operator== (const Vec4& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator== (const Vec4& v) const IMATH_NOEXCEPT; + + /// Inequality +- template IMATH_HOSTDEVICE constexpr bool operator!= (const Vec4& v) const IMATH_NOEXCEPT; ++ template ++ IMATH_HOSTDEVICE constexpr bool ++ operator!= (const Vec4& v) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and `m` are the same + /// with an absolute error of no more than e, i.e., for all i, j: + /// + /// abs (this[i][j] - m[i][j]) <= e +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithAbsError (const Vec4& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithAbsError (const Vec4& v, T e) const IMATH_NOEXCEPT; + + /// Compare two matrices and test if they are "approximately equal": + /// @return True if the coefficients of this and m are the same with + /// a relative error of no more than e, i.e., for all i, j: + /// + /// abs (this[i] - v[i][j]) <= e * abs (this[i][j]) +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool equalWithRelError (const Vec4& v, T e) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool ++ equalWithRelError (const Vec4& v, T e) const IMATH_NOEXCEPT; + + /// Dot product + IMATH_HOSTDEVICE constexpr T dot (const Vec4& v) const IMATH_NOEXCEPT; +@@ -692,43 +799,53 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 + IMATH_HOSTDEVICE constexpr T operator^ (const Vec4& v) const IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator+= (const Vec4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& ++ operator+= (const Vec4& v) IMATH_NOEXCEPT; + + /// Component-wise addition +- IMATH_HOSTDEVICE constexpr Vec4 operator+ (const Vec4& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec4 ++ operator+ (const Vec4& v) const IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator-= (const Vec4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& ++ operator-= (const Vec4& v) IMATH_NOEXCEPT; + + /// Component-wise subtraction +- IMATH_HOSTDEVICE constexpr Vec4 operator- (const Vec4& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec4 ++ operator- (const Vec4& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE constexpr Vec4 operator-() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec4 operator- () const IMATH_NOEXCEPT; + + /// Component-wise multiplication by -1 +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& negate() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& negate () IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator*= (const Vec4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& ++ operator*= (const Vec4& v) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator*= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& ++ operator*= (T a) IMATH_NOEXCEPT; + + /// Component-wise multiplication +- IMATH_HOSTDEVICE constexpr Vec4 operator* (const Vec4& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec4 ++ operator* (const Vec4& v) const IMATH_NOEXCEPT; + + /// Component-wise multiplication + IMATH_HOSTDEVICE constexpr Vec4 operator* (T a) const IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator/= (const Vec4& v) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& ++ operator/= (const Vec4& v) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& operator/= (T a) IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Vec4& ++ operator/= (T a) IMATH_NOEXCEPT; + + /// Component-wise division +- IMATH_HOSTDEVICE constexpr Vec4 operator/ (const Vec4& v) const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr Vec4 ++ operator/ (const Vec4& v) const IMATH_NOEXCEPT; + + /// Component-wise division + IMATH_HOSTDEVICE constexpr Vec4 operator/ (T a) const IMATH_NOEXCEPT; +@@ -739,64 +856,80 @@ template class IMATH_EXPORT_TEMPLATE_TYPE Vec4 + /// @name Query and Manipulation + + /// Return the Euclidean norm +- IMATH_HOSTDEVICE T length() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT; + + /// Return the square of the Euclidean norm, i.e. the dot product + /// with itself. +- IMATH_HOSTDEVICE constexpr T length2() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT; + + /// Normalize in place. If length()==0, return a null vector. +- IMATH_HOSTDEVICE const Vec4& normalize() IMATH_NOEXCEPT; // modifies *this ++ IMATH_HOSTDEVICE const Vec4& normalize () IMATH_NOEXCEPT; // modifies *this + + /// Normalize in place. If length()==0, throw an exception. +- const Vec4& normalizeExc(); ++ const Vec4& normalizeExc (); + + /// Normalize without any checks for length()==0. Slightly faster + /// than the other normalization routines, but if v.length() is + /// 0.0, the result is undefined. +- IMATH_HOSTDEVICE const Vec4& normalizeNonNull() IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE const Vec4& normalizeNonNull () IMATH_NOEXCEPT; + + /// Return a normalized vector. Does not modify *this. +- IMATH_HOSTDEVICE Vec4 normalized() const IMATH_NOEXCEPT; // does not modify *this ++ IMATH_HOSTDEVICE Vec4 ++ normalized () const IMATH_NOEXCEPT; // does not modify *this + + /// Return a normalized vector. Does not modify *this. Throw an + /// exception if length()==0. +- Vec4 normalizedExc() const; ++ Vec4 normalizedExc () const; + + /// Return a normalized vector. Does not modify *this, and does + /// not check for length()==0. Slightly faster than the other + /// normalization routines, but if v.length() is 0.0, the result + /// is undefined. +- IMATH_HOSTDEVICE Vec4 normalizedNonNull() const IMATH_NOEXCEPT; ++ IMATH_HOSTDEVICE Vec4 normalizedNonNull () const IMATH_NOEXCEPT; + + /// @} +- ++ + /// @{ + /// @name Numeric Limits +- ++ + /// Largest possible negative value +- IMATH_HOSTDEVICE constexpr static T baseTypeLowest() IMATH_NOEXCEPT { return std::numeric_limits::lowest(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeLowest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::lowest (); ++ } + + /// Largest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeMax() IMATH_NOEXCEPT { return std::numeric_limits::max(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeMax () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::max (); ++ } + + /// Smallest possible positive value +- IMATH_HOSTDEVICE constexpr static T baseTypeSmallest() IMATH_NOEXCEPT { return std::numeric_limits::min(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeSmallest () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::min (); ++ } + + /// Smallest possible e for which 1+e != 1 +- IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon() IMATH_NOEXCEPT { return std::numeric_limits::epsilon(); } ++ IMATH_HOSTDEVICE constexpr static T baseTypeEpsilon () IMATH_NOEXCEPT ++ { ++ return std::numeric_limits::epsilon (); ++ } + + /// @} +- ++ + /// Return the number of dimensions, i.e. 4 +- IMATH_HOSTDEVICE constexpr static unsigned int dimensions() IMATH_NOEXCEPT { return 4; } ++ IMATH_HOSTDEVICE constexpr static unsigned int dimensions () IMATH_NOEXCEPT ++ { ++ return 4; ++ } + + /// The base type: In templates that accept a parameter `V`, you + /// can refer to `T` as `V::BaseType` + typedef T BaseType; + +- private: +- IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T lengthTiny() const IMATH_NOEXCEPT; ++private: ++ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 T lengthTiny () const IMATH_NOEXCEPT; + }; + + /// Stream output, as "(x y)" +@@ -809,13 +942,19 @@ template std::ostream& operator<< (std::ostream& s, const Vec3& v); + template std::ostream& operator<< (std::ostream& s, const Vec4& v); + + /// Reverse multiplication: S * Vec2 +-template IMATH_HOSTDEVICE constexpr Vec2 operator* (T a, const Vec2& v) IMATH_NOEXCEPT; ++template ++IMATH_HOSTDEVICE constexpr Vec2 ++operator* (T a, const Vec2& v) IMATH_NOEXCEPT; + + /// Reverse multiplication: S * Vec3 +-template IMATH_HOSTDEVICE constexpr Vec3 operator* (T a, const Vec3& v) IMATH_NOEXCEPT; ++template ++IMATH_HOSTDEVICE constexpr Vec3 ++operator* (T a, const Vec3& v) IMATH_NOEXCEPT; + + /// Reverse multiplication: S * Vec4 +-template IMATH_HOSTDEVICE constexpr Vec4 operator* (T a, const Vec4& v) IMATH_NOEXCEPT; ++template ++IMATH_HOSTDEVICE constexpr Vec4 ++operator* (T a, const Vec4& v) IMATH_NOEXCEPT; + + //------------------------- + // Typedefs for convenience +@@ -875,85 +1014,166 @@ typedef Vec4 V4d; + /// @cond Doxygen_Suppress + + // Vec2 +-template <> IMATH_HOSTDEVICE short Vec2::length() const IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE const Vec2& Vec2::normalize() IMATH_NOEXCEPT = delete; +-template <> const Vec2& Vec2::normalizeExc() = delete; +-template <> IMATH_HOSTDEVICE const Vec2& Vec2::normalizeNonNull() IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE Vec2 Vec2::normalized() const IMATH_NOEXCEPT = delete; +-template <> Vec2 Vec2::normalizedExc() const = delete; +-template <> IMATH_HOSTDEVICE Vec2 Vec2::normalizedNonNull() const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE short Vec2::length () const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE const Vec2& ++ Vec2::normalize () IMATH_NOEXCEPT = delete; ++template <> const Vec2& Vec2::normalizeExc () = delete; ++template <> ++IMATH_HOSTDEVICE const Vec2& ++ Vec2::normalizeNonNull () IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE Vec2 ++ Vec2::normalized () const IMATH_NOEXCEPT = delete; ++template <> Vec2 Vec2::normalizedExc () const = delete; ++template <> ++IMATH_HOSTDEVICE Vec2 ++Vec2::normalizedNonNull () const IMATH_NOEXCEPT = delete; + + // Vec2 +-template <> IMATH_HOSTDEVICE int Vec2::length() const IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE const Vec2& Vec2::normalize() IMATH_NOEXCEPT = delete; +-template <> const Vec2& Vec2::normalizeExc() = delete; +-template <> IMATH_HOSTDEVICE const Vec2& Vec2::normalizeNonNull() IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE Vec2 Vec2::normalized() const IMATH_NOEXCEPT = delete; +-template <> Vec2 Vec2::normalizedExc() const = delete; +-template <> IMATH_HOSTDEVICE Vec2 Vec2::normalizedNonNull() const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE int Vec2::length () const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE const Vec2& ++ Vec2::normalize () IMATH_NOEXCEPT = delete; ++template <> const Vec2& Vec2::normalizeExc () = delete; ++template <> ++IMATH_HOSTDEVICE const Vec2& ++ Vec2::normalizeNonNull () IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE Vec2 ++ Vec2::normalized () const IMATH_NOEXCEPT = delete; ++template <> Vec2 Vec2::normalizedExc () const = delete; ++template <> ++IMATH_HOSTDEVICE Vec2 ++ Vec2::normalizedNonNull () const IMATH_NOEXCEPT = delete; + + // Vec2 +-template <> IMATH_HOSTDEVICE int64_t Vec2::length() const IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE const Vec2& Vec2::normalize() IMATH_NOEXCEPT = delete; +-template <> const Vec2& Vec2::normalizeExc() = delete; +-template <> IMATH_HOSTDEVICE const Vec2& Vec2::normalizeNonNull() IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE Vec2 Vec2::normalized() const IMATH_NOEXCEPT = delete; +-template <> Vec2 Vec2::normalizedExc() const = delete; +-template <> IMATH_HOSTDEVICE Vec2 Vec2::normalizedNonNull() const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE int64_t Vec2::length () const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE const Vec2& ++ Vec2::normalize () IMATH_NOEXCEPT = delete; ++template <> const Vec2& Vec2::normalizeExc () = delete; ++template <> ++IMATH_HOSTDEVICE const Vec2& ++Vec2::normalizeNonNull () IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE Vec2 ++ Vec2::normalized () const IMATH_NOEXCEPT = delete; ++template <> Vec2 Vec2::normalizedExc () const = delete; ++template <> ++IMATH_HOSTDEVICE Vec2 ++Vec2::normalizedNonNull () const IMATH_NOEXCEPT = delete; + + // Vec3 +-template <> IMATH_HOSTDEVICE short Vec3::length() const IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE const Vec3& Vec3::normalize() IMATH_NOEXCEPT = delete; +-template <> const Vec3& Vec3::normalizeExc() = delete; +-template <> IMATH_HOSTDEVICE const Vec3& Vec3::normalizeNonNull() IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE Vec3 Vec3::normalized() const IMATH_NOEXCEPT = delete; +-template <> Vec3 Vec3::normalizedExc() const = delete; +-template <> IMATH_HOSTDEVICE Vec3 Vec3::normalizedNonNull() const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE short Vec3::length () const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE const Vec3& ++ Vec3::normalize () IMATH_NOEXCEPT = delete; ++template <> const Vec3& Vec3::normalizeExc () = delete; ++template <> ++IMATH_HOSTDEVICE const Vec3& ++ Vec3::normalizeNonNull () IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE Vec3 ++ Vec3::normalized () const IMATH_NOEXCEPT = delete; ++template <> Vec3 Vec3::normalizedExc () const = delete; ++template <> ++IMATH_HOSTDEVICE Vec3 ++Vec3::normalizedNonNull () const IMATH_NOEXCEPT = delete; + + // Vec3 +-template <> IMATH_HOSTDEVICE int Vec3::length() const IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE const Vec3& Vec3::normalize() IMATH_NOEXCEPT = delete; +-template <> const Vec3& Vec3::normalizeExc() = delete; +-template <> IMATH_HOSTDEVICE const Vec3& Vec3::normalizeNonNull() IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE Vec3 Vec3::normalized() const IMATH_NOEXCEPT = delete; +-template <> Vec3 Vec3::normalizedExc() const = delete; +-template <> IMATH_HOSTDEVICE Vec3 Vec3::normalizedNonNull() const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE int Vec3::length () const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE const Vec3& ++ Vec3::normalize () IMATH_NOEXCEPT = delete; ++template <> const Vec3& Vec3::normalizeExc () = delete; ++template <> ++IMATH_HOSTDEVICE const Vec3& ++ Vec3::normalizeNonNull () IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE Vec3 ++ Vec3::normalized () const IMATH_NOEXCEPT = delete; ++template <> Vec3 Vec3::normalizedExc () const = delete; ++template <> ++IMATH_HOSTDEVICE Vec3 ++ Vec3::normalizedNonNull () const IMATH_NOEXCEPT = delete; + + // Vec3 +-template <> IMATH_HOSTDEVICE int64_t Vec3::length() const IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE const Vec3& Vec3::normalize() IMATH_NOEXCEPT = delete; +-template <> const Vec3& Vec3::normalizeExc() = delete; +-template <> IMATH_HOSTDEVICE const Vec3& Vec3::normalizeNonNull() IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE Vec3 Vec3::normalized() const IMATH_NOEXCEPT = delete; +-template <> Vec3 Vec3::normalizedExc() const = delete; +-template <> IMATH_HOSTDEVICE Vec3 Vec3::normalizedNonNull() const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE int64_t Vec3::length () const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE const Vec3& ++ Vec3::normalize () IMATH_NOEXCEPT = delete; ++template <> const Vec3& Vec3::normalizeExc () = delete; ++template <> ++IMATH_HOSTDEVICE const Vec3& ++Vec3::normalizeNonNull () IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE Vec3 ++ Vec3::normalized () const IMATH_NOEXCEPT = delete; ++template <> Vec3 Vec3::normalizedExc () const = delete; ++template <> ++IMATH_HOSTDEVICE Vec3 ++Vec3::normalizedNonNull () const IMATH_NOEXCEPT = delete; + + // Vec4 +-template <> IMATH_HOSTDEVICE short Vec4::length() const IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE const Vec4& Vec4::normalize() IMATH_NOEXCEPT = delete; +-template <> const Vec4& Vec4::normalizeExc() = delete; +-template <> IMATH_HOSTDEVICE const Vec4& Vec4::normalizeNonNull() IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE Vec4 Vec4::normalized() const IMATH_NOEXCEPT = delete; +-template <> Vec4 Vec4::normalizedExc() const = delete; +-template <> IMATH_HOSTDEVICE Vec4 Vec4::normalizedNonNull() const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE short Vec4::length () const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE const Vec4& ++ Vec4::normalize () IMATH_NOEXCEPT = delete; ++template <> const Vec4& Vec4::normalizeExc () = delete; ++template <> ++IMATH_HOSTDEVICE const Vec4& ++ Vec4::normalizeNonNull () IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE Vec4 ++ Vec4::normalized () const IMATH_NOEXCEPT = delete; ++template <> Vec4 Vec4::normalizedExc () const = delete; ++template <> ++IMATH_HOSTDEVICE Vec4 ++Vec4::normalizedNonNull () const IMATH_NOEXCEPT = delete; + + // Vec4 +-template <> IMATH_HOSTDEVICE int Vec4::length() const IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE const Vec4& Vec4::normalize() IMATH_NOEXCEPT = delete; +-template <> const Vec4& Vec4::normalizeExc() = delete; +-template <> IMATH_HOSTDEVICE const Vec4& Vec4::normalizeNonNull() IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE Vec4 Vec4::normalized() const IMATH_NOEXCEPT = delete; +-template <> Vec4 Vec4::normalizedExc() const = delete; +-template <> IMATH_HOSTDEVICE Vec4 Vec4::normalizedNonNull() const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE int Vec4::length () const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE const Vec4& ++ Vec4::normalize () IMATH_NOEXCEPT = delete; ++template <> const Vec4& Vec4::normalizeExc () = delete; ++template <> ++IMATH_HOSTDEVICE const Vec4& ++ Vec4::normalizeNonNull () IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE Vec4 ++ Vec4::normalized () const IMATH_NOEXCEPT = delete; ++template <> Vec4 Vec4::normalizedExc () const = delete; ++template <> ++IMATH_HOSTDEVICE Vec4 ++ Vec4::normalizedNonNull () const IMATH_NOEXCEPT = delete; + + // Vec4 +-template <> IMATH_HOSTDEVICE int64_t Vec4::length() const IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE const Vec4& Vec4::normalize() IMATH_NOEXCEPT = delete; +-template <> const Vec4& Vec4::normalizeExc() = delete; +-template <> IMATH_HOSTDEVICE const Vec4& Vec4::normalizeNonNull() IMATH_NOEXCEPT = delete; +-template <> IMATH_HOSTDEVICE Vec4 Vec4::normalized() const IMATH_NOEXCEPT = delete; +-template <> Vec4 Vec4::normalizedExc() const = delete; +-template <> IMATH_HOSTDEVICE Vec4 Vec4::normalizedNonNull() const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE int64_t Vec4::length () const IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE const Vec4& ++ Vec4::normalize () IMATH_NOEXCEPT = delete; ++template <> const Vec4& Vec4::normalizeExc () = delete; ++template <> ++IMATH_HOSTDEVICE const Vec4& ++Vec4::normalizeNonNull () IMATH_NOEXCEPT = delete; ++template <> ++IMATH_HOSTDEVICE Vec4 ++ Vec4::normalized () const IMATH_NOEXCEPT = delete; ++template <> Vec4 Vec4::normalizedExc () const = delete; ++template <> ++IMATH_HOSTDEVICE Vec4 ++Vec4::normalizedNonNull () const IMATH_NOEXCEPT = delete; + + /// @endcond Doxygen_Suppress + +@@ -975,30 +1195,34 @@ Vec2::operator[] (int i) const IMATH_NOEXCEPT + return (&x)[i]; // NOSONAR - suppress SonarCloud bug report. + } + +-template IMATH_HOSTDEVICE inline Vec2::Vec2() IMATH_NOEXCEPT ++template IMATH_HOSTDEVICE inline Vec2::Vec2 () IMATH_NOEXCEPT + { + // empty, and not constexpr because data is uninitialized. + } + +-template IMATH_HOSTDEVICE constexpr inline Vec2::Vec2 (T a) IMATH_NOEXCEPT +- : x(a), y(a) +-{ +-} ++template ++IMATH_HOSTDEVICE constexpr inline Vec2::Vec2 (T a) IMATH_NOEXCEPT : x (a), ++ y (a) ++{} + +-template IMATH_HOSTDEVICE constexpr inline Vec2::Vec2 (T a, T b) IMATH_NOEXCEPT +- : x(a), y(b) +-{ +-} ++template ++IMATH_HOSTDEVICE constexpr inline Vec2::Vec2 (T a, T b) IMATH_NOEXCEPT ++ : x (a), ++ y (b) ++{} + +-template IMATH_HOSTDEVICE constexpr inline Vec2::Vec2 (const Vec2& v) IMATH_NOEXCEPT +- : x(v.x), y(v.y) +-{ +-} ++template ++IMATH_HOSTDEVICE constexpr inline Vec2::Vec2 (const Vec2& v) IMATH_NOEXCEPT ++ : x (v.x), ++ y (v.y) ++{} + +-template template IMATH_HOSTDEVICE constexpr inline Vec2::Vec2 (const Vec2& v) IMATH_NOEXCEPT +- : x(T(v.x)), y(T(v.y)) +-{ +-} ++template ++template ++IMATH_HOSTDEVICE constexpr inline Vec2::Vec2 (const Vec2& v) ++ IMATH_NOEXCEPT : x (T (v.x)), ++ y (T (v.y)) ++{} + + template + IMATH_CONSTEXPR14 IMATH_HOSTDEVICE inline const Vec2& +@@ -1047,14 +1271,14 @@ Vec2::getValue (Vec2& v) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline T* +-Vec2::getValue() IMATH_NOEXCEPT ++Vec2::getValue () IMATH_NOEXCEPT + { + return (T*) &x; + } + + template + IMATH_HOSTDEVICE inline const T* +-Vec2::getValue() const IMATH_NOEXCEPT ++Vec2::getValue () const IMATH_NOEXCEPT + { + return (const T*) &x; + } +@@ -1159,14 +1383,14 @@ Vec2::operator- (const Vec2& v) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline Vec2 +-Vec2::operator-() const IMATH_NOEXCEPT ++Vec2::operator- () const IMATH_NOEXCEPT + { + return Vec2 (-x, -y); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Vec2& +-Vec2::negate() IMATH_NOEXCEPT ++ Vec2::negate () IMATH_NOEXCEPT + { + x = -x; + y = -y; +@@ -1239,18 +1463,16 @@ Vec2::operator/ (T a) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T +-Vec2::lengthTiny() const IMATH_NOEXCEPT ++Vec2::lengthTiny () const IMATH_NOEXCEPT + { +- T absX = std::abs(x); +- T absY = std::abs(y); ++ T absX = std::abs (x); ++ T absY = std::abs (y); + + T max = absX; + +- if (max < absY) +- max = absY; ++ if (max < absY) max = absY; + +- if (IMATH_UNLIKELY(max == T (0))) +- return T (0); ++ if (IMATH_UNLIKELY (max == T (0))) return T (0); + + // + // Do not replace the divisions by max with multiplications by 1/max. +@@ -1266,30 +1488,30 @@ Vec2::lengthTiny() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline T +-Vec2::length() const IMATH_NOEXCEPT ++Vec2::length () const IMATH_NOEXCEPT + { + T length2 = dot (*this); + +- if (IMATH_UNLIKELY(length2 < T (2) * std::numeric_limits::min())) +- return lengthTiny(); ++ if (IMATH_UNLIKELY (length2 < T (2) * std::numeric_limits::min ())) ++ return lengthTiny (); + + return std::sqrt (length2); + } + + template + IMATH_HOSTDEVICE constexpr inline T +-Vec2::length2() const IMATH_NOEXCEPT ++Vec2::length2 () const IMATH_NOEXCEPT + { + return dot (*this); + } + + template + IMATH_HOSTDEVICE inline const Vec2& +-Vec2::normalize() IMATH_NOEXCEPT ++Vec2::normalize () IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + +- if (IMATH_LIKELY(l != T (0))) ++ if (IMATH_LIKELY (l != T (0))) + { + // + // Do not replace the divisions by l with multiplications by 1/l. +@@ -1306,11 +1528,11 @@ Vec2::normalize() IMATH_NOEXCEPT + + template + inline const Vec2& +-Vec2::normalizeExc() ++Vec2::normalizeExc () + { +- T l = length(); ++ T l = length (); + +- if (IMATH_UNLIKELY(l == T (0))) ++ if (IMATH_UNLIKELY (l == T (0))) + throw std::domain_error ("Cannot normalize null vector."); + + x /= l; +@@ -1320,9 +1542,9 @@ Vec2::normalizeExc() + + template + IMATH_HOSTDEVICE inline const Vec2& +-Vec2::normalizeNonNull() IMATH_NOEXCEPT ++Vec2::normalizeNonNull () IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + x /= l; + y /= l; + return *this; +@@ -1330,23 +1552,22 @@ Vec2::normalizeNonNull() IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline Vec2 +-Vec2::normalized() const IMATH_NOEXCEPT ++Vec2::normalized () const IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + +- if (IMATH_UNLIKELY(l == T (0))) +- return Vec2 (T (0)); ++ if (IMATH_UNLIKELY (l == T (0))) return Vec2 (T (0)); + + return Vec2 (x / l, y / l); + } + + template + inline Vec2 +-Vec2::normalizedExc() const ++Vec2::normalizedExc () const + { +- T l = length(); ++ T l = length (); + +- if (IMATH_UNLIKELY(l == T (0))) ++ if (IMATH_UNLIKELY (l == T (0))) + throw std::domain_error ("Cannot normalize null vector."); + + return Vec2 (x / l, y / l); +@@ -1354,9 +1575,9 @@ Vec2::normalizedExc() const + + template + IMATH_HOSTDEVICE inline Vec2 +-Vec2::normalizedNonNull() const IMATH_NOEXCEPT ++Vec2::normalizedNonNull () const IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + return Vec2 (x / l, y / l); + } + +@@ -1365,8 +1586,7 @@ Vec2::normalizedNonNull() const IMATH_NOEXCEPT + //----------------------- + + template +-IMATH_HOSTDEVICE +-IMATH_CONSTEXPR14 inline T& ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T& + Vec3::operator[] (int i) IMATH_NOEXCEPT + { + return (&x)[i]; // NOSONAR - suppress SonarCloud bug report. +@@ -1379,31 +1599,38 @@ Vec3::operator[] (int i) const IMATH_NOEXCEPT + return (&x)[i]; // NOSONAR - suppress SonarCloud bug report. + } + +-template IMATH_HOSTDEVICE inline Vec3::Vec3() IMATH_NOEXCEPT ++template IMATH_HOSTDEVICE inline Vec3::Vec3 () IMATH_NOEXCEPT + { + // empty, and not constexpr because data is uninitialized. + } + +-template IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (T a) IMATH_NOEXCEPT +- : x(a), y(a), z(a) +-{ +-} ++template ++IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (T a) IMATH_NOEXCEPT : x (a), ++ y (a), ++ z (a) ++{} + +-template IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (T a, T b, T c) IMATH_NOEXCEPT +- : x(a), y(b), z(c) +-{ +-} ++template ++IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (T a, T b, T c) IMATH_NOEXCEPT ++ : x (a), ++ y (b), ++ z (c) ++{} + +-template IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (const Vec3& v) IMATH_NOEXCEPT +- : x(v.x), y(v.y), z(v.z) +-{ +-} ++template ++IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (const Vec3& v) IMATH_NOEXCEPT ++ : x (v.x), ++ y (v.y), ++ z (v.z) ++{} + +-template template +-IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (const Vec3& v) IMATH_NOEXCEPT +- : x(T(v.x)), y(T(v.y)), z(T(v.z)) +-{ +-} ++template ++template ++IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (const Vec3& v) ++ IMATH_NOEXCEPT : x (T (v.x)), ++ y (T (v.y)), ++ z (T (v.z)) ++{} + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Vec3& +@@ -1415,15 +1642,18 @@ Vec3::operator= (const Vec3& v) IMATH_NOEXCEPT + return *this; + } + +-template template +-IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (const Vec4& v) IMATH_NOEXCEPT +- : x(T(v.x/v.w)), y(T(v.y/v.w)), z(T(v.z/v.w)) +-{ +-} ++template ++template ++IMATH_HOSTDEVICE constexpr inline Vec3::Vec3 (const Vec4& v) ++ IMATH_NOEXCEPT : x (T (v.x / v.w)), ++ y (T (v.y / v.w)), ++ z (T (v.z / v.w)) ++{} + + template + template +-IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Vec3::Vec3 (const Vec4& v, InfException) ++IMATH_HOSTDEVICE ++ IMATH_CONSTEXPR14 inline Vec3::Vec3 (const Vec4& v, InfException) + { + T vx = T (v.x); + T vy = T (v.y); +@@ -1434,7 +1664,7 @@ IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline Vec3::Vec3 (const Vec4& v, InfEx + + if (absW < 1) + { +- T m = baseTypeMax() * absW; ++ T m = baseTypeMax () * absW; + + if (vx <= -m || vx >= m || vy <= -m || vy >= m || vz <= -m || vz >= m) + throw std::domain_error ("Cannot normalize point at infinity."); +@@ -1487,14 +1717,14 @@ Vec3::getValue (Vec3& v) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline T* +-Vec3::getValue() IMATH_NOEXCEPT ++Vec3::getValue () IMATH_NOEXCEPT + { + return (T*) &x; + } + + template + IMATH_HOSTDEVICE inline const T* +-Vec3::getValue() const IMATH_NOEXCEPT ++Vec3::getValue () const IMATH_NOEXCEPT + { + return (const T*) &x; + } +@@ -1614,14 +1844,14 @@ Vec3::operator- (const Vec3& v) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline Vec3 +-Vec3::operator-() const IMATH_NOEXCEPT ++Vec3::operator- () const IMATH_NOEXCEPT + { + return Vec3 (-x, -y, -z); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Vec3& +-Vec3::negate() IMATH_NOEXCEPT ++ Vec3::negate () IMATH_NOEXCEPT + { + x = -x; + y = -y; +@@ -1699,7 +1929,7 @@ Vec3::operator/ (T a) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T +-Vec3::lengthTiny() const IMATH_NOEXCEPT ++Vec3::lengthTiny () const IMATH_NOEXCEPT + { + T absX = (x >= T (0)) ? x : -x; + T absY = (y >= T (0)) ? y : -y; +@@ -1707,14 +1937,11 @@ Vec3::lengthTiny() const IMATH_NOEXCEPT + + T max = absX; + +- if (max < absY) +- max = absY; ++ if (max < absY) max = absY; + +- if (max < absZ) +- max = absZ; ++ if (max < absZ) max = absZ; + +- if (IMATH_UNLIKELY(max == T (0))) +- return T (0); ++ if (IMATH_UNLIKELY (max == T (0))) return T (0); + + // + // Do not replace the divisions by max with multiplications by 1/max. +@@ -1731,30 +1958,30 @@ Vec3::lengthTiny() const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline T +-Vec3::length() const IMATH_NOEXCEPT ++Vec3::length () const IMATH_NOEXCEPT + { + T length2 = dot (*this); + +- if (IMATH_UNLIKELY(length2 < T (2) * std::numeric_limits::min())) +- return lengthTiny(); ++ if (IMATH_UNLIKELY (length2 < T (2) * std::numeric_limits::min ())) ++ return lengthTiny (); + + return std::sqrt (length2); + } + + template + IMATH_HOSTDEVICE constexpr inline T +-Vec3::length2() const IMATH_NOEXCEPT ++Vec3::length2 () const IMATH_NOEXCEPT + { + return dot (*this); + } + + template + IMATH_HOSTDEVICE inline const Vec3& +-Vec3::normalize() IMATH_NOEXCEPT ++Vec3::normalize () IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + +- if (IMATH_LIKELY(l != T (0))) ++ if (IMATH_LIKELY (l != T (0))) + { + // + // Do not replace the divisions by l with multiplications by 1/l. +@@ -1772,11 +1999,11 @@ Vec3::normalize() IMATH_NOEXCEPT + + template + inline const Vec3& +-Vec3::normalizeExc() ++Vec3::normalizeExc () + { +- T l = length(); ++ T l = length (); + +- if (IMATH_UNLIKELY(l == T (0))) ++ if (IMATH_UNLIKELY (l == T (0))) + throw std::domain_error ("Cannot normalize null vector."); + + x /= l; +@@ -1787,9 +2014,9 @@ Vec3::normalizeExc() + + template + IMATH_HOSTDEVICE inline const Vec3& +-Vec3::normalizeNonNull() IMATH_NOEXCEPT ++Vec3::normalizeNonNull () IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + x /= l; + y /= l; + z /= l; +@@ -1798,23 +2025,22 @@ Vec3::normalizeNonNull() IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline Vec3 +-Vec3::normalized() const IMATH_NOEXCEPT ++Vec3::normalized () const IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + +- if (IMATH_UNLIKELY((l == T (0)))) +- return Vec3 (T (0)); ++ if (IMATH_UNLIKELY ((l == T (0)))) return Vec3 (T (0)); + + return Vec3 (x / l, y / l, z / l); + } + + template + inline Vec3 +-Vec3::normalizedExc() const ++Vec3::normalizedExc () const + { +- T l = length(); ++ T l = length (); + +- if (IMATH_UNLIKELY(l == T (0))) ++ if (IMATH_UNLIKELY (l == T (0))) + throw std::domain_error ("Cannot normalize null vector."); + + return Vec3 (x / l, y / l, z / l); +@@ -1822,9 +2048,9 @@ Vec3::normalizedExc() const + + template + IMATH_HOSTDEVICE inline Vec3 +-Vec3::normalizedNonNull() const IMATH_NOEXCEPT ++Vec3::normalizedNonNull () const IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + return Vec3 (x / l, y / l, z / l); + } + +@@ -1833,8 +2059,7 @@ Vec3::normalizedNonNull() const IMATH_NOEXCEPT + //----------------------- + + template +-IMATH_HOSTDEVICE +-IMATH_CONSTEXPR14 inline T& ++IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T& + Vec4::operator[] (int i) IMATH_NOEXCEPT + { + return (&x)[i]; // NOSONAR - suppress SonarCloud bug report. +@@ -1847,31 +2072,42 @@ Vec4::operator[] (int i) const IMATH_NOEXCEPT + return (&x)[i]; // NOSONAR - suppress SonarCloud bug report. + } + +-template IMATH_HOSTDEVICE inline Vec4::Vec4() IMATH_NOEXCEPT ++template IMATH_HOSTDEVICE inline Vec4::Vec4 () IMATH_NOEXCEPT + { + // empty, and not constexpr because data is uninitialized. + } + +-template IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (T a) IMATH_NOEXCEPT +- : x(a), y(a), z(a), w(a) +-{ +-} ++template ++IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (T a) IMATH_NOEXCEPT : x (a), ++ y (a), ++ z (a), ++ w (a) ++{} + +-template IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (T a, T b, T c, T d) IMATH_NOEXCEPT +- : x(a), y(b), z(c), w(d) +-{ +-} ++template ++IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (T a, T b, T c, T d) ++ IMATH_NOEXCEPT : x (a), ++ y (b), ++ z (c), ++ w (d) ++{} + +-template IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (const Vec4& v) IMATH_NOEXCEPT +- : x(v.x), y(v.y), z(v.z), w(v.w) +-{ +-} ++template ++IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (const Vec4& v) IMATH_NOEXCEPT ++ : x (v.x), ++ y (v.y), ++ z (v.z), ++ w (v.w) ++{} + +-template template +-IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (const Vec4& v) IMATH_NOEXCEPT +- : x(T(v.x)), y(T(v.y)), z(T(v.z)), w(T(v.w)) +-{ +-} ++template ++template ++IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (const Vec4& v) ++ IMATH_NOEXCEPT : x (T (v.x)), ++ y (T (v.y)), ++ z (T (v.z)), ++ w (T (v.w)) ++{} + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Vec4& +@@ -1884,11 +2120,14 @@ Vec4::operator= (const Vec4& v) IMATH_NOEXCEPT + return *this; + } + +-template template +-IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (const Vec3& v) IMATH_NOEXCEPT +- : x(T(v.x)), y(T(v.y)), z(T(v.z)), w(T(1)) +-{ +-} ++template ++template ++IMATH_HOSTDEVICE constexpr inline Vec4::Vec4 (const Vec3& v) ++ IMATH_NOEXCEPT : x (T (v.x)), ++ y (T (v.y)), ++ z (T (v.z)), ++ w (T (1)) ++{} + + template + template +@@ -1980,14 +2219,14 @@ Vec4::operator- (const Vec4& v) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE constexpr inline Vec4 +-Vec4::operator-() const IMATH_NOEXCEPT ++Vec4::operator- () const IMATH_NOEXCEPT + { + return Vec4 (-x, -y, -z, -w); + } + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline const Vec4& +-Vec4::negate() IMATH_NOEXCEPT ++ Vec4::negate () IMATH_NOEXCEPT + { + x = -x; + y = -y; +@@ -2070,7 +2309,7 @@ Vec4::operator/ (T a) const IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE IMATH_CONSTEXPR14 inline T +-Vec4::lengthTiny() const IMATH_NOEXCEPT ++Vec4::lengthTiny () const IMATH_NOEXCEPT + { + T absX = (x >= T (0)) ? x : -x; + T absY = (y >= T (0)) ? y : -y; +@@ -2079,17 +2318,13 @@ Vec4::lengthTiny() const IMATH_NOEXCEPT + + T max = absX; + +- if (max < absY) +- max = absY; ++ if (max < absY) max = absY; + +- if (max < absZ) +- max = absZ; ++ if (max < absZ) max = absZ; + +- if (max < absW) +- max = absW; ++ if (max < absW) max = absW; + +- if (IMATH_UNLIKELY(max == T (0))) +- return T (0); ++ if (IMATH_UNLIKELY (max == T (0))) return T (0); + + // + // Do not replace the divisions by max with multiplications by 1/max. +@@ -2102,35 +2337,36 @@ Vec4::lengthTiny() const IMATH_NOEXCEPT + absZ /= max; + absW /= max; + +- return max * std::sqrt (absX * absX + absY * absY + absZ * absZ + absW * absW); ++ return max * ++ std::sqrt (absX * absX + absY * absY + absZ * absZ + absW * absW); + } + + template + IMATH_HOSTDEVICE inline T +-Vec4::length() const IMATH_NOEXCEPT ++Vec4::length () const IMATH_NOEXCEPT + { + T length2 = dot (*this); + +- if (IMATH_UNLIKELY(length2 < T (2) * std::numeric_limits::min())) +- return lengthTiny(); ++ if (IMATH_UNLIKELY (length2 < T (2) * std::numeric_limits::min ())) ++ return lengthTiny (); + + return std::sqrt (length2); + } + + template + IMATH_HOSTDEVICE constexpr inline T +-Vec4::length2() const IMATH_NOEXCEPT ++Vec4::length2 () const IMATH_NOEXCEPT + { + return dot (*this); + } + + template + IMATH_HOSTDEVICE const inline Vec4& +-Vec4::normalize() IMATH_NOEXCEPT ++Vec4::normalize () IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + +- if (IMATH_LIKELY(l != T (0))) ++ if (IMATH_LIKELY (l != T (0))) + { + // + // Do not replace the divisions by l with multiplications by 1/l. +@@ -2149,11 +2385,11 @@ Vec4::normalize() IMATH_NOEXCEPT + + template + const inline Vec4& +-Vec4::normalizeExc() ++Vec4::normalizeExc () + { +- T l = length(); ++ T l = length (); + +- if (IMATH_UNLIKELY(l == T (0))) ++ if (IMATH_UNLIKELY (l == T (0))) + throw std::domain_error ("Cannot normalize null vector."); + + x /= l; +@@ -2165,9 +2401,9 @@ Vec4::normalizeExc() + + template + IMATH_HOSTDEVICE inline const Vec4& +-Vec4::normalizeNonNull() IMATH_NOEXCEPT ++Vec4::normalizeNonNull () IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + x /= l; + y /= l; + z /= l; +@@ -2177,23 +2413,22 @@ Vec4::normalizeNonNull() IMATH_NOEXCEPT + + template + IMATH_HOSTDEVICE inline Vec4 +-Vec4::normalized() const IMATH_NOEXCEPT ++Vec4::normalized () const IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + +- if (IMATH_UNLIKELY(l == T (0))) +- return Vec4 (T (0)); ++ if (IMATH_UNLIKELY (l == T (0))) return Vec4 (T (0)); + + return Vec4 (x / l, y / l, z / l, w / l); + } + + template + inline Vec4 +-Vec4::normalizedExc() const ++Vec4::normalizedExc () const + { +- T l = length(); ++ T l = length (); + +- if (IMATH_UNLIKELY(l == T (0))) ++ if (IMATH_UNLIKELY (l == T (0))) + throw std::domain_error ("Cannot normalize null vector."); + + return Vec4 (x / l, y / l, z / l, w / l); +@@ -2201,9 +2436,9 @@ Vec4::normalizedExc() const + + template + IMATH_HOSTDEVICE inline Vec4 +-Vec4::normalizedNonNull() const IMATH_NOEXCEPT ++Vec4::normalizedNonNull () const IMATH_NOEXCEPT + { +- T l = length(); ++ T l = length (); + return Vec4 (x / l, y / l, z / l, w / l); + } + +diff --git a/src/Imath/ImathVecAlgo.h b/src/Imath/ImathVecAlgo.h +index df62392..dddde51 100644 +--- a/src/Imath/ImathVecAlgo.h ++++ b/src/Imath/ImathVecAlgo.h +@@ -29,12 +29,13 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + /// Find the projection of vector `t` onto vector `s` (`Vec2`, `Vec3`, `Vec4`) + /// + /// Only defined for floating-point types, e.g. `V2f`, `V3d`, etc. +-template ::value)> ++template < ++ class Vec, ++ IMATH_ENABLE_IF (!std::is_integral::value)> + IMATH_CONSTEXPR14 inline Vec + project (const Vec& s, const Vec& t) IMATH_NOEXCEPT + { +- Vec sNormalized = s.normalized(); ++ Vec sNormalized = s.normalized (); + return sNormalized * (sNormalized ^ t); + } + +@@ -42,8 +43,9 @@ project (const Vec& s, const Vec& t) IMATH_NOEXCEPT + /// in the same plane as `s` and `t` (`Vec2`, `Vec3`, `Vec4`) + /// + /// Only defined for floating-point types, e.g. `V2f`, `V3d`, etc. +-template ::value)> ++template < ++ class Vec, ++ IMATH_ENABLE_IF (!std::is_integral::value)> + constexpr inline Vec + orthogonal (const Vec& s, const Vec& t) IMATH_NOEXCEPT + { +@@ -54,8 +56,9 @@ orthogonal (const Vec& s, const Vec& t) IMATH_NOEXCEPT + /// off a plane with normal `t` (`Vec2`, `Vec3`, `Vec4`) + /// + /// Only defined for floating-point types, e.g. `V2f`, `V3d`, etc. +-template ::value)> ++template < ++ class Vec, ++ IMATH_ENABLE_IF (!std::is_integral::value)> + constexpr inline Vec + reflect (const Vec& s, const Vec& t) IMATH_NOEXCEPT + { +@@ -68,11 +71,12 @@ reflect (const Vec& s, const Vec& t) IMATH_NOEXCEPT + /// (`Vec2`, `Vec3`, `Vec4`) + template + IMATH_CONSTEXPR14 Vec +-closestVertex (const Vec& v0, const Vec& v1, const Vec& v2, const Vec& p) IMATH_NOEXCEPT ++closestVertex (const Vec& v0, const Vec& v1, const Vec& v2, const Vec& p) ++ IMATH_NOEXCEPT + { +- Vec nearest = v0; +- typename Vec::BaseType neardot = (v0 - p).length2(); +- typename Vec::BaseType tmp = (v1 - p).length2(); ++ Vec nearest = v0; ++ typename Vec::BaseType neardot = (v0 - p).length2 (); ++ typename Vec::BaseType tmp = (v1 - p).length2 (); + + if (tmp < neardot) + { +@@ -80,7 +84,7 @@ closestVertex (const Vec& v0, const Vec& v1, const Vec& v2, const Vec& p) IMATH_ + nearest = v1; + } + +- tmp = (v2 - p).length2(); ++ tmp = (v2 - p).length2 (); + + if (tmp < neardot) + { +diff --git a/src/Imath/half.cpp b/src/Imath/half.cpp +index 85db22f..75cdd13 100644 +--- a/src/Imath/half.cpp ++++ b/src/Imath/half.cpp +@@ -76,14 +76,13 @@ operator>> (istream& is, half& h) + IMATH_EXPORT void + printBits (ostream& os, half h) + { +- unsigned short b = h.bits(); ++ unsigned short b = h.bits (); + + for (int i = 15; i >= 0; i--) + { + os << (((b >> i) & 1) ? '1' : '0'); + +- if (i == 15 || i == 10) +- os << ' '; ++ if (i == 15 || i == 10) os << ' '; + } + } + +@@ -97,22 +96,20 @@ printBits (ostream& os, float f) + { + os << (((x.i >> i) & 1) ? '1' : '0'); + +- if (i == 31 || i == 23) +- os << ' '; ++ if (i == 31 || i == 23) os << ' '; + } + } + + IMATH_EXPORT void + printBits (char c[19], half h) + { +- unsigned short b = h.bits(); ++ unsigned short b = h.bits (); + + for (int i = 15, j = 0; i >= 0; i--, j++) + { + c[j] = (((b >> i) & 1) ? '1' : '0'); + +- if (i == 15 || i == 10) +- c[++j] = ' '; ++ if (i == 15 || i == 10) c[++j] = ' '; + } + + c[18] = 0; +@@ -128,8 +125,7 @@ printBits (char c[35], float f) + { + c[j] = (((x.i >> i) & 1) ? '1' : '0'); + +- if (i == 31 || i == 23) +- c[++j] = ' '; ++ if (i == 31 || i == 23) c[++j] = ' '; + } + + c[34] = 0; +diff --git a/src/Imath/half.h b/src/Imath/half.h +index e502ea7..4e88520 100644 +--- a/src/Imath/half.h ++++ b/src/Imath/half.h +@@ -178,9 +178,9 @@ + /// + + #ifdef _WIN32 +-# include ++# include + #elif defined(__x86_64__) +-# include ++# include + #endif + + #include +@@ -231,7 +231,7 @@ + #define HALF_DIG 3 + /// Number of base-10 digits that are necessary to uniquely represent + /// all distinct values: +-/// ++/// + /// ``ceil(HALF_MANT_DIG * log10(2) + 1) => 4.31... -> 5`` + #define HALF_DECIMAL_DIG 5 + /// Base of the exponent +@@ -253,7 +253,7 @@ + typedef union imath_half_uif + { + uint32_t i; +- float f; ++ float f; + } imath_half_uif_t; + + /// a type for both C-only programs and C++ to use the same utilities +@@ -292,7 +292,8 @@ imath_half_to_float (imath_half_bits_t h) + # else + return _cvtsh_ss (h); + # endif +-#elif defined(IMATH_HALF_USE_LOOKUP_TABLE) && !defined(IMATH_HALF_NO_LOOKUP_TABLE) ++#elif defined(IMATH_HALF_USE_LOOKUP_TABLE) && \ ++ !defined(IMATH_HALF_NO_LOOKUP_TABLE) + return imath_half_to_float_table[h].f; + #else + imath_half_uif_t v; +@@ -300,8 +301,8 @@ imath_half_to_float (imath_half_bits_t h) + // (1.06 vs 1.08 ns/call) to avoid the constants and just do 4 + // shifts. + // +- uint32_t hexpmant = ( (uint32_t)(h) << 17 ) >> 4; +- v.i = ((uint32_t)(h >> 15)) << 31; ++ uint32_t hexpmant = ((uint32_t) (h) << 17) >> 4; ++ v.i = ((uint32_t) (h >> 15)) << 31; + + // the likely really does help if most of your numbers are "normal" half numbers + if (IMATH_LIKELY ((hexpmant >= 0x00800000))) +@@ -366,16 +367,17 @@ imath_float_to_half (float f) + # ifdef _MSC_VER + // msvc does not seem to have cvtsh_ss :( + return _mm_extract_epi16 ( +- _mm_cvtps_ph (_mm_set_ss (f), (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC)), ++ _mm_cvtps_ph ( ++ _mm_set_ss (f), (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC)), + 0); + # else + // preserve the fixed rounding mode to nearest + return _cvtss_sh (f, (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC)); + # endif + #else +- imath_half_uif_t v; ++ imath_half_uif_t v; + imath_half_bits_t ret; +- uint32_t e, m, ui, r, shift; ++ uint32_t e, m, ui, r, shift; + + v.f = f; + +@@ -389,11 +391,10 @@ imath_float_to_half (float f) + if (IMATH_UNLIKELY (ui >= 0x7f800000)) + { + ret |= 0x7c00; +- if (ui == 0x7f800000) +- return ret; ++ if (ui == 0x7f800000) return ret; + m = (ui & 0x7fffff) >> 13; + // make sure we have at least one bit after shift to preserve nan-ness +- return ret | (uint16_t)m | (uint16_t)(m == 0); ++ return ret | (uint16_t) m | (uint16_t) (m == 0); + } + + // too large, round to infinity +@@ -407,15 +408,14 @@ imath_float_to_half (float f) + + ui -= 0x38000000; + ui = ((ui + 0x00000fff + ((ui >> 13) & 1)) >> 13); +- return ret | (uint16_t)ui; ++ return ret | (uint16_t) ui; + } + + // zero or flush to 0 + if (ui < 0x33000001) + { + # ifdef IMATH_HALF_ENABLE_FP_EXCEPTIONS +- if (ui == 0) +- return ret; ++ if (ui == 0) return ret; + feraiseexcept (FE_UNDERFLOW); + # endif + return ret; +@@ -427,8 +427,7 @@ imath_float_to_half (float f) + m = 0x800000 | (ui & 0x7fffff); + r = m << (32 - shift); + ret |= (m >> shift); +- if (r > 0x80000000 || (r == 0x80000000 && (ret & 0x1) != 0)) +- ++ret; ++ if (r > 0x80000000 || (r == 0x80000000 && (ret & 0x1) != 0)) ++ret; + return ret; + #endif + } +@@ -488,7 +487,7 @@ IMATH_INTERNAL_NAMESPACE_HEADER_ENTER + + class IMATH_EXPORT_TYPE half + { +- public: ++public: + /// A special tag that lets us initialize a half from the raw bits. + enum IMATH_EXPORT_ENUM FromBitsTag + { +@@ -500,7 +499,7 @@ class IMATH_EXPORT_TYPE half + + /// Default construction provides no initialization (hence it is + /// not constexpr). +- half() IMATH_NOEXCEPT = default; ++ half () IMATH_NOEXCEPT = default; + + /// Construct from float + half (float f) IMATH_NOEXCEPT; +@@ -515,18 +514,18 @@ class IMATH_EXPORT_TYPE half + constexpr half (half&&) IMATH_NOEXCEPT = default; + + /// Destructor +- ~half() IMATH_NOEXCEPT = default; ++ ~half () IMATH_NOEXCEPT = default; + + /// @} + + /// Conversion to float +- operator float() const IMATH_NOEXCEPT; ++ operator float () const IMATH_NOEXCEPT; + + /// @{ + /// @name Basic Algebra + + /// Unary minus +- constexpr half operator-() const IMATH_NOEXCEPT; ++ constexpr half operator- () const IMATH_NOEXCEPT; + + /// Assignment + half& operator= (const half& h) IMATH_NOEXCEPT = default; +@@ -573,25 +572,25 @@ class IMATH_EXPORT_TYPE half + + /// Return true if a normalized number, a denormalized number, or + /// zero. +- constexpr bool isFinite() const IMATH_NOEXCEPT; ++ constexpr bool isFinite () const IMATH_NOEXCEPT; + + /// Return true if a normalized number. +- constexpr bool isNormalized() const IMATH_NOEXCEPT; ++ constexpr bool isNormalized () const IMATH_NOEXCEPT; + + /// Return true if a denormalized number. +- constexpr bool isDenormalized() const IMATH_NOEXCEPT; ++ constexpr bool isDenormalized () const IMATH_NOEXCEPT; + + /// Return true if zero. +- constexpr bool isZero() const IMATH_NOEXCEPT; ++ constexpr bool isZero () const IMATH_NOEXCEPT; + + /// Return true if NAN. +- constexpr bool isNan() const IMATH_NOEXCEPT; ++ constexpr bool isNan () const IMATH_NOEXCEPT; + + /// Return true if a positive or a negative infinity +- constexpr bool isInfinity() const IMATH_NOEXCEPT; ++ constexpr bool isInfinity () const IMATH_NOEXCEPT; + + /// Return true if the sign bit is set (negative) +- constexpr bool isNegative() const IMATH_NOEXCEPT; ++ constexpr bool isNegative () const IMATH_NOEXCEPT; + + /// @} + +@@ -599,16 +598,16 @@ class IMATH_EXPORT_TYPE half + /// @name Special values + + /// Return +infinity +- static constexpr half posInf() IMATH_NOEXCEPT; ++ static constexpr half posInf () IMATH_NOEXCEPT; + + /// Return -infinity +- static constexpr half negInf() IMATH_NOEXCEPT; ++ static constexpr half negInf () IMATH_NOEXCEPT; + + /// Returns a NAN with the bit pattern 0111111111111111 +- static constexpr half qNan() IMATH_NOEXCEPT; ++ static constexpr half qNan () IMATH_NOEXCEPT; + + /// Return a NAN with the bit pattern 0111110111111111 +- static constexpr half sNan() IMATH_NOEXCEPT; ++ static constexpr half sNan () IMATH_NOEXCEPT; + + /// @} + +@@ -616,22 +615,22 @@ class IMATH_EXPORT_TYPE half + /// @name Access to the internal representation + + /// Return the bit pattern +- IMATH_EXPORT constexpr uint16_t bits() const IMATH_NOEXCEPT; ++ IMATH_EXPORT constexpr uint16_t bits () const IMATH_NOEXCEPT; + + /// Set the bit pattern + IMATH_EXPORT IMATH_CONSTEXPR14 void setBits (uint16_t bits) IMATH_NOEXCEPT; + + /// @} + +- public: +- static_assert (sizeof (float) == sizeof (uint32_t), +- "Assumption about the size of floats correct"); ++public: ++ static_assert ( ++ sizeof (float) == sizeof (uint32_t), ++ "Assumption about the size of floats correct"); + using uif = imath_half_uif; + +- private: +- +- constexpr uint16_t mantissa() const IMATH_NOEXCEPT; +- constexpr uint16_t exponent() const IMATH_NOEXCEPT; ++private: ++ constexpr uint16_t mantissa () const IMATH_NOEXCEPT; ++ constexpr uint16_t exponent () const IMATH_NOEXCEPT; + + uint16_t _h; + }; +@@ -640,23 +639,22 @@ class IMATH_EXPORT_TYPE half + // Half-from-float constructor + //---------------------------- + +-inline half::half (float f) IMATH_NOEXCEPT +- : _h (imath_float_to_half (f)) +-{ +-} ++inline half::half (float f) IMATH_NOEXCEPT : _h (imath_float_to_half (f)) ++{} + + //------------------------------------------ + // Half from raw bits constructor + //------------------------------------------ + +-inline constexpr half::half (FromBitsTag, uint16_t bits) IMATH_NOEXCEPT : _h (bits) ++inline constexpr half::half (FromBitsTag, uint16_t bits) IMATH_NOEXCEPT ++ : _h (bits) + {} + + //------------------------- + // Half-to-float conversion + //------------------------- + +-inline half::operator float() const IMATH_NOEXCEPT ++inline half::operator float () const IMATH_NOEXCEPT + { + return imath_half_to_float (_h); + } +@@ -672,8 +670,7 @@ half::round (unsigned int n) const IMATH_NOEXCEPT + // Parameter check. + // + +- if (n >= 10) +- return *this; ++ if (n >= 10) return *this; + + // + // Disassemble h into the sign, s, +@@ -723,9 +720,9 @@ half::round (unsigned int n) const IMATH_NOEXCEPT + //----------------------- + + inline constexpr half +-half::operator-() const IMATH_NOEXCEPT ++half::operator- () const IMATH_NOEXCEPT + { +- return half (FromBits, bits() ^ 0x8000); ++ return half (FromBits, bits () ^ 0x8000); + } + + inline half& +@@ -792,85 +789,85 @@ half::operator/= (float f) IMATH_NOEXCEPT + } + + inline constexpr uint16_t +-half::mantissa() const IMATH_NOEXCEPT ++half::mantissa () const IMATH_NOEXCEPT + { + return _h & 0x3ff; + } + + inline constexpr uint16_t +-half::exponent() const IMATH_NOEXCEPT ++half::exponent () const IMATH_NOEXCEPT + { + return (_h >> 10) & 0x001f; + } + + inline constexpr bool +-half::isFinite() const IMATH_NOEXCEPT ++half::isFinite () const IMATH_NOEXCEPT + { +- return exponent() < 31; ++ return exponent () < 31; + } + + inline constexpr bool +-half::isNormalized() const IMATH_NOEXCEPT ++half::isNormalized () const IMATH_NOEXCEPT + { +- return exponent() > 0 && exponent() < 31; ++ return exponent () > 0 && exponent () < 31; + } + + inline constexpr bool +-half::isDenormalized() const IMATH_NOEXCEPT ++half::isDenormalized () const IMATH_NOEXCEPT + { +- return exponent() == 0 && mantissa() != 0; ++ return exponent () == 0 && mantissa () != 0; + } + + inline constexpr bool +-half::isZero() const IMATH_NOEXCEPT ++half::isZero () const IMATH_NOEXCEPT + { + return (_h & 0x7fff) == 0; + } + + inline constexpr bool +-half::isNan() const IMATH_NOEXCEPT ++half::isNan () const IMATH_NOEXCEPT + { +- return exponent() == 31 && mantissa() != 0; ++ return exponent () == 31 && mantissa () != 0; + } + + inline constexpr bool +-half::isInfinity() const IMATH_NOEXCEPT ++half::isInfinity () const IMATH_NOEXCEPT + { +- return exponent() == 31 && mantissa() == 0; ++ return exponent () == 31 && mantissa () == 0; + } + + inline constexpr bool +-half::isNegative() const IMATH_NOEXCEPT ++half::isNegative () const IMATH_NOEXCEPT + { + return (_h & 0x8000) != 0; + } + + inline constexpr half +-half::posInf() IMATH_NOEXCEPT ++half::posInf () IMATH_NOEXCEPT + { + return half (FromBits, 0x7c00); + } + + inline constexpr half +-half::negInf() IMATH_NOEXCEPT ++half::negInf () IMATH_NOEXCEPT + { + return half (FromBits, 0xfc00); + } + + inline constexpr half +-half::qNan() IMATH_NOEXCEPT ++half::qNan () IMATH_NOEXCEPT + { + return half (FromBits, 0x7fff); + } + + inline constexpr half +-half::sNan() IMATH_NOEXCEPT ++half::sNan () IMATH_NOEXCEPT + { + return half (FromBits, 0x7dff); + } + + inline constexpr uint16_t +-half::bits() const IMATH_NOEXCEPT ++half::bits () const IMATH_NOEXCEPT + { + return _h; + } +@@ -884,16 +881,19 @@ half::setBits (uint16_t bits) IMATH_NOEXCEPT + IMATH_INTERNAL_NAMESPACE_HEADER_EXIT + + /// Output h to os, formatted as a float +-IMATH_EXPORT std::ostream& operator<< (std::ostream& os, IMATH_INTERNAL_NAMESPACE::half h); ++IMATH_EXPORT std::ostream& ++ operator<< (std::ostream& os, IMATH_INTERNAL_NAMESPACE::half h); + + /// Input h from is +-IMATH_EXPORT std::istream& operator>> (std::istream& is, IMATH_INTERNAL_NAMESPACE::half& h); ++IMATH_EXPORT std::istream& ++ operator>> (std::istream& is, IMATH_INTERNAL_NAMESPACE::half& h); + + //---------- + // Debugging + //---------- + +-IMATH_EXPORT void printBits (std::ostream& os, IMATH_INTERNAL_NAMESPACE::half h); ++IMATH_EXPORT void ++printBits (std::ostream& os, IMATH_INTERNAL_NAMESPACE::half h); + IMATH_EXPORT void printBits (std::ostream& os, float f); + IMATH_EXPORT void printBits (char c[19], IMATH_INTERNAL_NAMESPACE::half h); + IMATH_EXPORT void printBits (char c[35], float f); +diff --git a/src/Imath/halfFunction.h b/src/Imath/halfFunction.h +index c1e456f..ab45198 100644 +--- a/src/Imath/halfFunction.h ++++ b/src/Imath/halfFunction.h +@@ -63,22 +63,23 @@ + + template class halfFunction + { +- public: ++public: + //------------ + // Constructor + //------------ + + template +- halfFunction (Function f, +- half domainMin = -HALF_MAX, +- half domainMax = HALF_MAX, +- T defaultValue = 0, +- T posInfValue = 0, +- T negInfValue = 0, +- T nanValue = 0); ++ halfFunction ( ++ Function f, ++ half domainMin = -HALF_MAX, ++ half domainMax = HALF_MAX, ++ T defaultValue = 0, ++ T posInfValue = 0, ++ T negInfValue = 0, ++ T nanValue = 0); + + #ifndef IMATH_HAVE_LARGE_STACK +- ~halfFunction() { delete[] _lut; } ++ ~halfFunction () { delete[] _lut; } + halfFunction (const halfFunction&) = delete; + halfFunction& operator= (const halfFunction&) = delete; + halfFunction (halfFunction&&) = delete; +@@ -91,7 +92,7 @@ template class halfFunction + + T operator() (half x) const; + +- private: ++private: + #ifdef IMATH_HAVE_LARGE_STACK + T _lut[1 << 16]; + #else +@@ -105,13 +106,14 @@ template class halfFunction + + template + template +-halfFunction::halfFunction (Function f, +- half domainMin, +- half domainMax, +- T defaultValue, +- T posInfValue, +- T negInfValue, +- T nanValue) ++halfFunction::halfFunction ( ++ Function f, ++ half domainMin, ++ half domainMax, ++ T defaultValue, ++ T posInfValue, ++ T negInfValue, ++ T nanValue) + { + #ifndef IMATH_HAVE_LARGE_STACK + _lut = new T[1 << 16]; +@@ -122,10 +124,10 @@ halfFunction::halfFunction (Function f, + half x; + x.setBits (i); + +- if (x.isNan()) ++ if (x.isNan ()) + _lut[i] = nanValue; +- else if (x.isInfinity()) +- _lut[i] = x.isNegative() ? negInfValue : posInfValue; ++ else if (x.isInfinity ()) ++ _lut[i] = x.isNegative () ? negInfValue : posInfValue; + else if (x < domainMin || x > domainMax) + _lut[i] = defaultValue; + else +@@ -137,11 +139,9 @@ template + inline T + halfFunction::operator() (half x) const + { +- return _lut[x.bits()]; ++ return _lut[x.bits ()]; + } + +- + /// @endcond + +- + #endif +diff --git a/src/Imath/halfLimits.h b/src/Imath/halfLimits.h +index 3b1c989..10081ea 100644 +--- a/src/Imath/halfLimits.h ++++ b/src/Imath/halfLimits.h +@@ -28,45 +28,72 @@ namespace std + + template <> class numeric_limits + { +- public: ++public: + static const bool is_specialized = true; + +- static constexpr half min() IMATH_NOEXCEPT { return half(half::FromBits, 0x0400); /*HALF_MIN*/ } +- static constexpr half max() IMATH_NOEXCEPT { return half(half::FromBits, 0x7bff); /*HALF_MAX*/ } +- static constexpr half lowest() { return half(half::FromBits, 0xfbff); /* -HALF_MAX */ } +- +- static constexpr int digits = HALF_MANT_DIG; +- static constexpr int digits10 = HALF_DIG; +- static constexpr int max_digits10 = HALF_DECIMAL_DIG; +- static constexpr bool is_signed = true; +- static constexpr bool is_integer = false; +- static constexpr bool is_exact = false; +- static constexpr int radix = HALF_RADIX; +- static constexpr half epsilon() IMATH_NOEXCEPT { return half(half::FromBits, 0x1400); /*HALF_EPSILON*/ } +- static constexpr half round_error() IMATH_NOEXCEPT { return half(half::FromBits, 0x3800); /*0.5*/ } ++ static constexpr half min () IMATH_NOEXCEPT ++ { ++ return half (half::FromBits, 0x0400); /*HALF_MIN*/ ++ } ++ static constexpr half max () IMATH_NOEXCEPT ++ { ++ return half (half::FromBits, 0x7bff); /*HALF_MAX*/ ++ } ++ static constexpr half lowest () ++ { ++ return half (half::FromBits, 0xfbff); /* -HALF_MAX */ ++ } ++ ++ static constexpr int digits = HALF_MANT_DIG; ++ static constexpr int digits10 = HALF_DIG; ++ static constexpr int max_digits10 = HALF_DECIMAL_DIG; ++ static constexpr bool is_signed = true; ++ static constexpr bool is_integer = false; ++ static constexpr bool is_exact = false; ++ static constexpr int radix = HALF_RADIX; ++ static constexpr half epsilon () IMATH_NOEXCEPT ++ { ++ return half (half::FromBits, 0x1400); /*HALF_EPSILON*/ ++ } ++ static constexpr half round_error () IMATH_NOEXCEPT ++ { ++ return half (half::FromBits, 0x3800); /*0.5*/ ++ } + + static constexpr int min_exponent = HALF_DENORM_MIN_EXP; + static constexpr int min_exponent10 = HALF_DENORM_MIN_10_EXP; + static constexpr int max_exponent = HALF_MAX_EXP; + static constexpr int max_exponent10 = HALF_MAX_10_EXP; + +- static constexpr bool has_infinity = true; +- static constexpr bool has_quiet_NaN = true; +- static constexpr bool has_signaling_NaN = true; +- static constexpr float_denorm_style has_denorm = denorm_present; +- static constexpr bool has_denorm_loss = false; +- static constexpr half infinity() IMATH_NOEXCEPT { return half(half::FromBits, 0x7c00); /*half::posInf()*/ } +- static constexpr half quiet_NaN() IMATH_NOEXCEPT { return half(half::FromBits, 0x7fff); /*half::qNan()*/ } +- static constexpr half signaling_NaN() IMATH_NOEXCEPT { return half(half::FromBits, 0x7dff); /*half::sNan()*/ } +- static constexpr half denorm_min() IMATH_NOEXCEPT { return half(half::FromBits, 0x0001); /*HALF_DENORM_MIN*/ } ++ static constexpr bool has_infinity = true; ++ static constexpr bool has_quiet_NaN = true; ++ static constexpr bool has_signaling_NaN = true; ++ static constexpr float_denorm_style has_denorm = denorm_present; ++ static constexpr bool has_denorm_loss = false; ++ static constexpr half infinity () IMATH_NOEXCEPT ++ { ++ return half (half::FromBits, 0x7c00); /*half::posInf()*/ ++ } ++ static constexpr half quiet_NaN () IMATH_NOEXCEPT ++ { ++ return half (half::FromBits, 0x7fff); /*half::qNan()*/ ++ } ++ static constexpr half signaling_NaN () IMATH_NOEXCEPT ++ { ++ return half (half::FromBits, 0x7dff); /*half::sNan()*/ ++ } ++ static constexpr half denorm_min () IMATH_NOEXCEPT ++ { ++ return half (half::FromBits, 0x0001); /*HALF_DENORM_MIN*/ ++ } + + static constexpr bool is_iec559 = false; + static constexpr bool is_bounded = false; + static constexpr bool is_modulo = false; + +- static constexpr bool traps = true; +- static constexpr bool tinyness_before = false; +- static constexpr float_round_style round_style = round_to_nearest; ++ static constexpr bool traps = true; ++ static constexpr bool tinyness_before = false; ++ static constexpr float_round_style round_style = round_to_nearest; + }; + + /// @endcond +diff --git a/src/Imath/toFloat.cpp b/src/Imath/toFloat.cpp +index 20e750d..c77d256 100644 +--- a/src/Imath/toFloat.cpp ++++ b/src/Imath/toFloat.cpp +@@ -98,7 +98,7 @@ halfToFloat (unsigned short y) + //--------------------------------------------- + + int +-main() ++main () + { + cout.precision (9); + cout.setf (ios_base::hex, ios_base::basefield); +@@ -120,8 +120,7 @@ main() + { + cout << "\n"; + +- if (i < iMax - 1) +- cout << " "; ++ if (i < iMax - 1) cout << " "; + } + } + +diff --git a/src/ImathTest/half_c_main.c b/src/ImathTest/half_c_main.c +index 5c928a2..cc5df97 100644 +--- a/src/ImathTest/half_c_main.c ++++ b/src/ImathTest/half_c_main.c +@@ -17,16 +17,16 @@ + typedef union + { + uint32_t i; +- float f; ++ float f; + } c_half_uif; + + static const c_half_uif half_to_float[1 << 16] = + #include "../Imath/toFloat.h" + +-static const unsigned short half_eLut[1 << 9] = ++ static const unsigned short half_eLut[1 << 9] = + #include "eLut.h" + +-static short exp_long_convert (int i) ++ static short exp_long_convert (int i) + { + int s = (i >> 16) & 0x00008000; + int e = ((i >> 23) & 0x000000ff) - (127 - 15); +@@ -35,10 +35,7 @@ static short exp_long_convert (int i) + //fprintf( stderr, "old_convert: s %d e = %d, m = %d\n", s, e, m ); + if (e <= 0) + { +- if (e < -10) +- { +- return s; +- } ++ if (e < -10) { return s; } + + m = m | 0x00800000; + +@@ -53,10 +50,7 @@ static short exp_long_convert (int i) + } + else if (e == 0xff - (127 - 15)) + { +- if (m == 0) +- { +- return s | 0x7c00; +- } ++ if (m == 0) { return s | 0x7c00; } + else + { + m >>= 13; +@@ -84,8 +78,8 @@ static uint16_t + exptable_method (float f) + { + c_half_uif x; +- uint16_t _h = 0; +- x.f = f; ++ uint16_t _h = 0; ++ x.f = f; + + if (f == 0) + { +@@ -142,21 +136,22 @@ exptable_method (float f) + int + main (int argc, char* argv[]) + { +- int ret = 0; ++ int ret = 0; + c_half_uif conv; +- half test, test2; ++ half test, test2; + conv.f = HALF_DENORM_MIN + HALF_DENORM_MIN * 0.5f; + test = imath_float_to_half (conv.f); + test2 = exptable_method (conv.f); + if (test != test2) + { +- fprintf (stderr, +- "Invalid conversion of %.10g 0x%08X 0x%08X downconvert 0x%04X vs 0x%04X\n", +- conv.f, +- (conv.i >> 13) & 0x3ff, +- (conv.i >> 13) & 0x3ff, +- test, +- test2); ++ fprintf ( ++ stderr, ++ "Invalid conversion of %.10g 0x%08X 0x%08X downconvert 0x%04X vs 0x%04X\n", ++ conv.f, ++ (conv.i >> 13) & 0x3ff, ++ (conv.i >> 13) & 0x3ff, ++ test, ++ test2); + ret = 1; + } + +@@ -208,17 +203,17 @@ main (int argc, char* argv[]) + // adding a low bit, so it won't always align + int e = (conv.i >> 23) & 0xff; + int m = (conv.i & 0x007fffff); +- if (e == 255 && m != 0) +- continue; ++ if (e == 255 && m != 0) continue; + +- fprintf (stderr, +- "float to half %d: %.10f (0x%08X) gives %d 0x%04X (e is %d)\n", +- i, +- conv.f, +- conv.i, +- (int) test, +- test, +- e); ++ fprintf ( ++ stderr, ++ "float to half %d: %.10f (0x%08X) gives %d 0x%04X (e is %d)\n", ++ i, ++ conv.f, ++ conv.i, ++ (int) test, ++ test, ++ e); + ret = 1; + } + } +diff --git a/src/ImathTest/half_perf_test.cpp b/src/ImathTest/half_perf_test.cpp +index 81fe82e..709e210 100644 +--- a/src/ImathTest/half_perf_test.cpp ++++ b/src/ImathTest/half_perf_test.cpp +@@ -10,9 +10,9 @@ + #include + #include + ++#include + #include + #include +-#include + #include + #ifdef _MSC_VER + # include +@@ -25,13 +25,14 @@ + static const unsigned short imath_float_half_exp_table[1 << 9] = + #include "eLut.h" + +-using namespace IMATH_NAMESPACE; ++ using namespace IMATH_NAMESPACE; + + #ifdef IMATH_USE_HALF_LOOKUP_TABLE + +-static inline float table_half_cast(const half &h) ++static inline float ++table_half_cast (const half& h) + { +- return imath_half_to_float_table[h.bits()].f; ++ return imath_half_to_float_table[h.bits ()].f; + } + + //----------------------------------------------- +@@ -41,7 +42,7 @@ static inline float table_half_cast(const half &h) + //----------------------------------------------- + + static float +-half_overflow() ++half_overflow () + { + float f = 1e10; + +@@ -69,9 +70,9 @@ long_convert (int i) + // of float and half (127 versus 15). + // + +- int s = (i >> 16) & 0x00008000; ++ int s = (i >> 16) & 0x00008000; + int e = ((i >> 23) & 0x000000ff) - (127 - 15); +- int m = i & 0x007fffff; ++ int m = i & 0x007fffff; + + // + // Now reassemble s, e and m into a half: +@@ -179,7 +180,7 @@ long_convert (int i) + + if (e > 30) + { +- half_overflow (); // Cause a hardware floating point overflow; ++ half_overflow (); // Cause a hardware floating point overflow; + return s | 0x7c00; // if this returns, the half becomes an + } // infinity with the same sign as f. + +@@ -191,9 +192,10 @@ long_convert (int i) + } + } + +-static inline half exptable_half_constructor(float f) ++static inline half ++exptable_half_constructor (float f) + { +- half ret; ++ half ret; + imath_half_uif x; + + x.f = f; +@@ -205,7 +207,7 @@ static inline half exptable_half_constructor(float f) + // Preserve the zero's sign bit. + // + +- ret.setBits( (x.i >> 16) ); ++ ret.setBits ((x.i >> 16)); + } + else + { +@@ -252,14 +254,16 @@ static inline half exptable_half_constructor(float f) + } + #else + // provide a wrapping function for consistency/readability +-static inline float table_half_cast(const half &h) ++static inline float ++table_half_cast (const half& h) + { +- return static_cast( h ); ++ return static_cast (h); + } + +-static inline half exptable_half_constructor(float f) ++static inline half ++exptable_half_constructor (float f) + { +- return half {f}; ++ return half{f}; + } + + #endif +@@ -281,7 +285,7 @@ get_ticks (void) + return ticks.QuadPart * scale; + #else + struct timespec t; +- uint64_t nsecs; ++ uint64_t nsecs; + + static uint64_t start = 0; + if (start == 0) +@@ -302,25 +306,26 @@ perf_test_half_to_float (float* floats, const uint16_t* halfs, int numentries) + { + const half* halfvals = reinterpret_cast (halfs); + +- int64_t st = get_ticks(); ++ int64_t st = get_ticks (); + for (int i = 0; i < numentries; ++i) + floats[i] = imath_half_to_float (halfs[i]); +- int64_t et = get_ticks(); ++ int64_t et = get_ticks (); + +- int64_t ost = get_ticks(); ++ int64_t ost = get_ticks (); + for (int i = 0; i < numentries; ++i) + floats[i] = table_half_cast (halfvals[i]); +- int64_t oet = get_ticks(); ++ int64_t oet = get_ticks (); + + int64_t onanos = (oet - ost); + int64_t nnanos = (et - st); +- fprintf (stderr, +- "half -> float Old: %10lld (%g ns) New: %10lld (%g ns) (%10lld)\n", +- (long long) onanos, +- (double) onanos / ((double) numentries), +- (long long) nnanos, +- (double) nnanos / ((double) numentries), +- ((long long) (onanos - nnanos))); ++ fprintf ( ++ stderr, ++ "half -> float Old: %10lld (%g ns) New: %10lld (%g ns) (%10lld)\n", ++ (long long) onanos, ++ (double) onanos / ((double) numentries), ++ (long long) nnanos, ++ (double) nnanos / ((double) numentries), ++ ((long long) (onanos - nnanos))); + } + + void +@@ -328,25 +333,26 @@ perf_test_float_to_half (uint16_t* halfs, const float* floats, int numentries) + { + half* halfvals = reinterpret_cast (halfs); + +- int64_t st = get_ticks(); ++ int64_t st = get_ticks (); + for (int i = 0; i < numentries; ++i) + halfs[i] = imath_float_to_half (floats[i]); +- int64_t et = get_ticks(); ++ int64_t et = get_ticks (); + +- int64_t ost = get_ticks(); ++ int64_t ost = get_ticks (); + for (int i = 0; i < numentries; ++i) + halfvals[i] = exptable_half_constructor (floats[i]); +- int64_t oet = get_ticks(); ++ int64_t oet = get_ticks (); + + int64_t onanos = (oet - ost); + int64_t nnanos = (et - st); +- fprintf (stderr, +- "float -> half Old: %10lld (%g ns) New: %10lld (%g ns) (%10lld)\n", +- (long long) onanos, +- (double) onanos / ((double) numentries), +- (long long) nnanos, +- (double) nnanos / ((double) numentries), +- ((long long) (onanos - nnanos))); ++ fprintf ( ++ stderr, ++ "float -> half Old: %10lld (%g ns) New: %10lld (%g ns) (%10lld)\n", ++ (long long) onanos, ++ (double) onanos / ((double) numentries), ++ (long long) nnanos, ++ (double) nnanos / ((double) numentries), ++ ((long long) (onanos - nnanos))); + } + + int +@@ -367,15 +373,15 @@ main (int argc, char* argv[]) + + if (numentries > 0) + { +- uint16_t* halfs = new uint16_t[numentries]; +- float* floats = new float[numentries]; ++ uint16_t* halfs = new uint16_t[numentries]; ++ float* floats = new float[numentries]; + + if (halfs && floats) + { + srand (numentries); + for (int i = 0; i < numentries; ++i) + { +- halfs[i] = (uint16_t) (rand()); ++ halfs[i] = (uint16_t) (rand ()); + floats[i] = imath_half_to_float (halfs[i]); + } + perf_test_half_to_float (floats, halfs, numentries); +@@ -385,12 +391,14 @@ main (int argc, char* argv[]) + 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); ++ 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); ++ floats[i] = 65504.0 * (drand48 () * 2.0 - 1.0); + #endif + perf_test_float_to_half (halfs, floats, numentries); + } +diff --git a/src/ImathTest/main.cpp b/src/ImathTest/main.cpp +index 186b83d..9718185 100644 +--- a/src/ImathTest/main.cpp ++++ b/src/ImathTest/main.cpp +@@ -9,24 +9,22 @@ + + #include "testArithmetic.h" + #include "testBitPatterns.h" +-#include "testClassification.h" +-#include "testError.h" +-#include "testFunction.h" +-#include "testLimits.h" +-#include "testSize.h" +-#include "testToFloat.h" + #include "testBox.h" + #include "testBoxAlgo.h" ++#include "testClassification.h" + #include "testColor.h" ++#include "testError.h" + #include "testExtractEuler.h" + #include "testExtractSHRT.h" + #include "testFrustum.h" + #include "testFrustumTest.h" + #include "testFun.h" ++#include "testFunction.h" + #include "testInterop.h" + #include "testInterval.h" + #include "testInvert.h" + #include "testJacobiEigenSolver.h" ++#include "testLimits.h" + #include "testLineAlgo.h" + #include "testMatrix.h" + #include "testMiscMatrixAlgo.h" +@@ -37,15 +35,16 @@ + #include "testRandom.h" + #include "testRoots.h" + #include "testShear.h" ++#include "testSize.h" + #include "testTinySVD.h" ++#include "testToFloat.h" + #include "testVec.h" + + #include + #include + +-#define TEST(x) \ +- if (argc < 2 || !strcmp (argv[1], #x)) \ +- x(); ++#define TEST(x) \ ++ if (argc < 2 || !strcmp (argv[1], #x)) x (); + + int + main (int argc, char* argv[]) +diff --git a/src/ImathTest/testArithmetic.cpp b/src/ImathTest/testArithmetic.cpp +index 0b1d60a..ed66897 100644 +--- a/src/ImathTest/testArithmetic.cpp ++++ b/src/ImathTest/testArithmetic.cpp +@@ -7,22 +7,22 @@ + # undef NDEBUG + #endif + +-#include ++#include "testArithmetic.h" + #include ++#include + #include +-#include "testArithmetic.h" + + using namespace std; + + void +-testArithmetic() ++testArithmetic () + { + cout << "basic arithmetic operations:\n"; + + float f1 (1); + float f2 (2); +- half h1 (3); +- half h2 (4); ++ half h1 (3); ++ half h2 (4); + + cout << "f1 = " << f1 + << ", " +diff --git a/src/ImathTest/testArithmetic.h b/src/ImathTest/testArithmetic.h +index c703579..8596d28 100644 +--- a/src/ImathTest/testArithmetic.h ++++ b/src/ImathTest/testArithmetic.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testArithmetic(); ++void testArithmetic (); +diff --git a/src/ImathTest/testBitPatterns.cpp b/src/ImathTest/testBitPatterns.cpp +index d341810..b504958 100644 +--- a/src/ImathTest/testBitPatterns.cpp ++++ b/src/ImathTest/testBitPatterns.cpp +@@ -7,12 +7,12 @@ + # undef NDEBUG + #endif + +-#include ++#include "testBitPatterns.h" + #include + #include ++#include + #include + #include +-#include "testBitPatterns.h" + + using namespace std; + +@@ -35,8 +35,7 @@ equalBitPatterns (const char* b1, const char* b2) + + while (*b1 && *b2) + { +- if (*b1 != *b2 && *b1 != 'X' && *b2 != 'X') +- return false; ++ if (*b1 != *b2 && *b1 != 'X' && *b2 != 'X') return false; + + ++b1; + ++b2; +@@ -48,7 +47,7 @@ equalBitPatterns (const char* b1, const char* b2) + void + testBits (float f, const char bh[19], const char bg[35]) + { +- half h (f); ++ half h (f); + float g (h); + + cout.width (15); +@@ -85,7 +84,7 @@ testBits (float f, const char bh[19], const char bg[35]) + } + + float +-floatPosInfinity() ++floatPosInfinity () + { + half::uif x; + x.i = 0x7f800000; +@@ -93,7 +92,7 @@ floatPosInfinity() + } + + float +-floatNegInfinity() ++floatNegInfinity () + { + half::uif x; + x.i = 0xff800000; +@@ -101,7 +100,7 @@ floatNegInfinity() + } + + float +-floatPosQNan1() ++floatPosQNan1 () + { + half::uif x; + x.i = 0x7fffffff; +@@ -109,7 +108,7 @@ floatPosQNan1() + } + + float +-floatNegQNan1() ++floatNegQNan1 () + { + half::uif x; + x.i = 0xffffffff; +@@ -117,7 +116,7 @@ floatNegQNan1() + } + + float +-floatPosQNan2() ++floatPosQNan2 () + { + half::uif x; + x.i = 0x7fd55555; +@@ -125,7 +124,7 @@ floatPosQNan2() + } + + float +-floatNegQNan2() ++floatNegQNan2 () + { + half::uif x; + x.i = 0xffd55555; +@@ -135,7 +134,7 @@ floatNegQNan2() + } // namespace + + void +-testBitPatterns() ++testBitPatterns () + { + cout << "specific bit patterns\n\n"; + +@@ -144,94 +143,137 @@ testBitPatterns() + // + + testBits (1.0f, "0 01111 0000000000", "0 01111111 00000000000000000000000"); +- testBits (1.0f + HALF_EPSILON, "0 01111 0000000001", "0 01111111 00000000010000000000000"); +- testBits (1.0f + HALF_EPSILON * 0.5f, +- "0 01111 0000000000", +- "0 01111111 00000000000000000000000"); +- testBits (1.0f + HALF_EPSILON * 0.4999f, +- "0 01111 0000000000", +- "0 01111111 00000000000000000000000"); +- testBits (1.0f + HALF_EPSILON * 0.5001f, +- "0 01111 0000000001", +- "0 01111111 00000000010000000000000"); +- testBits (1.0f + HALF_EPSILON + HALF_EPSILON, +- "0 01111 0000000010", +- "0 01111111 00000000100000000000000"); +- testBits (1.0f + HALF_EPSILON + HALF_EPSILON * 0.5f, +- "0 01111 0000000010", +- "0 01111111 00000000100000000000000"); +- testBits (1.0f + HALF_EPSILON + HALF_EPSILON * 0.4999f, +- "0 01111 0000000001", +- "0 01111111 00000000010000000000000"); +- testBits (1.0f + HALF_EPSILON + HALF_EPSILON * 0.5001f, +- "0 01111 0000000010", +- "0 01111111 00000000100000000000000"); +- testBits (1.0f - HALF_EPSILON * 0.5f, +- "0 01110 1111111111", +- "0 01111110 11111111110000000000000"); +- testBits (1.0f - HALF_EPSILON * 0.5f * 0.5f, +- "0 01111 0000000000", +- "0 01111111 00000000000000000000000"); +- testBits (1.0f - HALF_EPSILON * 0.5f * 0.4999f, +- "0 01111 0000000000", +- "0 01111111 00000000000000000000000"); +- testBits (1.0f - HALF_EPSILON * 0.5f * 0.5001f, +- "0 01110 1111111111", +- "0 01111110 11111111110000000000000"); ++ testBits ( ++ 1.0f + HALF_EPSILON, ++ "0 01111 0000000001", ++ "0 01111111 00000000010000000000000"); ++ testBits ( ++ 1.0f + HALF_EPSILON * 0.5f, ++ "0 01111 0000000000", ++ "0 01111111 00000000000000000000000"); ++ testBits ( ++ 1.0f + HALF_EPSILON * 0.4999f, ++ "0 01111 0000000000", ++ "0 01111111 00000000000000000000000"); ++ testBits ( ++ 1.0f + HALF_EPSILON * 0.5001f, ++ "0 01111 0000000001", ++ "0 01111111 00000000010000000000000"); ++ testBits ( ++ 1.0f + HALF_EPSILON + HALF_EPSILON, ++ "0 01111 0000000010", ++ "0 01111111 00000000100000000000000"); ++ testBits ( ++ 1.0f + HALF_EPSILON + HALF_EPSILON * 0.5f, ++ "0 01111 0000000010", ++ "0 01111111 00000000100000000000000"); ++ testBits ( ++ 1.0f + HALF_EPSILON + HALF_EPSILON * 0.4999f, ++ "0 01111 0000000001", ++ "0 01111111 00000000010000000000000"); ++ testBits ( ++ 1.0f + HALF_EPSILON + HALF_EPSILON * 0.5001f, ++ "0 01111 0000000010", ++ "0 01111111 00000000100000000000000"); ++ testBits ( ++ 1.0f - HALF_EPSILON * 0.5f, ++ "0 01110 1111111111", ++ "0 01111110 11111111110000000000000"); ++ testBits ( ++ 1.0f - HALF_EPSILON * 0.5f * 0.5f, ++ "0 01111 0000000000", ++ "0 01111111 00000000000000000000000"); ++ testBits ( ++ 1.0f - HALF_EPSILON * 0.5f * 0.4999f, ++ "0 01111 0000000000", ++ "0 01111111 00000000000000000000000"); ++ testBits ( ++ 1.0f - HALF_EPSILON * 0.5f * 0.5001f, ++ "0 01110 1111111111", ++ "0 01111110 11111111110000000000000"); + + // + // Numbers close to HALF_DENORM_MIN + // + +- testBits (HALF_DENORM_MIN, "0 00000 0000000001", "0 01100111 00000000000000000000000"); +- testBits (HALF_DENORM_MIN + HALF_DENORM_MIN, "0 00000 0000000010", "0 01101000 00000000000000000000000"); +- testBits (HALF_DENORM_MIN + HALF_DENORM_MIN * 0.5f, +- "0 00000 0000000010", +- "0 01101000 00000000000000000000000"); +- testBits (HALF_DENORM_MIN + HALF_DENORM_MIN * 0.4999f, +- "0 00000 0000000001", +- "0 01100111 00000000000000000000000"); +- testBits (HALF_DENORM_MIN + HALF_DENORM_MIN * 0.5001f, +- "0 00000 0000000010", +- "0 01101000 00000000000000000000000"); +- testBits (HALF_DENORM_MIN - HALF_DENORM_MIN, // NOSONAR - suppress SonarCloud bug report. +- "0 00000 0000000000", +- "0 00000000 00000000000000000000000"); +- testBits (HALF_DENORM_MIN - HALF_DENORM_MIN * 0.5f, +- "0 00000 0000000000", +- "0 00000000 00000000000000000000000"); +- testBits (HALF_DENORM_MIN - HALF_DENORM_MIN * 0.4999f, +- "0 00000 0000000001", +- "0 01100111 00000000000000000000000"); +- testBits (HALF_DENORM_MIN - HALF_DENORM_MIN * 0.5001f, +- "0 00000 0000000000", +- "0 00000000 00000000000000000000000"); ++ testBits ( ++ HALF_DENORM_MIN, ++ "0 00000 0000000001", ++ "0 01100111 00000000000000000000000"); ++ testBits ( ++ HALF_DENORM_MIN + HALF_DENORM_MIN, ++ "0 00000 0000000010", ++ "0 01101000 00000000000000000000000"); ++ testBits ( ++ HALF_DENORM_MIN + HALF_DENORM_MIN * 0.5f, ++ "0 00000 0000000010", ++ "0 01101000 00000000000000000000000"); ++ testBits ( ++ HALF_DENORM_MIN + HALF_DENORM_MIN * 0.4999f, ++ "0 00000 0000000001", ++ "0 01100111 00000000000000000000000"); ++ testBits ( ++ HALF_DENORM_MIN + HALF_DENORM_MIN * 0.5001f, ++ "0 00000 0000000010", ++ "0 01101000 00000000000000000000000"); ++ testBits ( ++ HALF_DENORM_MIN - ++ HALF_DENORM_MIN, // NOSONAR - suppress SonarCloud bug report. ++ "0 00000 0000000000", ++ "0 00000000 00000000000000000000000"); ++ testBits ( ++ HALF_DENORM_MIN - HALF_DENORM_MIN * 0.5f, ++ "0 00000 0000000000", ++ "0 00000000 00000000000000000000000"); ++ testBits ( ++ HALF_DENORM_MIN - HALF_DENORM_MIN * 0.4999f, ++ "0 00000 0000000001", ++ "0 01100111 00000000000000000000000"); ++ testBits ( ++ HALF_DENORM_MIN - HALF_DENORM_MIN * 0.5001f, ++ "0 00000 0000000000", ++ "0 00000000 00000000000000000000000"); + + // + // Numbers close to HALF_NRM_MIN + // + +- testBits (HALF_NRM_MIN, "0 00001 0000000000", "0 01110001 00000000000000000000000"); +- testBits (HALF_NRM_MIN + HALF_DENORM_MIN, "0 00001 0000000001", "0 01110001 00000000010000000000000"); +- testBits (HALF_NRM_MIN + HALF_DENORM_MIN * 0.5f, +- "0 00001 0000000000", +- "0 01110001 00000000000000000000000"); +- testBits (HALF_NRM_MIN + HALF_DENORM_MIN * 0.4999f, +- "0 00001 0000000000", +- "0 01110001 00000000000000000000000"); +- testBits (HALF_NRM_MIN + HALF_DENORM_MIN * 0.5001f, +- "0 00001 0000000001", +- "0 01110001 00000000010000000000000"); +- testBits (HALF_NRM_MIN - HALF_DENORM_MIN, "0 00000 1111111111", "0 01110000 11111111100000000000000"); +- testBits (HALF_NRM_MIN - HALF_DENORM_MIN * 0.5f, +- "0 00001 0000000000", +- "0 01110001 00000000000000000000000"); +- testBits (HALF_NRM_MIN - HALF_DENORM_MIN * 0.49995f, +- "0 00001 0000000000", +- "0 01110001 00000000000000000000000"); +- testBits (HALF_NRM_MIN - HALF_DENORM_MIN * 0.50005f, +- "0 00000 1111111111", +- "0 01110000 11111111100000000000000"); ++ testBits ( ++ HALF_NRM_MIN, ++ "0 00001 0000000000", ++ "0 01110001 00000000000000000000000"); ++ testBits ( ++ HALF_NRM_MIN + HALF_DENORM_MIN, ++ "0 00001 0000000001", ++ "0 01110001 00000000010000000000000"); ++ testBits ( ++ HALF_NRM_MIN + HALF_DENORM_MIN * 0.5f, ++ "0 00001 0000000000", ++ "0 01110001 00000000000000000000000"); ++ testBits ( ++ HALF_NRM_MIN + HALF_DENORM_MIN * 0.4999f, ++ "0 00001 0000000000", ++ "0 01110001 00000000000000000000000"); ++ testBits ( ++ HALF_NRM_MIN + HALF_DENORM_MIN * 0.5001f, ++ "0 00001 0000000001", ++ "0 01110001 00000000010000000000000"); ++ testBits ( ++ HALF_NRM_MIN - HALF_DENORM_MIN, ++ "0 00000 1111111111", ++ "0 01110000 11111111100000000000000"); ++ testBits ( ++ HALF_NRM_MIN - HALF_DENORM_MIN * 0.5f, ++ "0 00001 0000000000", ++ "0 01110001 00000000000000000000000"); ++ testBits ( ++ HALF_NRM_MIN - HALF_DENORM_MIN * 0.49995f, ++ "0 00001 0000000000", ++ "0 01110001 00000000000000000000000"); ++ testBits ( ++ HALF_NRM_MIN - HALF_DENORM_MIN * 0.50005f, ++ "0 00000 1111111111", ++ "0 01110000 11111111100000000000000"); + + // + // Small positive integers and simple decimal fractions +@@ -248,137 +290,186 @@ testBitPatterns() + // Numbers close to HALF_MAX + // + +- testBits (HALF_MAX, "0 11110 1111111111", "0 10001110 11111111110000000000000"); +- testBits ((1 << HALF_MAX_EXP) * 1.0, +- "0 11111 0000000000", // +infinity +- "0 11111111 00000000000000000000000"); // +infinity +- testBits ((1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.25f), +- "0 11111 0000000000", // +infinity +- "0 11111111 00000000000000000000000"); // +infinity +- testBits ((1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.25005f), +- "0 11110 1111111111", +- "0 10001110 11111111110000000000000"); +- testBits ((1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.24995f), +- "0 11111 0000000000", // +infinity +- "0 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ HALF_MAX, "0 11110 1111111111", "0 10001110 11111111110000000000000"); ++ testBits ( ++ (1 << HALF_MAX_EXP) * 1.0, ++ "0 11111 0000000000", // +infinity ++ "0 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ (1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.25f), ++ "0 11111 0000000000", // +infinity ++ "0 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ (1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.25005f), ++ "0 11110 1111111111", ++ "0 10001110 11111111110000000000000"); ++ testBits ( ++ (1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.24995f), ++ "0 11111 0000000000", // +infinity ++ "0 11111111 00000000000000000000000"); // +infinity + + // + // Large positive numbers, positive infinity and NANs + // + +- testBits (HALF_MAX * HALF_MAX, +- "0 11111 0000000000", // +infinity +- "0 11111111 00000000000000000000000"); // +infinity +- testBits (FLT_MAX, +- "0 11111 0000000000", // +infinity +- "0 11111111 00000000000000000000000"); // +infinity +- testBits (floatPosInfinity(), +- "0 11111 0000000000", // +infinity +- "0 11111111 00000000000000000000000"); // +infinity +- testBits (floatPosQNan1(), +- "0 11111 1111111111", // nan +- "0 11111111 11111111110000000000000"); // nan +- testBits (floatPosQNan2(), +- "0 11111 1010101010", // nan +- "0 11111111 10101010100000000000000"); // nan ++ testBits ( ++ HALF_MAX * HALF_MAX, ++ "0 11111 0000000000", // +infinity ++ "0 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ FLT_MAX, ++ "0 11111 0000000000", // +infinity ++ "0 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ floatPosInfinity (), ++ "0 11111 0000000000", // +infinity ++ "0 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ floatPosQNan1 (), ++ "0 11111 1111111111", // nan ++ "0 11111111 11111111110000000000000"); // nan ++ testBits ( ++ floatPosQNan2 (), ++ "0 11111 1010101010", // nan ++ "0 11111111 10101010100000000000000"); // nan + + // + // Numbers close to -1.0 + // + + testBits (-1.0, "1 01111 0000000000", "1 01111111 00000000000000000000000"); +- testBits (-(1.0f + HALF_EPSILON), "1 01111 0000000001", "1 01111111 00000000010000000000000"); +- testBits (-(1.0f + HALF_EPSILON * 0.5f), +- "1 01111 0000000000", +- "1 01111111 00000000000000000000000"); +- testBits (-(1.0f + HALF_EPSILON * 0.4999f), +- "1 01111 0000000000", +- "1 01111111 00000000000000000000000"); +- testBits (-(1.0f + HALF_EPSILON * 0.5001f), +- "1 01111 0000000001", +- "1 01111111 00000000010000000000000"); +- testBits (-(1.0f + HALF_EPSILON + HALF_EPSILON), +- "1 01111 0000000010", +- "1 01111111 00000000100000000000000"); +- testBits (-(1.0f + HALF_EPSILON + HALF_EPSILON * 0.5f), +- "1 01111 0000000010", +- "1 01111111 00000000100000000000000"); +- testBits (-(1.0f + HALF_EPSILON + HALF_EPSILON * 0.4999f), +- "1 01111 0000000001", +- "1 01111111 00000000010000000000000"); +- testBits (-(1.0f + HALF_EPSILON + HALF_EPSILON * 0.5001f), +- "1 01111 0000000010", +- "1 01111111 00000000100000000000000"); +- testBits (-(1.0f - HALF_EPSILON * 0.5f), +- "1 01110 1111111111", +- "1 01111110 11111111110000000000000"); +- testBits (-(1.0f - HALF_EPSILON * 0.5f * 0.5f), +- "1 01111 0000000000", +- "1 01111111 00000000000000000000000"); +- testBits (-(1.0f - HALF_EPSILON * 0.5f * 0.4999f), +- "1 01111 0000000000", +- "1 01111111 00000000000000000000000"); +- testBits (-(1.0f - HALF_EPSILON * 0.5f * 0.5001f), +- "1 01110 1111111111", +- "1 01111110 11111111110000000000000"); ++ testBits ( ++ -(1.0f + HALF_EPSILON), ++ "1 01111 0000000001", ++ "1 01111111 00000000010000000000000"); ++ testBits ( ++ -(1.0f + HALF_EPSILON * 0.5f), ++ "1 01111 0000000000", ++ "1 01111111 00000000000000000000000"); ++ testBits ( ++ -(1.0f + HALF_EPSILON * 0.4999f), ++ "1 01111 0000000000", ++ "1 01111111 00000000000000000000000"); ++ testBits ( ++ -(1.0f + HALF_EPSILON * 0.5001f), ++ "1 01111 0000000001", ++ "1 01111111 00000000010000000000000"); ++ testBits ( ++ -(1.0f + HALF_EPSILON + HALF_EPSILON), ++ "1 01111 0000000010", ++ "1 01111111 00000000100000000000000"); ++ testBits ( ++ -(1.0f + HALF_EPSILON + HALF_EPSILON * 0.5f), ++ "1 01111 0000000010", ++ "1 01111111 00000000100000000000000"); ++ testBits ( ++ -(1.0f + HALF_EPSILON + HALF_EPSILON * 0.4999f), ++ "1 01111 0000000001", ++ "1 01111111 00000000010000000000000"); ++ testBits ( ++ -(1.0f + HALF_EPSILON + HALF_EPSILON * 0.5001f), ++ "1 01111 0000000010", ++ "1 01111111 00000000100000000000000"); ++ testBits ( ++ -(1.0f - HALF_EPSILON * 0.5f), ++ "1 01110 1111111111", ++ "1 01111110 11111111110000000000000"); ++ testBits ( ++ -(1.0f - HALF_EPSILON * 0.5f * 0.5f), ++ "1 01111 0000000000", ++ "1 01111111 00000000000000000000000"); ++ testBits ( ++ -(1.0f - HALF_EPSILON * 0.5f * 0.4999f), ++ "1 01111 0000000000", ++ "1 01111111 00000000000000000000000"); ++ testBits ( ++ -(1.0f - HALF_EPSILON * 0.5f * 0.5001f), ++ "1 01110 1111111111", ++ "1 01111110 11111111110000000000000"); + + // + // Numbers close to -HALF_DENORM_MIN + // + +- testBits (-HALF_DENORM_MIN, "1 00000 0000000001", "1 01100111 00000000000000000000000"); +- testBits (-(HALF_DENORM_MIN + HALF_DENORM_MIN), "1 00000 0000000010", "1 01101000 00000000000000000000000"); +- testBits (-(HALF_DENORM_MIN + HALF_DENORM_MIN * 0.5f), +- "1 00000 0000000010", +- "1 01101000 00000000000000000000000"); +- testBits (-(HALF_DENORM_MIN + HALF_DENORM_MIN * 0.4999f), +- "1 00000 0000000001", +- "1 01100111 00000000000000000000000"); +- testBits (-(HALF_DENORM_MIN + HALF_DENORM_MIN * 0.5001f), +- "1 00000 0000000010", +- "1 01101000 00000000000000000000000"); +- testBits (-(HALF_DENORM_MIN - HALF_DENORM_MIN), // NOSONAR - suppress SonarCloud bug report. +- "X 00000 0000000000", +- "X 00000000 00000000000000000000000"); +- testBits (-(HALF_DENORM_MIN - HALF_DENORM_MIN * 0.5f), +- "1 00000 0000000000", +- "1 00000000 00000000000000000000000"); +- testBits (-(HALF_DENORM_MIN - HALF_DENORM_MIN * 0.4999f), +- "1 00000 0000000001", +- "1 01100111 00000000000000000000000"); +- testBits (-(HALF_DENORM_MIN - HALF_DENORM_MIN * 0.5001f), +- "1 00000 0000000000", +- "1 00000000 00000000000000000000000"); ++ testBits ( ++ -HALF_DENORM_MIN, ++ "1 00000 0000000001", ++ "1 01100111 00000000000000000000000"); ++ testBits ( ++ -(HALF_DENORM_MIN + HALF_DENORM_MIN), ++ "1 00000 0000000010", ++ "1 01101000 00000000000000000000000"); ++ testBits ( ++ -(HALF_DENORM_MIN + HALF_DENORM_MIN * 0.5f), ++ "1 00000 0000000010", ++ "1 01101000 00000000000000000000000"); ++ testBits ( ++ -(HALF_DENORM_MIN + HALF_DENORM_MIN * 0.4999f), ++ "1 00000 0000000001", ++ "1 01100111 00000000000000000000000"); ++ testBits ( ++ -(HALF_DENORM_MIN + HALF_DENORM_MIN * 0.5001f), ++ "1 00000 0000000010", ++ "1 01101000 00000000000000000000000"); ++ testBits ( ++ -(HALF_DENORM_MIN - ++ HALF_DENORM_MIN), // NOSONAR - suppress SonarCloud bug report. ++ "X 00000 0000000000", ++ "X 00000000 00000000000000000000000"); ++ testBits ( ++ -(HALF_DENORM_MIN - HALF_DENORM_MIN * 0.5f), ++ "1 00000 0000000000", ++ "1 00000000 00000000000000000000000"); ++ testBits ( ++ -(HALF_DENORM_MIN - HALF_DENORM_MIN * 0.4999f), ++ "1 00000 0000000001", ++ "1 01100111 00000000000000000000000"); ++ testBits ( ++ -(HALF_DENORM_MIN - HALF_DENORM_MIN * 0.5001f), ++ "1 00000 0000000000", ++ "1 00000000 00000000000000000000000"); + + // + // Numbers close to -HALF_NRM_MIN + // + +- testBits (-HALF_NRM_MIN, "1 00001 0000000000", "1 01110001 00000000000000000000000"); +- testBits (-(HALF_NRM_MIN + HALF_DENORM_MIN), +- "1 00001 0000000001", +- "1 01110001 00000000010000000000000"); +- testBits (-(HALF_NRM_MIN + HALF_DENORM_MIN * 0.5f), +- "1 00001 0000000000", +- "1 01110001 00000000000000000000000"); +- testBits (-(HALF_NRM_MIN + HALF_DENORM_MIN * 0.4999f), +- "1 00001 0000000000", +- "1 01110001 00000000000000000000000"); +- testBits (-(HALF_NRM_MIN + HALF_DENORM_MIN * 0.5001f), +- "1 00001 0000000001", +- "1 01110001 00000000010000000000000"); +- testBits (-(HALF_NRM_MIN - HALF_DENORM_MIN), +- "1 00000 1111111111", +- "1 01110000 11111111100000000000000"); +- testBits (-(HALF_NRM_MIN - HALF_DENORM_MIN * 0.5f), +- "1 00001 0000000000", +- "1 01110001 00000000000000000000000"); +- testBits (-(HALF_NRM_MIN - HALF_DENORM_MIN * 0.49995f), +- "1 00001 0000000000", +- "1 01110001 00000000000000000000000"); +- testBits (-(HALF_NRM_MIN - HALF_DENORM_MIN * 0.50005f), +- "1 00000 1111111111", +- "1 01110000 11111111100000000000000"); ++ testBits ( ++ -HALF_NRM_MIN, ++ "1 00001 0000000000", ++ "1 01110001 00000000000000000000000"); ++ testBits ( ++ -(HALF_NRM_MIN + HALF_DENORM_MIN), ++ "1 00001 0000000001", ++ "1 01110001 00000000010000000000000"); ++ testBits ( ++ -(HALF_NRM_MIN + HALF_DENORM_MIN * 0.5f), ++ "1 00001 0000000000", ++ "1 01110001 00000000000000000000000"); ++ testBits ( ++ -(HALF_NRM_MIN + HALF_DENORM_MIN * 0.4999f), ++ "1 00001 0000000000", ++ "1 01110001 00000000000000000000000"); ++ testBits ( ++ -(HALF_NRM_MIN + HALF_DENORM_MIN * 0.5001f), ++ "1 00001 0000000001", ++ "1 01110001 00000000010000000000000"); ++ testBits ( ++ -(HALF_NRM_MIN - HALF_DENORM_MIN), ++ "1 00000 1111111111", ++ "1 01110000 11111111100000000000000"); ++ testBits ( ++ -(HALF_NRM_MIN - HALF_DENORM_MIN * 0.5f), ++ "1 00001 0000000000", ++ "1 01110001 00000000000000000000000"); ++ testBits ( ++ -(HALF_NRM_MIN - HALF_DENORM_MIN * 0.49995f), ++ "1 00001 0000000000", ++ "1 01110001 00000000000000000000000"); ++ testBits ( ++ -(HALF_NRM_MIN - HALF_DENORM_MIN * 0.50005f), ++ "1 00000 1111111111", ++ "1 01110000 11111111100000000000000"); + + // + // Small negative integers and simple decimal fractions +@@ -387,47 +478,60 @@ testBitPatterns() + testBits (-2, "1 10000 0000000000", "1 10000000 00000000000000000000000"); + testBits (-3, "1 10000 1000000000", "1 10000000 10000000000000000000000"); + testBits (-10, "1 10010 0100000000", "1 10000010 01000000000000000000000"); +- testBits (-0.1f, "1 01011 1001100110", "1 01111011 10011001100000000000000"); +- testBits (-0.2f, "1 01100 1001100110", "1 01111100 10011001100000000000000"); +- testBits (-0.3f, "1 01101 0011001101", "1 01111101 00110011010000000000000"); ++ testBits ( ++ -0.1f, "1 01011 1001100110", "1 01111011 10011001100000000000000"); ++ testBits ( ++ -0.2f, "1 01100 1001100110", "1 01111100 10011001100000000000000"); ++ testBits ( ++ -0.3f, "1 01101 0011001101", "1 01111101 00110011010000000000000"); + + // + // Numbers close to -HALF_MAX + // + +- testBits (-HALF_MAX, "1 11110 1111111111", "1 10001110 11111111110000000000000"); +- testBits (-(1 << HALF_MAX_EXP) * 1.0f, +- "1 11111 0000000000", // +infinity +- "1 11111111 00000000000000000000000"); // +infinity +- testBits (-(1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.25f), +- "1 11111 0000000000", // +infinity +- "1 11111111 00000000000000000000000"); // +infinity +- testBits (-(1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.25005f), +- "1 11110 1111111111", +- "1 10001110 11111111110000000000000"); +- testBits (-(1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.24995f), +- "1 11111 0000000000", // +infinity +- "1 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ -HALF_MAX, "1 11110 1111111111", "1 10001110 11111111110000000000000"); ++ testBits ( ++ -(1 << HALF_MAX_EXP) * 1.0f, ++ "1 11111 0000000000", // +infinity ++ "1 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ -(1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.25f), ++ "1 11111 0000000000", // +infinity ++ "1 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ -(1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.25005f), ++ "1 11110 1111111111", ++ "1 10001110 11111111110000000000000"); ++ testBits ( ++ -(1 << HALF_MAX_EXP) * (1.0f - HALF_EPSILON * 0.24995f), ++ "1 11111 0000000000", // +infinity ++ "1 11111111 00000000000000000000000"); // +infinity + + // + // Large negative numbers, negative infinity and NANs + // + +- testBits (-HALF_MAX * HALF_MAX, +- "1 11111 0000000000", // +infinity +- "1 11111111 00000000000000000000000"); // +infinity +- testBits (-FLT_MAX, +- "1 11111 0000000000", // +infinity +- "1 11111111 00000000000000000000000"); // +infinity +- testBits (floatNegInfinity(), +- "1 11111 0000000000", // +infinity +- "1 11111111 00000000000000000000000"); // +infinity +- testBits (floatNegQNan1(), +- "1 11111 1111111111", // nan +- "1 11111111 11111111110000000000000"); // nan +- testBits (floatNegQNan2(), +- "1 11111 1010101010", // nan +- "1 11111111 10101010100000000000000"); // nan ++ testBits ( ++ -HALF_MAX * HALF_MAX, ++ "1 11111 0000000000", // +infinity ++ "1 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ -FLT_MAX, ++ "1 11111 0000000000", // +infinity ++ "1 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ floatNegInfinity (), ++ "1 11111 0000000000", // +infinity ++ "1 11111111 00000000000000000000000"); // +infinity ++ testBits ( ++ floatNegQNan1 (), ++ "1 11111 1111111111", // nan ++ "1 11111111 11111111110000000000000"); // nan ++ testBits ( ++ floatNegQNan2 (), ++ "1 11111 1010101010", // nan ++ "1 11111111 10101010100000000000000"); // nan + + cout << "ok\n\n" << flush; + } +diff --git a/src/ImathTest/testBitPatterns.h b/src/ImathTest/testBitPatterns.h +index 62192b9..f8cfbc8 100644 +--- a/src/ImathTest/testBitPatterns.h ++++ b/src/ImathTest/testBitPatterns.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testBitPatterns(); ++void testBitPatterns (); +diff --git a/src/ImathTest/testBox.cpp b/src/ImathTest/testBox.cpp +index dfa8eff..982e072 100644 +--- a/src/ImathTest/testBox.cpp ++++ b/src/ImathTest/testBox.cpp +@@ -10,12 +10,12 @@ + #include + #include + ++#include "testBoxAlgo.h" + #include + #include + #include + #include + #include +-#include "testBoxAlgo.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -37,7 +37,7 @@ static void + addItem (const std::vector& value, std::vector& perms) + { + T p; +- for (unsigned int i = 0; i < value.size(); i++) ++ for (unsigned int i = 0; i < value.size (); i++) + { + p[i] = value[i]; + } +@@ -55,8 +55,7 @@ visit (int& level, int n, int k, std::vector& value, std::vector& perms) + addItem (value, perms); + else + for (int i = 0; i < n; i++) +- if (value[i] == 0) +- visit (level, n, i, value, perms); ++ if (value[i] == 0) visit (level, n, i, value, perms); + + level = level - 1; + value[k] = 0; +@@ -66,9 +65,9 @@ template + static void + permutations (std::vector& perms) + { +- std::vector value (T::dimensions()); +- int level = -1; +- int n = T::dimensions(); ++ std::vector value (T::dimensions ()); ++ int level = -1; ++ int n = T::dimensions (); + + visit (level, n, 0, value, perms); + } +@@ -84,7 +83,9 @@ testConstructors (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- assert (b.min == T (T::baseTypeMax()) && b.max == T (T::baseTypeLowest())); ++ assert ( ++ b.min == T (T::baseTypeMax ()) && ++ b.max == T (T::baseTypeLowest ())); + } + + // +@@ -92,7 +93,7 @@ testConstructors (const char* type) + // + { + T p; +- for (unsigned int i = 0; i < T::dimensions(); i++) ++ for (unsigned int i = 0; i < T::dimensions (); i++) + p[i] = i; + + IMATH_INTERNAL_NAMESPACE::Box b (p); +@@ -105,10 +106,10 @@ testConstructors (const char* type) + { + T p0; + T p1; +- for (unsigned int i = 0; i < T::dimensions(); i++) ++ for (unsigned int i = 0; i < T::dimensions (); i++) + { + p0[i] = i; +- p1[i] = 10 * T::dimensions() - i - 1; ++ p1[i] = 10 * T::dimensions () - i - 1; + } + + IMATH_INTERNAL_NAMESPACE::Box b (p0, p1); +@@ -127,8 +128,10 @@ testMakeEmpty (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- b.makeEmpty(); +- assert (b.min == T (T::baseTypeMax()) && b.max == T (T::baseTypeLowest())); ++ b.makeEmpty (); ++ assert ( ++ b.min == T (T::baseTypeMax ()) && ++ b.max == T (T::baseTypeLowest ())); + } + + // +@@ -136,8 +139,10 @@ testMakeEmpty (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b (T (-1), T (1)); +- b.makeEmpty(); +- assert (b.min == T (T::baseTypeMax()) && b.max == T (T::baseTypeLowest())); ++ b.makeEmpty (); ++ assert ( ++ b.min == T (T::baseTypeMax ()) && ++ b.max == T (T::baseTypeLowest ())); + } + + // +@@ -150,11 +155,13 @@ testMakeEmpty (const char* type) + { + T min (0); + T max (0); +- max[T::dimensions() - 1] = 1; ++ max[T::dimensions () - 1] = 1; + + IMATH_INTERNAL_NAMESPACE::Box b (min, max); +- b.makeEmpty(); +- assert (b.min == T (T::baseTypeMax()) && b.max == T (T::baseTypeLowest())); ++ b.makeEmpty (); ++ assert ( ++ b.min == T (T::baseTypeMax ()) && ++ b.max == T (T::baseTypeLowest ())); + } + } + +@@ -169,8 +176,10 @@ testMakeInfinite (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- b.makeInfinite(); +- assert (b.min == T (T::baseTypeLowest()) && b.max == T (T::baseTypeMax())); ++ b.makeInfinite (); ++ assert ( ++ b.min == T (T::baseTypeLowest ()) && ++ b.max == T (T::baseTypeMax ())); + } + + // +@@ -178,8 +187,10 @@ testMakeInfinite (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b (T (-1), T (1)); +- b.makeInfinite(); +- assert (b.min == T (T::baseTypeLowest()) && b.max == T (T::baseTypeMax())); ++ b.makeInfinite (); ++ assert ( ++ b.min == T (T::baseTypeLowest ()) && ++ b.max == T (T::baseTypeMax ())); + } + + // +@@ -192,11 +203,13 @@ testMakeInfinite (const char* type) + { + T min (0); + T max (0); +- max[T::dimensions() - 1] = 1; ++ max[T::dimensions () - 1] = 1; + + IMATH_INTERNAL_NAMESPACE::Box b (min, max); +- b.makeInfinite(); +- assert (b.min == T (T::baseTypeLowest()) && b.max == T (T::baseTypeMax())); ++ b.makeInfinite (); ++ assert ( ++ b.min == T (T::baseTypeLowest ()) && ++ b.max == T (T::baseTypeMax ())); + } + } + +@@ -216,7 +229,7 @@ testExtendByPoint (const char* type) + for (unsigned int i = 0; i < iters; i++) + { + T p; +- for (unsigned int j = 0; j < T::dimensions(); j++) ++ for (unsigned int j = 0; j < T::dimensions (); j++) + p[j] = typename T::BaseType (rand.nextf (-12345, 12345)); + + IMATH_INTERNAL_NAMESPACE::Box b; +@@ -238,7 +251,7 @@ testExtendByPoint (const char* type) + for (unsigned int j = 0; j < i; j++) + { + T p; +- for (unsigned int k = 0; k < T::dimensions(); k++) ++ for (unsigned int k = 0; k < T::dimensions (); k++) + p[k] = typename T::BaseType (rand.nextf (-12345, 12345)); + + if (j == 0) +@@ -246,7 +259,7 @@ testExtendByPoint (const char* type) + min = p; + max = p; + } +- for (unsigned int k = 0; k < T::dimensions(); k++) ++ for (unsigned int k = 0; k < T::dimensions (); k++) + { + min[k] = std::min (min[k], p[k]); + max[k] = std::max (max[k], p[k]); +@@ -270,8 +283,10 @@ testExtendByBox (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- b.extendBy (IMATH_INTERNAL_NAMESPACE::Box()); +- assert (b.min == T (T::baseTypeMax()) && b.max == T (T::baseTypeLowest())); ++ b.extendBy (IMATH_INTERNAL_NAMESPACE::Box ()); ++ assert ( ++ b.min == T (T::baseTypeMax ()) && ++ b.max == T (T::baseTypeLowest ())); + } + + // +@@ -281,9 +296,9 @@ testExtendByBox (const char* type) + std::vector perms; + permutations (perms); + +- for (unsigned int i = 0; i < perms.size(); i++) ++ for (unsigned int i = 0; i < perms.size (); i++) + { +- for (unsigned int j = 0; j < perms.size(); j++) ++ for (unsigned int j = 0; j < perms.size (); j++) + { + T p0 = -perms[i]; + T p1 = perms[j]; +@@ -293,7 +308,7 @@ testExtendByBox (const char* type) + assert (b0.min == p0 && b0.max == p1); + + IMATH_INTERNAL_NAMESPACE::Box b1 (p0, p1); +- b1.extendBy (IMATH_INTERNAL_NAMESPACE::Box()); ++ b1.extendBy (IMATH_INTERNAL_NAMESPACE::Box ()); + assert (b1.min == p0 && b1.max == p1); + } + } +@@ -303,7 +318,7 @@ testExtendByBox (const char* type) + // Extend non-empty box with non-empty box. Starts with empty, then builds. + // + IMATH_INTERNAL_NAMESPACE::Rand32 rand (0); +- const unsigned int iters = 10; ++ const unsigned int iters = 10; + { + IMATH_INTERNAL_NAMESPACE::Box b; + +@@ -313,7 +328,7 @@ testExtendByBox (const char* type) + { + T p0; + T p1; +- for (unsigned int k = 0; k < T::dimensions(); k++) ++ for (unsigned int k = 0; k < T::dimensions (); k++) + { + p0[k] = typename T::BaseType (rand.nextf (0, 999)); + p1[k] = typename T::BaseType (rand.nextf (1000, 1999)); +@@ -321,7 +336,7 @@ testExtendByBox (const char* type) + + min = b.min; + max = b.max; +- for (unsigned int k = 0; k < T::dimensions(); k++) ++ for (unsigned int k = 0; k < T::dimensions (); k++) + { + min[k] = std::min (min[k], p0[k]); + max[k] = std::max (max[k], p1[k]); +@@ -359,9 +374,9 @@ testComparators (const char* type) + std::vector perms; + permutations (perms); + +- for (unsigned int i = 0; i < perms.size(); i++) ++ for (unsigned int i = 0; i < perms.size (); i++) + { +- for (unsigned int j = 0; j < perms.size(); j++) ++ for (unsigned int j = 0; j < perms.size (); j++) + { + T p0 = -perms[i]; + T p1 = perms[j]; +@@ -381,9 +396,9 @@ testComparators (const char* type) + std::vector perms; + permutations (perms); + +- for (unsigned int i = 0; i < perms.size(); i++) ++ for (unsigned int i = 0; i < perms.size (); i++) + { +- for (unsigned int j = 0; j < perms.size(); j++) ++ for (unsigned int j = 0; j < perms.size (); j++) + { + T p0 = -perms[i]; + T p1 = perms[j]; +@@ -425,7 +440,7 @@ testIntersects (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- T p (1); ++ T p (1); + + assert (!b.intersects (p)); + } +@@ -435,9 +450,9 @@ testIntersects (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b (T (-1), T (1)); +- T p0 (0); +- T p1 (5); +- T p2 (-5); ++ T p0 (0); ++ T p1 (5); ++ T p2 (-5); + + assert (b.intersects (p0)); + assert (!b.intersects (p1)); +@@ -453,11 +468,11 @@ testIntersects (const char* type) + // + { + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 1; ++ T max = min; ++ max[T::dimensions () - 1] = 1; + +- T p0 (0); +- T p1 (5); ++ T p0 (0); ++ T p1 (5); + IMATH_INTERNAL_NAMESPACE::Box b (min, max); + + assert (b.intersects (p0)); +@@ -499,8 +514,8 @@ testIntersects (const char* type) + // + { + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 1; ++ T max = min; ++ max[T::dimensions () - 1] = 1; + + IMATH_INTERNAL_NAMESPACE::Box b0; + IMATH_INTERNAL_NAMESPACE::Box b1 (min, max); +@@ -538,8 +553,8 @@ testIntersects (const char* type) + IMATH_INTERNAL_NAMESPACE::Box b0 (T (-1), T (1)); + + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 1; ++ T max = min; ++ max[T::dimensions () - 1] = 1; + + IMATH_INTERNAL_NAMESPACE::Box b1 (min, max); + IMATH_INTERNAL_NAMESPACE::Box b2 (min + T (2), max + T (2)); +@@ -561,8 +576,8 @@ testIntersects (const char* type) + // + { + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 1; ++ T max = min; ++ max[T::dimensions () - 1] = 1; + + IMATH_INTERNAL_NAMESPACE::Box b0 (min, max); + IMATH_INTERNAL_NAMESPACE::Box b1 (min, max + T (2)); +@@ -587,7 +602,7 @@ testSize (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- assert (b.size() == T (0)); ++ assert (b.size () == T (0)); + } + + // +@@ -605,15 +620,15 @@ testSize (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b0 (T (-1), T (1)); +- assert (b0.size() == T (2)); ++ assert (b0.size () == T (2)); + + T p; +- for (unsigned int i = 0; i < T::dimensions(); i++) ++ for (unsigned int i = 0; i < T::dimensions (); i++) + { + p[i] = i; + } + IMATH_INTERNAL_NAMESPACE::Box b1 (-p, p); +- assert (b1.size() == p * T (2)); ++ assert (b1.size () == p * T (2)); + } + + // +@@ -625,12 +640,12 @@ testSize (const char* type) + // + { + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 1; ++ T max = min; ++ max[T::dimensions () - 1] = 1; + + IMATH_INTERNAL_NAMESPACE::Box b (min, max); + +- assert (b.size() == max); ++ assert (b.size () == max); + } + } + +@@ -645,7 +660,7 @@ testCenter (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- assert (b.center() == T (0)); ++ assert (b.center () == T (0)); + } + + // +@@ -663,17 +678,17 @@ testCenter (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b0 (T (-1), T (1)); +- assert (b0.center() == T (0)); ++ assert (b0.center () == T (0)); + + T p0; + T p1; +- for (unsigned int i = 0; i < T::dimensions(); i++) ++ 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)); ++ p1[i] = typename T::BaseType (1 << (T::dimensions () - i)); + } + IMATH_INTERNAL_NAMESPACE::Box b1 (p0, p1); +- assert (b1.center() == (p1 + p0) / 2); ++ assert (b1.center () == (p1 + p0) / 2); + } + + // +@@ -685,12 +700,12 @@ testCenter (const char* type) + // + { + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 2; ++ T max = min; ++ max[T::dimensions () - 1] = 2; + + IMATH_INTERNAL_NAMESPACE::Box b (min, max); + +- assert (b.center() == max / 2); ++ assert (b.center () == max / 2); + } + } + +@@ -705,7 +720,7 @@ testIsEmpty (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- assert (b.isEmpty()); ++ assert (b.isEmpty ()); + } + + // +@@ -716,17 +731,17 @@ testIsEmpty (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b0 (T (-1), T (1)); +- assert (!b0.isEmpty()); ++ assert (!b0.isEmpty ()); + + T p0; + T p1; +- for (unsigned int i = 0; i < T::dimensions(); i++) ++ 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)); ++ p1[i] = typename T::BaseType (1 << (T::dimensions () - i)); + } + IMATH_INTERNAL_NAMESPACE::Box b1 (p0, p1); +- assert (!b1.isEmpty()); ++ assert (!b1.isEmpty ()); + } + + // +@@ -738,12 +753,12 @@ testIsEmpty (const char* type) + // + { + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 2; ++ T max = min; ++ max[T::dimensions () - 1] = 2; + + IMATH_INTERNAL_NAMESPACE::Box b (min, max); + +- assert (!b.isEmpty()); ++ assert (!b.isEmpty ()); + } + } + +@@ -758,8 +773,8 @@ testIsInfinite (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- b.makeInfinite(); +- assert (b.isInfinite()); ++ b.makeInfinite (); ++ assert (b.isInfinite ()); + } + + // +@@ -770,17 +785,17 @@ testIsInfinite (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b0 (T (-1), T (1)); +- assert (!b0.isInfinite()); ++ assert (!b0.isInfinite ()); + + T p0; + T p1; +- for (unsigned int i = 0; i < T::dimensions(); i++) ++ 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)); ++ p1[i] = typename T::BaseType (1 << (T::dimensions () - i)); + } + IMATH_INTERNAL_NAMESPACE::Box b1 (p0, p1); +- assert (!b1.isInfinite()); ++ assert (!b1.isInfinite ()); + } + + // +@@ -792,12 +807,12 @@ testIsInfinite (const char* type) + // + { + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 2; ++ T max = min; ++ max[T::dimensions () - 1] = 2; + + IMATH_INTERNAL_NAMESPACE::Box b (min, max); + +- assert (!b.isInfinite()); ++ assert (!b.isInfinite ()); + } + } + +@@ -812,7 +827,7 @@ testHasVolume (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- assert (!b.hasVolume()); ++ assert (!b.hasVolume ()); + } + + // +@@ -820,8 +835,8 @@ testHasVolume (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- b.makeInfinite(); +- assert (b.hasVolume()); ++ b.makeInfinite (); ++ assert (b.hasVolume ()); + } + + // +@@ -832,17 +847,17 @@ testHasVolume (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b0 (T (-1), T (1)); +- assert (b0.hasVolume()); ++ assert (b0.hasVolume ()); + + T p0; + T p1; +- for (unsigned int i = 0; i < T::dimensions(); i++) ++ 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)); ++ p1[i] = typename T::BaseType (1 << (T::dimensions () - i)); + } + IMATH_INTERNAL_NAMESPACE::Box b1 (p0, p1); +- assert (b1.hasVolume()); ++ assert (b1.hasVolume ()); + } + + // +@@ -854,12 +869,12 @@ testHasVolume (const char* type) + // + { + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 2; ++ T max = min; ++ max[T::dimensions () - 1] = 2; + + IMATH_INTERNAL_NAMESPACE::Box b (min, max); + +- assert (!b.hasVolume()); ++ assert (!b.hasVolume ()); + } + } + +@@ -874,7 +889,7 @@ testMajorAxis (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Box b; +- assert (b.majorAxis() == 0); ++ assert (b.majorAxis () == 0); + } + + // +@@ -885,17 +900,16 @@ testMajorAxis (const char* type) + std::vector perms; + permutations (perms); + +- for (unsigned int i = 0; i < perms.size(); i++) ++ for (unsigned int i = 0; i < perms.size (); i++) + { + IMATH_INTERNAL_NAMESPACE::Box b (T (0), perms[i]); + + unsigned int major = 0; +- T size = perms[i] - T (0); +- for (unsigned int j = 1; j < T::dimensions(); j++) +- if (size[j] > size[major]) +- major = j; ++ T size = perms[i] - T (0); ++ for (unsigned int j = 1; j < T::dimensions (); j++) ++ if (size[j] > size[major]) major = j; + +- assert (b.majorAxis() == major); ++ assert (b.majorAxis () == major); + } + } + +@@ -912,15 +926,15 @@ testMajorAxis (const char* type) + // and similarly for 4D + // + { +- for (unsigned int i = 0; i < T::dimensions(); i++) ++ for (unsigned int i = 0; i < T::dimensions (); i++) + { +- for (unsigned int j = 0; j < T::dimensions(); j++) ++ for (unsigned int j = 0; j < T::dimensions (); j++) + { + T max (0); + max[j] = 1; + + IMATH_INTERNAL_NAMESPACE::Box b (T (0), max); +- assert (b.majorAxis() == j); ++ assert (b.majorAxis () == j); + } + } + } +@@ -929,7 +943,7 @@ testMajorAxis (const char* type) + } // anonymous namespace + + void +-testBox() ++testBox () + { + cout << "Testing box methods" << endl; + +diff --git a/src/ImathTest/testBox.h b/src/ImathTest/testBox.h +index eb9352c..ab5d86b 100644 +--- a/src/ImathTest/testBox.h ++++ b/src/ImathTest/testBox.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testBox(); ++void testBox (); +diff --git a/src/ImathTest/testBoxAlgo.cpp b/src/ImathTest/testBoxAlgo.cpp +index eb134d7..fcb22de 100644 +--- a/src/ImathTest/testBoxAlgo.cpp ++++ b/src/ImathTest/testBoxAlgo.cpp +@@ -7,12 +7,12 @@ + # undef NDEBUG + #endif + ++#include "testBoxAlgo.h" + #include + #include + #include + #include + #include +-#include "testBoxAlgo.h" + + using namespace std; + using namespace IMATH_INTERNAL_NAMESPACE; +@@ -32,8 +32,7 @@ approximatelyEqual (const V3f& p1, const V3f& p2, float e) + } + + for (int i = 0; i < 3; ++i) +- if (!equalWithAbsError (p1[i], p2[i], m * e)) +- return false; ++ if (!equalWithAbsError (p1[i], p2[i], m * e)) return false; + + return true; + } +@@ -43,17 +42,18 @@ testEntryAndExitPoints (const Box3f& box) + { + Rand48 random (2007); + +- float e = 50 * std::numeric_limits::epsilon(); ++ float e = 50 * std::numeric_limits::epsilon (); + +- if (box.isEmpty()) ++ if (box.isEmpty ()) + { + cout << " empty box, no rays intersect" << endl; + + 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 ( ++ 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 p2 (p1 + hollowSphereRand (random)); + +@@ -70,12 +70,20 @@ testEntryAndExitPoints (const Box3f& box) + { + cout << " single-point box, ray intersects" << endl; + +- static const float off[6][3] = { { -1, 0, 0 }, { 1, 0, 0 }, { 0, -1, 0 }, +- { 0, 1, 0 }, { 0, 0, -1 }, { 0, 0, 1 } }; ++ static const float off[6][3] = { ++ {-1, 0, 0}, ++ {1, 0, 0}, ++ {0, -1, 0}, ++ {0, 1, 0}, ++ {0, 0, -1}, ++ {0, 0, 1}}; + + for (int i = 0; i < 6; ++i) + { +- V3f p1 (box.min.x + off[i][0], box.min.y + off[i][1], box.min.z + off[i][2]); ++ V3f p1 ( ++ box.min.x + off[i][0], ++ box.min.y + off[i][1], ++ box.min.z + off[i][2]); + + V3f r, s; + assert (findEntryAndExitPoints (Line3f (p1, box.min), box, r, s)); +@@ -94,8 +102,8 @@ testEntryAndExitPoints (const Box3f& box) + const float r1 = 0.00001; + const float r2 = 1.0; + +- V3f p1 = box.min + r2 * hollowSphereRand (random); +- V3f p2; ++ V3f p1 = box.min + r2 * hollowSphereRand (random); ++ V3f p2; + float r3; + + do +@@ -105,13 +113,13 @@ testEntryAndExitPoints (const Box3f& box) + p2 = box.min + r2 * hollowSphereRand (random); + } while (approximatelyEqual (p1, p2, e)); + +- V3f d1 = (p2 - p1).normalized(); ++ V3f d1 = (p2 - p1).normalized (); + V3f d2 = (box.min - p1); +- r3 = (d2 - d1 * (d1 ^ d2)).length(); ++ r3 = (d2 - d1 * (d1 ^ d2)).length (); + } while (r3 < r1); + + Line3f ray (p1, p2); +- V3f r, s; ++ V3f r, s; + + assert (!findEntryAndExitPoints (ray, box, r, s)); + } +@@ -133,23 +141,25 @@ 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 ( ++ random.nextf (bigBox.min.x, bigBox.max.x), ++ random.nextf (bigBox.min.y, bigBox.max.y), ++ 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 ( ++ random.nextf (box.min.x, box.max.x), ++ random.nextf (box.min.y, box.max.y), ++ random.nextf (box.min.z, box.max.z)); + } while (approximatelyEqual (p1, p2, e)); + + Line3f ray (p1, p2); + +- V3f r, s; ++ V3f r, s; + bool b = findEntryAndExitPoints (ray, box, r, s); + + // +@@ -159,52 +169,42 @@ testEntryAndExitPoints (const Box3f& box) + + assert (b); + +- assert (r.x == box.min.x || r.x == box.max.x || r.y == box.min.y || r.y == box.max.y || +- r.z == box.min.z || r.z == box.max.z); ++ assert ( ++ r.x == box.min.x || r.x == box.max.x || r.y == box.min.y || ++ r.y == box.max.y || r.z == box.min.z || r.z == box.max.z); + +- assert (s.x == box.min.x || s.x == box.max.x || s.y == box.min.y || s.y == box.max.y || +- s.z == box.min.z || s.z == box.max.z); ++ assert ( ++ s.x == box.min.x || s.x == box.max.x || s.y == box.min.y || ++ s.y == box.max.y || s.z == box.min.z || s.z == box.max.z); + + // + // Entry and exit points must be consistent + // with the direction of the ray + // + +- if (r.x == box.min.x) +- assert (ray.dir.x >= 0); ++ if (r.x == box.min.x) assert (ray.dir.x >= 0); + +- if (r.x == box.max.x) +- assert (ray.dir.x <= 0); ++ if (r.x == box.max.x) assert (ray.dir.x <= 0); + +- if (r.y == box.min.y) +- assert (ray.dir.y >= 0); ++ if (r.y == box.min.y) assert (ray.dir.y >= 0); + +- if (r.y == box.max.y) +- assert (ray.dir.y <= 0); ++ if (r.y == box.max.y) assert (ray.dir.y <= 0); + +- if (r.z == box.min.z) +- assert (ray.dir.z >= 0); ++ if (r.z == box.min.z) assert (ray.dir.z >= 0); + +- if (r.z == box.max.z) +- assert (ray.dir.z <= 0); ++ if (r.z == box.max.z) assert (ray.dir.z <= 0); + +- if (s.x == box.max.x) +- assert (ray.dir.x >= 0); ++ if (s.x == box.max.x) assert (ray.dir.x >= 0); + +- if (s.x == box.min.x) +- assert (ray.dir.x <= 0); ++ if (s.x == box.min.x) assert (ray.dir.x <= 0); + +- if (s.y == box.max.y) +- assert (ray.dir.y >= 0); ++ if (s.y == box.max.y) assert (ray.dir.y >= 0); + +- if (s.y == box.min.y) +- assert (ray.dir.y <= 0); ++ if (s.y == box.min.y) assert (ray.dir.y <= 0); + +- if (s.z == box.max.z) +- assert (ray.dir.z >= 0); ++ if (s.z == box.max.z) assert (ray.dir.z >= 0); + +- if (s.z == box.min.z) +- assert (ray.dir.z <= 0); ++ if (s.z == box.min.z) assert (ray.dir.z <= 0); + + // + // Entry and exit points must be approximately on the ray +@@ -213,8 +213,8 @@ testEntryAndExitPoints (const Box3f& box) + // + + { +- V3f p3 = p1 + ray.dir * (ray.dir ^ (r - p1)); +- float m = 0; ++ V3f p3 = p1 + ray.dir * (ray.dir ^ (r - p1)); ++ float m = 0; + + for (int j = 0; j < 3; ++j) + { +@@ -222,13 +222,13 @@ testEntryAndExitPoints (const Box3f& box) + m = max (abs (r[j]), m); + } + +- float err = 30 * m * std::numeric_limits::epsilon(); ++ float err = 30 * m * std::numeric_limits::epsilon (); + assert (p3.equalWithAbsError (r, err)); + } + + { +- V3f p3 = p1 + ray.dir * (ray.dir ^ (s - p1)); +- float m = 0; ++ V3f p3 = p1 + ray.dir * (ray.dir ^ (s - p1)); ++ float m = 0; + + for (int j = 0; j < 3; ++j) + { +@@ -236,16 +236,16 @@ testEntryAndExitPoints (const Box3f& box) + m = max (abs (s[j]), m); + } + +- float err = 30 * m * std::numeric_limits::epsilon(); ++ float err = 30 * m * std::numeric_limits::epsilon (); + assert (p3.equalWithAbsError (s, err)); + } + } + + cout << " ray starts outside box, does not intersect" << endl; + +- V3f center = (box.min + box.max) * 0.5f; +- float r1 = (box.max - box.min).length() * 0.51f; +- float r2 = 2 * r1; ++ V3f center = (box.min + box.max) * 0.5f; ++ float r1 = (box.max - box.min).length () * 0.51f; ++ float r2 = 2 * r1; + + for (int i = 0; i < 100000; ++i) + { +@@ -257,8 +257,8 @@ testEntryAndExitPoints (const Box3f& box) + // of the box.) + // + +- V3f p1 = center + r2 * hollowSphereRand (random); +- V3f p2; ++ V3f p1 = center + r2 * hollowSphereRand (random); ++ V3f p2; + float r3; + + do +@@ -268,47 +268,47 @@ testEntryAndExitPoints (const Box3f& box) + p2 = center + r2 * hollowSphereRand (random); + } while (approximatelyEqual (p1, p2, e)); + +- V3f d1 = (p2 - p1).normalized(); ++ V3f d1 = (p2 - p1).normalized (); + V3f d2 = (center - p1); +- r3 = (d2 - d1 * (d1 ^ d2)).length(); ++ r3 = (d2 - d1 * (d1 ^ d2)).length (); + } while (r3 < r1); + + Line3f ray (p1, p2); +- V3f r, s; ++ V3f r, s; + + assert (!findEntryAndExitPoints (ray, box, r, s)); + } + } + + void +-entryAndExitPoints1() ++entryAndExitPoints1 () + { + cout << " ray-box entry and exit, random rays" << endl; + +- Box3f boxes[] = { // Boxes with a positive volume ++ Box3f boxes[] = { ++ // Boxes with a positive volume + +- Box3f (V3f (-1, -1, -1), V3f (1, 1, 1)), +- Box3f (V3f (10, 20, 30), V3f (1010, 21, 31)), +- Box3f (V3f (10, 20, 30), V3f (11, 1020, 31)), +- Box3f (V3f (10, 20, 30), V3f (11, 21, 1030)), +- Box3f (V3f (-1e10f, -2e10f, -3e10f), V3f (5e15f, 6e15f, 7e15f)), ++ Box3f (V3f (-1, -1, -1), V3f (1, 1, 1)), ++ Box3f (V3f (10, 20, 30), V3f (1010, 21, 31)), ++ Box3f (V3f (10, 20, 30), V3f (11, 1020, 31)), ++ Box3f (V3f (10, 20, 30), V3f (11, 21, 1030)), ++ Box3f (V3f (-1e10f, -2e10f, -3e10f), V3f (5e15f, 6e15f, 7e15f)), + +- // Non-empty, zero-volume boxes ++ // Non-empty, zero-volume boxes + +- Box3f (V3f (1, 1, 1), V3f (2, 1, 1)), +- Box3f (V3f (1, 1, 1), V3f (1, 2, 1)), +- Box3f (V3f (1, 1, 1), V3f (1, 1, 2)), +- Box3f (V3f (1, 1, 1), V3f (1, 2, 3)), +- Box3f (V3f (1, 1, 1), V3f (2, 3, 1)), +- Box3f (V3f (1, 1, 1), V3f (2, 1, 3)), +- Box3f (V3f (-1, -2, 1), V3f (-1, -2, 1)), +- Box3f (V3f (1, 1, 1), V3f (1, 1, 1)), +- Box3f (V3f (0, 0, 0), V3f (0, 0, 0)), ++ Box3f (V3f (1, 1, 1), V3f (2, 1, 1)), ++ Box3f (V3f (1, 1, 1), V3f (1, 2, 1)), ++ Box3f (V3f (1, 1, 1), V3f (1, 1, 2)), ++ Box3f (V3f (1, 1, 1), V3f (1, 2, 3)), ++ Box3f (V3f (1, 1, 1), V3f (2, 3, 1)), ++ Box3f (V3f (1, 1, 1), V3f (2, 1, 3)), ++ Box3f (V3f (-1, -2, 1), V3f (-1, -2, 1)), ++ Box3f (V3f (1, 1, 1), V3f (1, 1, 1)), ++ Box3f (V3f (0, 0, 0), V3f (0, 0, 0)), + +- // empty box ++ // empty box + +- Box3f() +- }; ++ Box3f ()}; + + for (size_t i = 0; i < sizeof (boxes) / sizeof (boxes[0]); ++i) + testEntryAndExitPoints (boxes[i]); +@@ -324,7 +324,7 @@ testPerturbedRayBoxEntryExit (const Box3f& box, const Line3f& ray, bool result) + assert (result == findEntryAndExitPoints (ray, box, r, s)); + } + +- Rand48 random (19); ++ Rand48 random (19); + const float e = 1e-25f; + + for (int i = 0; i < 10000; ++i) +@@ -338,15 +338,15 @@ testPerturbedRayBoxEntryExit (const Box3f& box, const Line3f& ray, bool result) + } + + void +-entryAndExitPoints2() ++entryAndExitPoints2 () + { + + cout << " ray-box entry and exit, nearly axis-parallel rays" << endl; + +- Box3f box (V3f (-1e15f, -1e15f, -1e15f), V3f (1e15f, 1e15f, 1e15f)); ++ Box3f box (V3f (-1e15f, -1e15f, -1e15f), V3f (1e15f, 1e15f, 1e15f)); + Line3f ray; +- V3f r, s; +- bool b; ++ V3f r, s; ++ bool b; + + ray = Line3f (V3f (-2e15f, 0, 0), V3f (2e15f, 0, 0)); + b = findEntryAndExitPoints (ray, box, r, s); +@@ -414,17 +414,18 @@ testRayBoxIntersection (const Box3f& box) + { + Rand48 random (2007); + +- float e = 50 * std::numeric_limits::epsilon(); ++ float e = 50 * std::numeric_limits::epsilon (); + +- if (box.isEmpty()) ++ if (box.isEmpty ()) + { + cout << " empty box, no rays intersect" << endl; + + 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 ( ++ 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 p2 (p1 + hollowSphereRand (random)); + +@@ -441,12 +442,20 @@ testRayBoxIntersection (const Box3f& box) + { + cout << " single-point box, ray intersects" << endl; + +- static const float off[6][3] = { { -1, 0, 0 }, { 1, 0, 0 }, { 0, -1, 0 }, +- { 0, 1, 0 }, { 0, 0, -1 }, { 0, 0, 1 } }; ++ static const float off[6][3] = { ++ {-1, 0, 0}, ++ {1, 0, 0}, ++ {0, -1, 0}, ++ {0, 1, 0}, ++ {0, 0, -1}, ++ {0, 0, 1}}; + + for (int i = 0; i < 6; ++i) + { +- V3f p1 (box.min.x + off[i][0], box.min.y + off[i][1], box.min.z + off[i][2]); ++ V3f p1 ( ++ box.min.x + off[i][0], ++ box.min.y + off[i][1], ++ box.min.z + off[i][2]); + + V3f ip; + assert (intersects (box, Line3f (p1, box.min), ip)); +@@ -465,8 +474,8 @@ testRayBoxIntersection (const Box3f& box) + const float r1 = 0.00001; + const float r2 = 1.0; + +- V3f p1 = box.min + r2 * hollowSphereRand (random); +- V3f p2; ++ V3f p1 = box.min + r2 * hollowSphereRand (random); ++ V3f p2; + float r3; + + do +@@ -476,13 +485,13 @@ testRayBoxIntersection (const Box3f& box) + p2 = box.min + r2 * hollowSphereRand (random); + } while (approximatelyEqual (p1, p2, e)); + +- V3f d1 = (p2 - p1).normalized(); ++ V3f d1 = (p2 - p1).normalized (); + V3f d2 = (box.min - p1); +- r3 = (d2 - d1 * (d1 ^ d2)).length(); ++ r3 = (d2 - d1 * (d1 ^ d2)).length (); + } while (r3 < r1); + + Line3f ray (p1, p2); +- V3f ip; ++ V3f ip; + + assert (!intersects (box, ray, ip)); + } +@@ -494,13 +503,14 @@ 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 ( ++ 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 p2 (p1 + hollowSphereRand (random)); + +- V3f ip; ++ V3f ip; + bool b = intersects (box, Line3f (p1, p2), ip); + + assert (b && ip == p1); +@@ -520,23 +530,25 @@ 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 ( ++ random.nextf (bigBox.min.x, bigBox.max.x), ++ random.nextf (bigBox.min.y, bigBox.max.y), ++ 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 ( ++ random.nextf (box.min.x, box.max.x), ++ random.nextf (box.min.y, box.max.y), ++ random.nextf (box.min.z, box.max.z)); + } while (approximatelyEqual (p1, p2, e)); + + Line3f ray (p1, p2); + +- V3f ip; ++ V3f ip; + bool b = intersects (box, ray, ip); + + // +@@ -546,8 +558,9 @@ testRayBoxIntersection (const Box3f& box) + + assert (b); + +- assert (ip.x == box.min.x || ip.x == box.max.x || ip.y == box.min.y || ip.y == box.max.y || +- ip.z == box.min.z || ip.z == box.max.z); ++ assert ( ++ ip.x == box.min.x || ip.x == box.max.x || ip.y == box.min.y || ++ ip.y == box.max.y || ip.z == box.min.z || ip.z == box.max.z); + + // + // Intersection point must be consistent with the origin +@@ -578,8 +591,8 @@ testRayBoxIntersection (const Box3f& box) + // are from the origin. + // + +- V3f p3 = p1 + ray.dir * (ray.dir ^ (ip - p1)); +- float m = 0; ++ V3f p3 = p1 + ray.dir * (ray.dir ^ (ip - p1)); ++ float m = 0; + + for (int j = 0; j < 3; ++j) + { +@@ -587,7 +600,7 @@ testRayBoxIntersection (const Box3f& box) + m = max (abs (ip[j]), m); + } + +- float err = 30 * m * std::numeric_limits::epsilon(); ++ float err = 30 * m * std::numeric_limits::epsilon (); + assert (p3.equalWithAbsError (ip, err)); + + // +@@ -602,9 +615,9 @@ testRayBoxIntersection (const Box3f& box) + + cout << " ray starts outside box, does not intersect" << endl; + +- V3f center = (box.min + box.max) * 0.5f; +- float r1 = (box.max - box.min).length() * 0.51f; +- float r2 = 2 * r1; ++ V3f center = (box.min + box.max) * 0.5f; ++ float r1 = (box.max - box.min).length () * 0.51f; ++ float r2 = 2 * r1; + + for (int i = 0; i < 100000; ++i) + { +@@ -616,8 +629,8 @@ testRayBoxIntersection (const Box3f& box) + // of the box.) + // + +- V3f p1 = center + r2 * hollowSphereRand (random); +- V3f p2; ++ V3f p1 = center + r2 * hollowSphereRand (random); ++ V3f p2; + float r3; + + do +@@ -627,47 +640,47 @@ testRayBoxIntersection (const Box3f& box) + p2 = center + r2 * hollowSphereRand (random); + } while (approximatelyEqual (p1, p2, e)); + +- V3f d1 = (p2 - p1).normalized(); ++ V3f d1 = (p2 - p1).normalized (); + V3f d2 = (center - p1); +- r3 = (d2 - d1 * (d1 ^ d2)).length(); ++ r3 = (d2 - d1 * (d1 ^ d2)).length (); + } while (r3 < r1); + + Line3f ray (p1, p2); +- V3f ip; ++ V3f ip; + + assert (!intersects (box, ray, ip)); + } + } + + void +-rayBoxIntersection1() ++rayBoxIntersection1 () + { + cout << " ray-box intersection, random rays" << endl; + +- Box3f boxes[] = { // Boxes with a positive volume ++ Box3f boxes[] = { ++ // Boxes with a positive volume + +- Box3f (V3f (-1, -1, -1), V3f (1, 1, 1)), +- Box3f (V3f (10, 20, 30), V3f (1010, 21, 31)), +- Box3f (V3f (10, 20, 30), V3f (11, 1020, 31)), +- Box3f (V3f (10, 20, 30), V3f (11, 21, 1030)), +- Box3f (V3f (-1e10f, -2e10f, -3e10f), V3f (5e15f, 6e15f, 7e15f)), ++ Box3f (V3f (-1, -1, -1), V3f (1, 1, 1)), ++ Box3f (V3f (10, 20, 30), V3f (1010, 21, 31)), ++ Box3f (V3f (10, 20, 30), V3f (11, 1020, 31)), ++ Box3f (V3f (10, 20, 30), V3f (11, 21, 1030)), ++ Box3f (V3f (-1e10f, -2e10f, -3e10f), V3f (5e15f, 6e15f, 7e15f)), + +- // Non-empty, zero-volume boxes ++ // Non-empty, zero-volume boxes + +- Box3f (V3f (1, 1, 1), V3f (2, 1, 1)), +- Box3f (V3f (1, 1, 1), V3f (1, 2, 1)), +- Box3f (V3f (1, 1, 1), V3f (1, 1, 2)), +- Box3f (V3f (1, 1, 1), V3f (1, 2, 3)), +- Box3f (V3f (1, 1, 1), V3f (2, 3, 1)), +- Box3f (V3f (1, 1, 1), V3f (2, 1, 3)), +- Box3f (V3f (-1, -2, 1), V3f (-1, -2, 1)), +- Box3f (V3f (1, 1, 1), V3f (1, 1, 1)), +- Box3f (V3f (0, 0, 0), V3f (0, 0, 0)), ++ Box3f (V3f (1, 1, 1), V3f (2, 1, 1)), ++ Box3f (V3f (1, 1, 1), V3f (1, 2, 1)), ++ Box3f (V3f (1, 1, 1), V3f (1, 1, 2)), ++ Box3f (V3f (1, 1, 1), V3f (1, 2, 3)), ++ Box3f (V3f (1, 1, 1), V3f (2, 3, 1)), ++ Box3f (V3f (1, 1, 1), V3f (2, 1, 3)), ++ Box3f (V3f (-1, -2, 1), V3f (-1, -2, 1)), ++ Box3f (V3f (1, 1, 1), V3f (1, 1, 1)), ++ Box3f (V3f (0, 0, 0), V3f (0, 0, 0)), + +- // empty box ++ // empty box + +- Box3f() +- }; ++ Box3f ()}; + + for (size_t i = 0; i < sizeof (boxes) / sizeof (boxes[0]); ++i) + testRayBoxIntersection (boxes[i]); +@@ -683,7 +696,7 @@ testPerturbedRayBox (const Box3f& box, const Line3f& ray, bool result) + assert (result == intersects (box, ray, ip)); + } + +- Rand48 random (19); ++ Rand48 random (19); + const float e = 1e-25f; + + for (int i = 0; i < 10000; ++i) +@@ -697,15 +710,15 @@ testPerturbedRayBox (const Box3f& box, const Line3f& ray, bool result) + } + + void +-rayBoxIntersection2() ++rayBoxIntersection2 () + { + + cout << " ray-box intersection, nearly axis-parallel rays" << endl; + +- Box3f box (V3f (-1e15f, -1e15f, -1e15f), V3f (1e15f, 1e15f, 1e15f)); ++ Box3f box (V3f (-1e15f, -1e15f, -1e15f), V3f (1e15f, 1e15f, 1e15f)); + Line3f ray; +- V3f ip; +- bool b; ++ V3f ip; ++ bool b; + + ray = Line3f (V3f (-2e15f, 0, 0), V3f (2e15f, 0, 0)); + b = intersects (box, ray, ip); +@@ -787,11 +800,11 @@ transformSimple (const Box3f& b, const M44f& M) + } + + void +-boxMatrixTransform() ++boxMatrixTransform () + { + cout << " transform box by matrix" << endl; + +- const float e = 5 * std::numeric_limits::epsilon(); ++ const float e = 5 * std::numeric_limits::epsilon (); + + Box3f b1 (V3f (4, 5, 6), V3f (7, 8, 9)); + +@@ -833,7 +846,7 @@ boxMatrixTransform() + } + + void +-pointInAndOnBox() ++pointInAndOnBox () + { + cout << " closest points in and on box" << endl; + +@@ -894,16 +907,16 @@ pointInAndOnBox() + } // namespace + + void +-testBoxAlgo() ++testBoxAlgo () + { + cout << "Testing box algorithms" << endl; + +- entryAndExitPoints1(); +- entryAndExitPoints2(); +- rayBoxIntersection1(); +- rayBoxIntersection2(); +- boxMatrixTransform(); +- pointInAndOnBox(); ++ entryAndExitPoints1 (); ++ entryAndExitPoints2 (); ++ rayBoxIntersection1 (); ++ rayBoxIntersection2 (); ++ boxMatrixTransform (); ++ pointInAndOnBox (); + + cout << "ok\n" << endl; + } +diff --git a/src/ImathTest/testBoxAlgo.h b/src/ImathTest/testBoxAlgo.h +index d6774de..e7acc0d 100644 +--- a/src/ImathTest/testBoxAlgo.h ++++ b/src/ImathTest/testBoxAlgo.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testBoxAlgo(); ++void testBoxAlgo (); +diff --git a/src/ImathTest/testClassification.cpp b/src/ImathTest/testClassification.cpp +index 69484b5..d87d691 100644 +--- a/src/ImathTest/testClassification.cpp ++++ b/src/ImathTest/testClassification.cpp +@@ -7,11 +7,11 @@ + # undef NDEBUG + #endif + +-#include ++#include "testClassification.h" + #include ++#include + #include + #include +-#include "testClassification.h" + + using namespace std; + +@@ -19,19 +19,21 @@ namespace + { + + #if __cplusplus >= 201402L +-static_assert (std::is_trivially_default_constructible::value, +- "half is trivial and default constructible"); ++static_assert ( ++ std::is_trivially_default_constructible::value, ++ "half is trivial and default constructible"); + #endif + + void +-testClass (half h, +- bool finite, +- bool normalized, +- bool denormalized, +- bool zero, +- bool nan, +- bool infinity, +- bool negative) ++testClass ( ++ half h, ++ bool finite, ++ bool normalized, ++ bool denormalized, ++ bool zero, ++ bool nan, ++ bool infinity, ++ bool negative) + { + cout.width (15); + cout.precision (8); +@@ -40,40 +42,33 @@ testClass (half h, + printBits (cout, h); + cout << " "; + +- if (h.isFinite()) +- cout << "finite "; ++ if (h.isFinite ()) cout << "finite "; + +- if (h.isNormalized()) +- cout << "normalized "; ++ if (h.isNormalized ()) cout << "normalized "; + +- if (h.isDenormalized()) +- cout << "denormalized "; ++ if (h.isDenormalized ()) cout << "denormalized "; + +- if (h.isZero()) +- cout << "zero "; ++ if (h.isZero ()) cout << "zero "; + +- if (h.isNan()) +- cout << "nan "; ++ if (h.isNan ()) cout << "nan "; + +- if (h.isInfinity()) +- cout << "infinity "; ++ if (h.isInfinity ()) cout << "infinity "; + +- if (h.isNegative()) +- cout << "negative "; ++ if (h.isNegative ()) cout << "negative "; + + cout << endl; + +- assert (h.isFinite() == finite); +- assert (h.isNormalized() == normalized); +- assert (h.isDenormalized() == denormalized); +- assert (h.isZero() == zero); +- assert (h.isNan() == nan); +- assert (h.isInfinity() == infinity); +- assert (h.isNegative() == negative); ++ assert (h.isFinite () == finite); ++ assert (h.isNormalized () == normalized); ++ assert (h.isDenormalized () == denormalized); ++ assert (h.isZero () == zero); ++ assert (h.isNan () == nan); ++ assert (h.isInfinity () == infinity); ++ assert (h.isNegative () == negative); + } + + float +-floatPosInfinity() ++floatPosInfinity () + { + half::uif x; + x.i = 0x7f800000; +@@ -81,7 +76,7 @@ floatPosInfinity() + } + + float +-floatNegInfinity() ++floatNegInfinity () + { + half::uif x; + x.i = 0xff800000; +@@ -89,7 +84,7 @@ floatNegInfinity() + } + + float +-floatPosQNan1() ++floatPosQNan1 () + { + half::uif x; + x.i = 0x7fffffff; +@@ -97,7 +92,7 @@ floatPosQNan1() + } + + float +-floatNegQNan1() ++floatNegQNan1 () + { + half::uif x; + x.i = 0xffffffff; +@@ -105,7 +100,7 @@ floatNegQNan1() + } + + float +-floatPosQNan2() ++floatPosQNan2 () + { + half::uif x; + x.i = 0x7fd55555; +@@ -113,7 +108,7 @@ floatPosQNan2() + } + + float +-floatNegQNan2() ++floatNegQNan2 () + { + half::uif x; + x.i = 0xffd55555; +@@ -123,7 +118,7 @@ floatNegQNan2() + } // namespace + + void +-testClassification() ++testClassification () + { + cout << "classification of bit patterns\n\n"; + +@@ -146,9 +141,9 @@ testClassification() + testClass (0.2f, 1, 1, 0, 0, 0, 0, 0); + testClass (0.3f, 1, 1, 0, 0, 0, 0, 0); + testClass (HALF_MAX, 1, 1, 0, 0, 0, 0, 0); +- testClass (floatPosInfinity(), 0, 0, 0, 0, 0, 1, 0); +- testClass (floatPosQNan1(), 0, 0, 0, 0, 1, 0, 0); +- testClass (floatPosQNan2(), 0, 0, 0, 0, 1, 0, 0); ++ testClass (floatPosInfinity (), 0, 0, 0, 0, 0, 1, 0); ++ testClass (floatPosQNan1 (), 0, 0, 0, 0, 1, 0, 0); ++ testClass (floatPosQNan2 (), 0, 0, 0, 0, 1, 0, 0); + + testClass (-1.0f, 1, 1, 0, 0, 0, 0, 1); + testClass (-1.0f - HALF_EPSILON, 1, 1, 0, 0, 0, 0, 1); +@@ -163,16 +158,16 @@ testClassification() + testClass (-0.2f, 1, 1, 0, 0, 0, 0, 1); + testClass (-0.3f, 1, 1, 0, 0, 0, 0, 1); + testClass (-HALF_MAX, 1, 1, 0, 0, 0, 0, 1); +- testClass (floatNegInfinity(), 0, 0, 0, 0, 0, 1, 1); +- testClass (floatNegQNan1(), 0, 0, 0, 0, 1, 0, 1); +- testClass (floatNegQNan2(), 0, 0, 0, 0, 1, 0, 1); ++ testClass (floatNegInfinity (), 0, 0, 0, 0, 0, 1, 1); ++ testClass (floatNegQNan1 (), 0, 0, 0, 0, 1, 0, 1); ++ testClass (floatNegQNan2 (), 0, 0, 0, 0, 1, 0, 1); + + cout << "\n"; + +- testClass (half::posInf(), 0, 0, 0, 0, 0, 1, 0); +- testClass (half::negInf(), 0, 0, 0, 0, 0, 1, 1); +- testClass (half::qNan(), 0, 0, 0, 0, 1, 0, 0); +- testClass (half::sNan(), 0, 0, 0, 0, 1, 0, 0); ++ testClass (half::posInf (), 0, 0, 0, 0, 0, 1, 0); ++ testClass (half::negInf (), 0, 0, 0, 0, 0, 1, 1); ++ testClass (half::qNan (), 0, 0, 0, 0, 1, 0, 0); ++ testClass (half::sNan (), 0, 0, 0, 0, 1, 0, 0); + + cout << "ok\n\n" << flush; + } +diff --git a/src/ImathTest/testClassification.h b/src/ImathTest/testClassification.h +index 8aa3290..8ece4bb 100644 +--- a/src/ImathTest/testClassification.h ++++ b/src/ImathTest/testClassification.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testClassification(); ++void testClassification (); +diff --git a/src/ImathTest/testColor.cpp b/src/ImathTest/testColor.cpp +index accf23b..bf2c072 100644 +--- a/src/ImathTest/testColor.cpp ++++ b/src/ImathTest/testColor.cpp +@@ -7,12 +7,12 @@ + # undef NDEBUG + #endif + ++#include "testColor.h" + #include + #include + #include + #include + #include +-#include "testColor.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -20,17 +20,17 @@ + using namespace std; + + void +-testColor() ++testColor () + { + cout << "Testing functions in ImathColor.h & ImathColorAlgo.h" << endl; + + cout << "rgb2packed -> packed2rgb" << endl; + +- const float epsilon = std::numeric_limits::epsilon(); ++ const float epsilon = std::numeric_limits::epsilon (); + + IMATH_INTERNAL_NAMESPACE::PackedColor packed; +- IMATH_INTERNAL_NAMESPACE::C3c in3 (52, 128, 254); +- IMATH_INTERNAL_NAMESPACE::C3c out3; ++ IMATH_INTERNAL_NAMESPACE::C3c in3 (52, 128, 254); ++ IMATH_INTERNAL_NAMESPACE::C3c out3; + + packed = IMATH_INTERNAL_NAMESPACE::rgb2packed (in3); + IMATH_INTERNAL_NAMESPACE::packed2rgb (packed, out3); +@@ -41,7 +41,8 @@ testColor() + IMATH_INTERNAL_NAMESPACE::C4c testConstructor1i (0.f); + IMATH_INTERNAL_NAMESPACE::C4c testConstructor2 (testConstructor1i); + +- testConstructor1 = testConstructor2; // use these so the compiler doesn't emit a warning ++ testConstructor1 = ++ testConstructor2; // use these so the compiler doesn't emit a warning + + IMATH_INTERNAL_NAMESPACE::C4c testConstructor3 (52, 128, 254, 127); + IMATH_INTERNAL_NAMESPACE::C4c A (testConstructor3); +@@ -55,19 +56,25 @@ testColor() + + cout << "Imath::Color4 * f" << endl; + +- assert ((IMATH_INTERNAL_NAMESPACE::C4f (0.330f, 0.710f, 0.010f, 0.999f) * 0.999f) == +- IMATH_INTERNAL_NAMESPACE::C4f (0.330f * 0.999f, +- 0.710f * 0.999f, +- 0.010f * 0.999f, +- 0.999f * 0.999f)); ++ assert ( ++ (IMATH_INTERNAL_NAMESPACE::C4f (0.330f, 0.710f, 0.010f, 0.999f) * ++ 0.999f) == ++ IMATH_INTERNAL_NAMESPACE::C4f ( ++ 0.330f * 0.999f, ++ 0.710f * 0.999f, ++ 0.010f * 0.999f, ++ 0.999f * 0.999f)); + + cout << "Imath::Color4 / f" << endl; + +- assert ((IMATH_INTERNAL_NAMESPACE::C4f (0.330f, 0.710f, 0.010f, 0.999f) / 0.999f) == +- IMATH_INTERNAL_NAMESPACE::C4f (0.330f / 0.999f, +- 0.710f / 0.999f, +- 0.010f / 0.999f, +- 0.999f / 0.999f)); ++ assert ( ++ (IMATH_INTERNAL_NAMESPACE::C4f (0.330f, 0.710f, 0.010f, 0.999f) / ++ 0.999f) == ++ IMATH_INTERNAL_NAMESPACE::C4f ( ++ 0.330f / 0.999f, ++ 0.710f / 0.999f, ++ 0.010f / 0.999f, ++ 0.999f / 0.999f)); + + cout << "Assignment and comparison" << endl; + +@@ -79,77 +86,86 @@ testColor() + + X *= 0.001f; + +- assert (std::fabs ((Y.r * 0.001f) - X.r) <= epsilon && +- std::fabs ((Y.g * 0.001f) - X.g) <= epsilon && +- std::fabs ((Y.b * 0.001f) - X.b) <= epsilon && +- std::fabs ((Y.a * 0.001f) - X.a) <= epsilon); ++ assert ( ++ std::fabs ((Y.r * 0.001f) - X.r) <= epsilon && ++ std::fabs ((Y.g * 0.001f) - X.g) <= epsilon && ++ std::fabs ((Y.b * 0.001f) - X.b) <= epsilon && ++ std::fabs ((Y.a * 0.001f) - X.a) <= epsilon); + + X = Y = IMATH_INTERNAL_NAMESPACE::C4f (0.123f, -0.420f, 0.501f, 0.998f); + + X /= -1.001f; + +- assert (std::fabs ((Y.r / -1.001f) - X.r) <= epsilon && +- std::fabs ((Y.g / -1.001f) - X.g) <= epsilon && +- std::fabs ((Y.b / -1.001f) - X.b) <= epsilon && +- std::fabs ((Y.a / -1.001f) - X.a) <= epsilon); ++ assert ( ++ std::fabs ((Y.r / -1.001f) - X.r) <= epsilon && ++ std::fabs ((Y.g / -1.001f) - X.g) <= epsilon && ++ std::fabs ((Y.b / -1.001f) - X.b) <= epsilon && ++ std::fabs ((Y.a / -1.001f) - X.a) <= epsilon); + + Y = IMATH_INTERNAL_NAMESPACE::C4f (0.998f, -0.001f, 0.501f, 1.001f); + X = IMATH_INTERNAL_NAMESPACE::C4f (0.011f, -0.420f, -0.501f, 0.998f); + + tmp = X + Y; + +- assert (std::fabs ((X.r + Y.r) - tmp.r) <= epsilon && +- std::fabs ((X.g + Y.g) - tmp.g) <= epsilon && +- std::fabs ((X.b + Y.b) - tmp.b) <= epsilon && +- std::fabs ((X.a + Y.a) - tmp.a) <= epsilon); ++ assert ( ++ std::fabs ((X.r + Y.r) - tmp.r) <= epsilon && ++ std::fabs ((X.g + Y.g) - tmp.g) <= epsilon && ++ std::fabs ((X.b + Y.b) - tmp.b) <= epsilon && ++ std::fabs ((X.a + Y.a) - tmp.a) <= epsilon); + + tmp = X - Y; + +- assert (std::fabs ((X.r - Y.r) - tmp.r) <= epsilon && +- std::fabs ((X.g - Y.g) - tmp.g) <= epsilon && +- std::fabs ((X.b - Y.b) - tmp.b) <= epsilon && +- std::fabs ((X.a - Y.a) - tmp.a) <= epsilon); ++ assert ( ++ std::fabs ((X.r - Y.r) - tmp.r) <= epsilon && ++ std::fabs ((X.g - Y.g) - tmp.g) <= epsilon && ++ std::fabs ((X.b - Y.b) - tmp.b) <= epsilon && ++ std::fabs ((X.a - Y.a) - tmp.a) <= epsilon); + + tmp = X * Y; + +- assert (std::fabs ((X.r * Y.r) - tmp.r) <= epsilon && +- std::fabs ((X.g * Y.g) - tmp.g) <= epsilon && +- std::fabs ((X.b * Y.b) - tmp.b) <= epsilon && +- std::fabs ((X.a * Y.a) - tmp.a) <= epsilon); ++ assert ( ++ std::fabs ((X.r * Y.r) - tmp.r) <= epsilon && ++ std::fabs ((X.g * Y.g) - tmp.g) <= epsilon && ++ std::fabs ((X.b * Y.b) - tmp.b) <= epsilon && ++ std::fabs ((X.a * Y.a) - tmp.a) <= epsilon); + + tmp = X / Y; + + // + // epsilon doesn't work here. + // +- assert (std::fabs ((X.r / Y.r) - tmp.r) <= 1e-5f && +- std::fabs ((X.g / Y.g) - tmp.g) <= 1e-5f && +- std::fabs ((X.b / Y.b) - tmp.b) <= 1e-5f && +- std::fabs ((X.a / Y.a) - tmp.a) <= 1e-5f); ++ assert ( ++ std::fabs ((X.r / Y.r) - tmp.r) <= 1e-5f && ++ std::fabs ((X.g / Y.g) - tmp.g) <= 1e-5f && ++ std::fabs ((X.b / Y.b) - tmp.b) <= 1e-5f && ++ std::fabs ((X.a / Y.a) - tmp.a) <= 1e-5f); + + tmp = X; + tmp += Y; + +- assert (std::fabs ((X.r + Y.r) - tmp.r) <= epsilon && +- std::fabs ((X.g + Y.g) - tmp.g) <= epsilon && +- std::fabs ((X.b + Y.b) - tmp.b) <= epsilon && +- std::fabs ((X.a + Y.a) - tmp.a) <= epsilon); ++ assert ( ++ std::fabs ((X.r + Y.r) - tmp.r) <= epsilon && ++ std::fabs ((X.g + Y.g) - tmp.g) <= epsilon && ++ std::fabs ((X.b + Y.b) - tmp.b) <= epsilon && ++ std::fabs ((X.a + Y.a) - tmp.a) <= epsilon); + + tmp = X; + tmp -= Y; + +- assert (std::fabs ((X.r - Y.r) - tmp.r) <= epsilon && +- std::fabs ((X.g - Y.g) - tmp.g) <= epsilon && +- std::fabs ((X.b - Y.b) - tmp.b) <= epsilon && +- std::fabs ((X.a - Y.a) - tmp.a) <= epsilon); ++ assert ( ++ std::fabs ((X.r - Y.r) - tmp.r) <= epsilon && ++ std::fabs ((X.g - Y.g) - tmp.g) <= epsilon && ++ std::fabs ((X.b - Y.b) - tmp.b) <= epsilon && ++ std::fabs ((X.a - Y.a) - tmp.a) <= epsilon); + + tmp = X; + tmp *= Y; + +- assert (std::fabs ((X.r * Y.r) - tmp.r) <= epsilon && +- std::fabs ((X.g * Y.g) - tmp.g) <= epsilon && +- std::fabs ((X.b * Y.b) - tmp.b) <= epsilon && +- std::fabs ((X.a * Y.a) - tmp.a) <= epsilon); ++ assert ( ++ std::fabs ((X.r * Y.r) - tmp.r) <= epsilon && ++ std::fabs ((X.g * Y.g) - tmp.g) <= epsilon && ++ std::fabs ((X.b * Y.b) - tmp.b) <= epsilon && ++ std::fabs ((X.a * Y.a) - tmp.a) <= epsilon); + + tmp = X; + tmp /= Y; +@@ -157,10 +173,11 @@ testColor() + // + // epsilon doesn't work here. + // +- assert (std::fabs ((X.r / Y.r) - tmp.r) <= 1e-5f && +- std::fabs ((X.g / Y.g) - tmp.g) <= 1e-5f && +- std::fabs ((X.b / Y.b) - tmp.b) <= 1e-5f && +- std::fabs ((X.a / Y.a) - tmp.a) <= 1e-5f); ++ assert ( ++ std::fabs ((X.r / Y.r) - tmp.r) <= 1e-5f && ++ std::fabs ((X.g / Y.g) - tmp.g) <= 1e-5f && ++ std::fabs ((X.b / Y.b) - tmp.b) <= 1e-5f && ++ std::fabs ((X.a / Y.a) - tmp.a) <= 1e-5f); + + cout << "ok\n" << endl; + } +diff --git a/src/ImathTest/testColor.h b/src/ImathTest/testColor.h +index 23a0d0d..d61fde3 100644 +--- a/src/ImathTest/testColor.h ++++ b/src/ImathTest/testColor.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testColor(); ++void testColor (); +diff --git a/src/ImathTest/testError.cpp b/src/ImathTest/testError.cpp +index 33e599c..f1a806e 100644 +--- a/src/ImathTest/testError.cpp ++++ b/src/ImathTest/testError.cpp +@@ -7,12 +7,12 @@ + # undef NDEBUG + #endif + ++#include "testError.h" + #include "half.h" + #include + #include + #include + #include +-#include "testError.h" + + using namespace std; + +@@ -20,18 +20,18 @@ namespace + { + + float +-drand() ++drand () + { +- static std::default_random_engine generator; ++ static std::default_random_engine generator; + static std::uniform_real_distribution distribution (0.0f, 1.0f); +- float r = distribution (generator); ++ float r = distribution (generator); + return r; + } + + } // namespace + + void +-testNormalizedConversionError() ++testNormalizedConversionError () + { + cout << "float-to-half conversion error for normalized half numbers\n"; + +@@ -39,29 +39,26 @@ testNormalizedConversionError() + + for (int i = 0; i < 20000000; i++) + { +- float f (drand() * HALF_MAX); ++ float f (drand () * HALF_MAX); + +- if (f < HALF_NRM_MIN) +- continue; ++ if (f < HALF_NRM_MIN) continue; + +- if (i & 1) +- f = -f; ++ if (i & 1) f = -f; + +- half h (f); ++ half h (f); + float e = 1.0f - h / f; + +- if (e < 0) +- e = -e; ++ if (e < 0) e = -e; + + if (e > HALF_EPSILON * 0.5) + { +- cout << "float = " << f << ", half = " << h << ", error = " << e << endl; ++ cout << "float = " << f << ", half = " << h << ", error = " << e ++ << endl; + + assert (false); + } + +- if (e > eMax) +- eMax = e; ++ if (e > eMax) eMax = e; + } + + cout << "max error = " << eMax << endl; +@@ -70,7 +67,7 @@ testNormalizedConversionError() + } + + void +-testDenormalizedConversionError() ++testDenormalizedConversionError () + { + cout << "float-to-half conversion error for denormalized half numbers\n"; + +@@ -78,26 +75,24 @@ testDenormalizedConversionError() + + for (int i = 0; i < 20000000; i++) + { +- float f (drand() * (HALF_NRM_MIN - HALF_DENORM_MIN)); ++ float f (drand () * (HALF_NRM_MIN - HALF_DENORM_MIN)); + +- if (i & 1) +- f = -f; ++ if (i & 1) f = -f; + +- half h (f); ++ half h (f); + float e = h - f; + +- if (e < 0) +- e = -e; ++ if (e < 0) e = -e; + + if (e > HALF_DENORM_MIN * 0.5) + { +- cout << "float = " << f << ", half = " << h << ", error = " << e << endl; ++ cout << "float = " << f << ", half = " << h << ", error = " << e ++ << endl; + + assert (false); + } + +- if (e > eMax) +- eMax = e; ++ if (e > eMax) eMax = e; + } + + cout << "max error = " << eMax << endl; +@@ -118,19 +113,16 @@ testNormalizedRounding (int n) + + for (int i = 0; i < 200000; i++) + { +- half h (drand() * HALF_MAX); ++ half h (drand () * HALF_MAX); + +- if (h < HALF_NRM_MIN) +- continue; ++ if (h < HALF_NRM_MIN) continue; + +- if (i & 1) +- h = -h; ++ if (i & 1) h = -h; + +- half r (h.round (n)); ++ half r (h.round (n)); + float e = 1.0f - r / h; + +- if (e < 0) +- e = -e; ++ if (e < 0) e = -e; + + if (e > eExpected) + { +@@ -145,8 +137,7 @@ testNormalizedRounding (int n) + assert (false); + } + +- if (e > eMax) +- eMax = e; ++ if (e > eMax) eMax = e; + } + + cout << "max error = " << eMax << endl; +@@ -164,16 +155,14 @@ testDenormalizedRounding (int n) + + for (int i = 0; i < 200000; i++) + { +- half h (drand() * (HALF_NRM_MIN - HALF_DENORM_MIN)); ++ half h (drand () * (HALF_NRM_MIN - HALF_DENORM_MIN)); + +- if (i & 1) +- h = -h; ++ if (i & 1) h = -h; + +- half r (h.round (n)); ++ half r (h.round (n)); + float e = r - h; + +- if (e < 0) +- e = -e; ++ if (e < 0) e = -e; + + if (e > eExpected) + { +@@ -188,8 +177,7 @@ testDenormalizedRounding (int n) + assert (false); + } + +- if (e > eMax) +- eMax = e; ++ if (e > eMax) eMax = e; + } + + cout << "max error = " << eMax << endl; +@@ -200,7 +188,7 @@ testDenormalizedRounding (int n) + } // namespace + + void +-testRoundingError() ++testRoundingError () + { + testNormalizedRounding (10); + testDenormalizedRounding (10); +diff --git a/src/ImathTest/testError.h b/src/ImathTest/testError.h +index 675c8a9..a4912f0 100644 +--- a/src/ImathTest/testError.h ++++ b/src/ImathTest/testError.h +@@ -3,6 +3,6 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testNormalizedConversionError(); +-void testDenormalizedConversionError(); +-void testRoundingError(); ++void testNormalizedConversionError (); ++void testDenormalizedConversionError (); ++void testRoundingError (); +diff --git a/src/ImathTest/testExtractEuler.cpp b/src/ImathTest/testExtractEuler.cpp +index 7b52a4c..a3826a3 100644 +--- a/src/ImathTest/testExtractEuler.cpp ++++ b/src/ImathTest/testExtractEuler.cpp +@@ -7,13 +7,13 @@ + # undef NDEBUG + #endif + ++#include "testExtractEuler.h" + #include + #include + #include + #include + #include + #include +-#include "testExtractEuler.h" + + using namespace std; + using namespace IMATH_INTERNAL_NAMESPACE; +@@ -37,7 +37,7 @@ matrixEulerMatrix_1 (const M44f& M, Eulerf::Order order) + else + extractEulerZYX (M, f); + +- return Eulerf (f, order).toMatrix44(); ++ return Eulerf (f, order).toMatrix44 (); + } + + M44f +@@ -45,13 +45,14 @@ matrixEulerMatrix_2 (const M44f& M, Eulerf::Order order) + { + Eulerf f (order); + f.extract (M); +- return f.toMatrix44(); ++ return f.toMatrix44 (); + } + + void +-testMatrix (const M44f M, +- M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), +- Eulerf::Order order) ++testMatrix ( ++ const M44f M, ++ M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), ++ Eulerf::Order order) + { + // + // Extract Euler angles from M, and convert the +@@ -90,7 +91,8 @@ testMatrix (const M44f M, + } + + void +-testRandomAngles (M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf::Order order) ++testRandomAngles ( ++ M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf::Order order) + { + Rand48 r (0); + +@@ -100,12 +102,13 @@ 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 (r.nextf (-180, 180)), ++ rad (r.nextf (-180, 180)), ++ rad (r.nextf (-180, 180)), ++ Eulerf::XYZ); + +- M44f M (e.toMatrix44()); ++ M44f M (e.toMatrix44 ()); + + // + // Add a small random error to the elements of M +@@ -126,11 +129,14 @@ testRandomAngles (M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf + } + + void +-testAngles (V3f angles, M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf::Order order) ++testAngles ( ++ V3f angles, ++ M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), ++ Eulerf::Order order) + { + Eulerf e (rad (angles.x), rad (angles.y), rad (angles.z), order); + +- M44f M (e.toMatrix44()); ++ M44f M (e.toMatrix44 ()); + + // + // With rounding errors from e.toMatrix. +@@ -156,7 +162,8 @@ testAngles (V3f angles, M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), + } + + void +-test (M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf::Order order) ++test ( ++ M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf::Order order) + { + cout << "order = " << setbase (16) << int (order) << setbase (10) << endl; + +@@ -173,11 +180,11 @@ test (M44f (*matrixEulerMatrix) (const M44f&, Eulerf::Order), Eulerf::Order orde + } + + void +-testRandomAngles33() ++testRandomAngles33 () + { + Rand48 r (0); + +- float eps = 8.0 * std::numeric_limits::epsilon(); ++ float eps = 8.0 * std::numeric_limits::epsilon (); + + for (int i = 0; i < 100000; ++i) + { +@@ -196,10 +203,10 @@ testRandomAngles33() + } // namespace + + void +-testExtractEuler() ++testExtractEuler () + { + cout << "Testing extraction of rotation angle from 3x3 matrices" << endl; +- testRandomAngles33(); ++ testRandomAngles33 (); + + cout << "Testing extraction of Euler angles from matrices" << endl; + +diff --git a/src/ImathTest/testExtractEuler.h b/src/ImathTest/testExtractEuler.h +index cb8840d..030dbcf 100644 +--- a/src/ImathTest/testExtractEuler.h ++++ b/src/ImathTest/testExtractEuler.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testExtractEuler(); ++void testExtractEuler (); +diff --git a/src/ImathTest/testExtractSHRT.cpp b/src/ImathTest/testExtractSHRT.cpp +index 35d95aa..0b0a985 100644 +--- a/src/ImathTest/testExtractSHRT.cpp ++++ b/src/ImathTest/testExtractSHRT.cpp +@@ -7,6 +7,7 @@ + # undef NDEBUG + #endif + ++#include "testExtractSHRT.h" + #include + #include + #include +@@ -15,7 +16,6 @@ + #include + #include + #include +-#include "testExtractSHRT.h" + + #if 0 + # define debug(x) (printf x, fflush (stdout)) +@@ -43,7 +43,7 @@ testMatrix (const M33f M) + // angle back to a matrix, N. + // + +- V2f s (0.f), t (0.f); ++ V2f s (0.f), t (0.f); + float h, r = 0.f; + + if (!extractSHRT (M, s, h, r, t, true)) +@@ -54,10 +54,10 @@ testMatrix (const M33f M) + + M33f N; + +- N *= M33f().setScale (s); +- N *= M33f().setShear (h); +- N *= M33f().setRotation (r); +- N *= M33f().setTranslation (t); ++ N *= M33f ().setScale (s); ++ N *= M33f ().setShear (h); ++ N *= M33f ().setRotation (r); ++ N *= M33f ().setTranslation (t); + + debug (("Re-scale: %f %f\n", s[0], s[1])); + debug (("Re-shear: %f\n", h)); +@@ -94,7 +94,7 @@ testMatrix (const M33f M) + } + + void +-testRandomAngles33() ++testRandomAngles33 () + { + Rand48 random (0); + +@@ -111,20 +111,18 @@ testRandomAngles33() + V2f s (random.nextf (0.000001, 2.0), random.nextf (0.000001, 2.0)); + + for (int j = 0; j < 2; j++) +- if (random.nextf (0.0, 1.0) >= 0.5) +- s[j] *= -1; ++ if (random.nextf (0.0, 1.0) >= 0.5) s[j] *= -1; + +- M *= M33f().setScale (s); ++ M *= M33f ().setScale (s); + + // + // Shear M. + // + + float h = random.nextf (0.000001, 2.); +- if (random.nextf (0.0, 1.0) >= 0.5) +- h *= -1; ++ if (random.nextf (0.0, 1.0) >= 0.5) h *= -1; + +- M *= M33f().setShear (h); ++ M *= M33f ().setShear (h); + + // + // Rotate M. +@@ -132,7 +130,7 @@ testRandomAngles33() + + float r = rad (random.nextf (-180, 180)); + +- M *= M33f().setRotation (r); ++ M *= M33f ().setRotation (r); + + // + // Translate M. +@@ -140,7 +138,7 @@ testRandomAngles33() + + V2f t (random.nextf (-10, 10), random.nextf (-10, 10)); + +- M *= M33f().setTranslation (t); ++ M *= M33f ().setTranslation (t); + + // + // Add a small random error to the elements of M +@@ -250,7 +248,7 @@ testMatrix (const M44f M) + } + + void +-testRandomAngles44() ++testRandomAngles44 () + { + Rand48 random (0); + +@@ -264,7 +262,10 @@ testRandomAngles44() + // Translate M. + // + +- V3f t (random.nextf (-10, 10), random.nextf (-10, 10), random.nextf (-10, 10)); ++ V3f t ( ++ random.nextf (-10, 10), ++ random.nextf (-10, 10), ++ random.nextf (-10, 10)); + + M.translate (t); + +@@ -272,9 +273,10 @@ testRandomAngles44() + // Rotate M. + // + +- V3f r (rad (random.nextf (-180, 180)), +- rad (random.nextf (-180, 180)), +- rad (random.nextf (-180, 180))); ++ V3f r ( ++ rad (random.nextf (-180, 180)), ++ rad (random.nextf (-180, 180)), ++ rad (random.nextf (-180, 180))); + + M.rotate (r); + +@@ -282,13 +284,13 @@ 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 ( ++ random.nextf (0.000001, 2.0), ++ random.nextf (0.000001, 2.0), ++ random.nextf (0.000001, 2.0)); + + for (int j = 0; j < 3; j++) +- if (random.nextf (0.0, 1.0) >= 0.5) +- h[j] *= -1; ++ if (random.nextf (0.0, 1.0) >= 0.5) h[j] *= -1; + + M.shear (h); + +@@ -296,13 +298,13 @@ 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 ( ++ random.nextf (0.000001, 2.0), ++ random.nextf (0.000001, 2.0), ++ 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; ++ if (random.nextf (0.0, 1.0) >= 0.5) s[j] *= -1; + + M.scale (s); + +@@ -336,7 +338,7 @@ testAngles44 (V3f angles) + { + Eulerf e (rad (angles.x), rad (angles.y), rad (angles.z)); + +- M44f M (e.toMatrix44()); ++ M44f M (e.toMatrix44 ()); + + // + // With rounding errors from e.toMatrix. +@@ -362,15 +364,15 @@ testAngles44 (V3f angles) + } + + void +-test() ++test () + { + cout << " random angles" << endl; + + cout << " 3x3" << endl; +- testRandomAngles33(); ++ testRandomAngles33 (); + + cout << " 4x4" << endl; +- testRandomAngles44(); ++ testRandomAngles44 (); + + cout << " special angles" << endl; + +@@ -388,7 +390,7 @@ test() + } // namespace + + void +-testExtractSHRT() ++testExtractSHRT () + { + try + { +@@ -396,12 +398,12 @@ testExtractSHRT() + << "from matrices" << endl; + + cout << "Imath::extractSHRT()" << endl; +- test(); ++ test (); + + cout << "ok\n" << endl; + } + catch (std::exception& e) + { +- cerr << " Caught exception: " << e.what() << endl; ++ cerr << " Caught exception: " << e.what () << endl; + } + } +diff --git a/src/ImathTest/testExtractSHRT.h b/src/ImathTest/testExtractSHRT.h +index ab5022f..1987399 100644 +--- a/src/ImathTest/testExtractSHRT.h ++++ b/src/ImathTest/testExtractSHRT.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testExtractSHRT(); ++void testExtractSHRT (); +diff --git a/src/ImathTest/testFrustum.cpp b/src/ImathTest/testFrustum.cpp +index c6d3980..70d8826 100644 +--- a/src/ImathTest/testFrustum.cpp ++++ b/src/ImathTest/testFrustum.cpp +@@ -7,13 +7,13 @@ + # undef NDEBUG + #endif + ++#include "testFrustum.h" + #include + #include + #include + #include + #include + #include +-#include "testFrustum.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -26,29 +26,42 @@ namespace + void + testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf& frustum) + { +- bool ortho = frustum.orthographic(); ++ bool ortho = frustum.orthographic (); + IMATH_INTERNAL_NAMESPACE::V3f o (0.0f, 0.0f, 0.0f); +- float eps = 5.0e-4; ++ float eps = 5.0e-4; + +- for (auto xRo : { 0.0f, 100.0f, 200.0f }) ++ for (auto xRo: {0.0f, 100.0f, 200.0f}) + { +- for (auto yRo : { 0.0f, 105.0f, 210.0f, 315.0f }) ++ for (auto yRo: {0.0f, 105.0f, 210.0f, 315.0f}) + { +- for (auto zRo : { 0.0f, 110.0f, 220.0f, 330.0f }) ++ for (auto zRo: {0.0f, 110.0f, 220.0f, 330.0f}) + { +- for (auto xTr : +- { -10.0f, -8.0f, -6.0f, -4.0f, -2.0f, 0.0f, 2.0f, 4.0f, 6.0f, 8.0f }) ++ for (auto xTr: ++ {-10.0f, ++ -8.0f, ++ -6.0f, ++ -4.0f, ++ -2.0f, ++ 0.0f, ++ 2.0f, ++ 4.0f, ++ 6.0f, ++ 8.0f}) + { +- for (auto yTr : { -10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f }) ++ for (auto yTr: ++ {-10.0f, -7.0f, -4.0f, -1.0f, 2.0f, 5.0f, 8.0f}) + { +- for (auto zTr : { -10.0f, -6.0f, -2.0f, 2.0f, 6.0f }) ++ for (auto zTr: {-10.0f, -6.0f, -2.0f, 2.0f, 6.0f}) + { + float xRoRad = xRo * (2.0f * float (M_PI) / 360.0f); + float yRoRad = yRo * (2.0f * float (M_PI) / 360.0f); + float zRoRad = zRo * (2.0f * float (M_PI) / 360.0f); +- IMATH_INTERNAL_NAMESPACE::Eulerf e (xRoRad, yRoRad, zRoRad); +- IMATH_INTERNAL_NAMESPACE::M44f mView = e.toMatrix44(); +- mView.translate (IMATH_INTERNAL_NAMESPACE::V3f (xTr, yTr, zTr)); ++ IMATH_INTERNAL_NAMESPACE::Eulerf e ( ++ xRoRad, yRoRad, zRoRad); ++ IMATH_INTERNAL_NAMESPACE::M44f mView = ++ e.toMatrix44 (); ++ mView.translate ( ++ IMATH_INTERNAL_NAMESPACE::V3f (xTr, yTr, zTr)); + + IMATH_INTERNAL_NAMESPACE::Plane3f planes0[6]; + frustum.planes (planes0); +@@ -63,9 +76,9 @@ testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf& frustum) + assert ((up ^ planes[0].normal) > 0.0); + + IMATH_INTERNAL_NAMESPACE::V3f pt = +- (!ortho) +- ? o +- : IMATH_INTERNAL_NAMESPACE::V3f (0.0f, frustum.top(), 0.0f); ++ (!ortho) ? o ++ : IMATH_INTERNAL_NAMESPACE::V3f ( ++ 0.0f, frustum.top (), 0.0f); + float d = planes0[0].distanceTo (pt); + assert (IMATH_INTERNAL_NAMESPACE::iszero (d, eps)); + pt = pt * mView; +@@ -78,10 +91,10 @@ testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf& frustum) + mView.multDirMatrix (right, right); + assert ((right ^ planes[1].normal) > 0.0); + +- pt = (!ortho) +- ? o +- : IMATH_INTERNAL_NAMESPACE::V3f (frustum.right(), 0.0f, 0.0f); +- d = planes0[1].distanceTo (pt); ++ pt = (!ortho) ? o ++ : IMATH_INTERNAL_NAMESPACE::V3f ( ++ frustum.right (), 0.0f, 0.0f); ++ d = planes0[1].distanceTo (pt); + assert (IMATH_INTERNAL_NAMESPACE::iszero (d, eps)); + pt = pt * mView; + d = planes[1].distanceTo (pt); +@@ -93,10 +106,10 @@ testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf& frustum) + mView.multDirMatrix (down, down); + assert ((down ^ planes[2].normal) > 0.0); + +- pt = (!ortho) +- ? o +- : IMATH_INTERNAL_NAMESPACE::V3f (0.0f, frustum.bottom(), 0.0f); +- d = planes0[2].distanceTo (pt); ++ pt = (!ortho) ? o ++ : IMATH_INTERNAL_NAMESPACE::V3f ( ++ 0.0f, frustum.bottom (), 0.0f); ++ d = planes0[2].distanceTo (pt); + assert (IMATH_INTERNAL_NAMESPACE::iszero (d, eps)); + pt = pt * mView; + d = planes[2].distanceTo (pt); +@@ -108,10 +121,10 @@ testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf& frustum) + mView.multDirMatrix (left, left); + assert ((left ^ planes[3].normal) > 0.0); + +- pt = (!ortho) +- ? o +- : IMATH_INTERNAL_NAMESPACE::V3f (frustum.left(), 0.0f, 0.0f); +- d = planes0[3].distanceTo (pt); ++ pt = (!ortho) ? o ++ : IMATH_INTERNAL_NAMESPACE::V3f ( ++ frustum.left (), 0.0f, 0.0f); ++ d = planes0[3].distanceTo (pt); + assert (IMATH_INTERNAL_NAMESPACE::iszero (d, eps)); + pt = pt * mView; + d = planes[3].distanceTo (pt); +@@ -123,8 +136,9 @@ testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf& frustum) + mView.multDirMatrix (front, front); + assert ((front ^ planes[4].normal) > 0.0); + +- pt = IMATH_INTERNAL_NAMESPACE::V3f (0.0f, 0.0f, -frustum.nearPlane()); +- d = planes0[4].distanceTo (pt); ++ pt = IMATH_INTERNAL_NAMESPACE::V3f ( ++ 0.0f, 0.0f, -frustum.nearPlane ()); ++ d = planes0[4].distanceTo (pt); + assert (IMATH_INTERNAL_NAMESPACE::iszero (d, eps)); + pt = pt * mView; + d = planes[4].distanceTo (pt); +@@ -136,8 +150,9 @@ testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf& frustum) + mView.multDirMatrix (back, back); + assert ((back ^ planes[5].normal) > 0.0); + +- pt = IMATH_INTERNAL_NAMESPACE::V3f (0.0f, 0.0f, -frustum.farPlane()); +- d = planes0[5].distanceTo (pt); ++ pt = IMATH_INTERNAL_NAMESPACE::V3f ( ++ 0.0f, 0.0f, -frustum.farPlane ()); ++ d = planes0[5].distanceTo (pt); + assert (IMATH_INTERNAL_NAMESPACE::iszero (d, eps)); + pt = pt * mView; + d = planes[5].distanceTo (pt); +@@ -153,7 +168,7 @@ testFrustumPlanes (IMATH_INTERNAL_NAMESPACE::Frustumf& frustum) + } // namespace + + void +-testFrustum() ++testFrustum () + { + cout << "Testing functions in ImathFrustum.h"; + +@@ -168,50 +183,69 @@ testFrustum() + + IMATH_INTERNAL_NAMESPACE::Frustum frustum (n, f, l, r, t, b, false); + +- assert (IMATH_INTERNAL_NAMESPACE::abs (frustum.fovx() - (atan2 (r, n) - atan2 (l, n))) < +- 1e-6); +- assert (IMATH_INTERNAL_NAMESPACE::abs (frustum.fovy() - (atan2 (t, n) - atan2 (b, n))) < +- 1e-6); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::abs ( ++ frustum.fovx () - (atan2 (r, n) - atan2 (l, n))) < 1e-6); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::abs ( ++ frustum.fovy () - (atan2 (t, n) - atan2 (b, n))) < 1e-6); + cout << "1"; +- assert (IMATH_INTERNAL_NAMESPACE::abs (frustum.aspectExc() - ((r - l) / (t - b))) < 1e-6); +- assert (IMATH_INTERNAL_NAMESPACE::abs (frustum.aspect() - ((r - l) / (t - b))) < +- 1e-6); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::abs ( ++ frustum.aspectExc () - ((r - l) / (t - b))) < 1e-6); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::abs ( ++ frustum.aspect () - ((r - l) / (t - b))) < 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-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); + cout << "3"; + + cout << "\nplanes "; +@@ -226,7 +260,7 @@ testFrustum() + caught = false; + try + { +- (void) badFrustum.projectionMatrixExc(); ++ (void) badFrustum.projectionMatrixExc (); + assert (!"near == far didn't throw an exception"); + } + catch (std::domain_error&) +@@ -240,7 +274,7 @@ testFrustum() + caught = false; + try + { +- (void) badFrustum.projectionMatrixExc(); ++ (void) badFrustum.projectionMatrixExc (); + assert (!"left == right didn't throw an exception"); + } + catch (std::domain_error&) +@@ -254,7 +288,7 @@ testFrustum() + caught = false; + try + { +- (void) badFrustum.projectionMatrixExc(); ++ (void) badFrustum.projectionMatrixExc (); + assert (!"top == bottom didn't throw an exception"); + } + catch (std::domain_error&) +@@ -268,23 +302,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-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); + cout << "1"; + + cout << "\nplanes "; +@@ -315,10 +354,10 @@ testFrustum() + assert (f1 == f2); + cout << "\npassed equality test"; + +- long zMax = 100; +- long zMin = 1; +- float zero = 0; +- float one = 1; ++ long zMax = 100; ++ long zMin = 1; ++ float zero = 0; ++ float one = 1; + IMATH_INTERNAL_NAMESPACE::Vec3 v3 (zero, zero, one); + + f1.set (n, f, one, zero, one); +@@ -326,7 +365,8 @@ testFrustum() + + assert (f1 == f2); + +- assert (f1.ZToDepth (zMin, zMin, zMax) == f1.ZToDepthExc (zMin, zMin, zMax)); ++ assert ( ++ f1.ZToDepth (zMin, zMin, zMax) == f1.ZToDepthExc (zMin, zMin, zMax)); + assert (f1.normalizedZToDepth (zMin) == f1.normalizedZToDepthExc (zMin)); + assert (f1.DepthToZ (n, zMin, zMax) == f1.DepthToZExc (n, zMin, zMax)); + assert (f1.worldRadius (v3, one) == f1.worldRadiusExc (v3, one)); +diff --git a/src/ImathTest/testFrustum.h b/src/ImathTest/testFrustum.h +index 9047932..73df352 100644 +--- a/src/ImathTest/testFrustum.h ++++ b/src/ImathTest/testFrustum.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testFrustum(); ++void testFrustum (); +diff --git a/src/ImathTest/testFrustumTest.cpp b/src/ImathTest/testFrustumTest.cpp +index 721b9ef..1a23e0f 100644 +--- a/src/ImathTest/testFrustumTest.cpp ++++ b/src/ImathTest/testFrustumTest.cpp +@@ -7,13 +7,13 @@ + # undef NDEBUG + #endif + ++#include "testFrustumTest.h" + #include + #include + #include + #include + #include + #include +-#include "testFrustumTest.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -21,7 +21,7 @@ + using namespace std; + + void +-testFrustumTest() ++testFrustumTest () + { + cout << "Testing functions in ImathFrustumTest.h"; + +@@ -38,18 +38,24 @@ testFrustumTest() + + IMATH_INTERNAL_NAMESPACE::Matrix44 cameraMat; + IMATH_INTERNAL_NAMESPACE::Vec3 cameraPos (100.0f, 200.0f, 300.0f); +- cameraMat.makeIdentity(); ++ cameraMat.makeIdentity (); + cameraMat.translate (cameraPos); + +- IMATH_INTERNAL_NAMESPACE::FrustumTest frustumTest (frustum, cameraMat); ++ IMATH_INTERNAL_NAMESPACE::FrustumTest frustumTest ( ++ frustum, cameraMat); + + ///////////////////////////////////////////////////// + // Test Vec3's +- IMATH_INTERNAL_NAMESPACE::Vec3 insideVec (100.0f, 200.0f, 300 - 2.0f); +- IMATH_INTERNAL_NAMESPACE::Vec3 outsideVec_near (100.0f, 200.0f, 300 - 1.5f); +- IMATH_INTERNAL_NAMESPACE::Vec3 outsideVec_far (100.0f, 200.0f, 300 - 568.0f); +- IMATH_INTERNAL_NAMESPACE::Vec3 outsideVec_side (100.0f, 200.0f + 100.0f, 300 - 2.0f); +- IMATH_INTERNAL_NAMESPACE::Vec3 outsideVec_up (100.0f + 100.0f, 200.0f, 300 - 2.0f); ++ IMATH_INTERNAL_NAMESPACE::Vec3 insideVec ( ++ 100.0f, 200.0f, 300 - 2.0f); ++ IMATH_INTERNAL_NAMESPACE::Vec3 outsideVec_near ( ++ 100.0f, 200.0f, 300 - 1.5f); ++ IMATH_INTERNAL_NAMESPACE::Vec3 outsideVec_far ( ++ 100.0f, 200.0f, 300 - 568.0f); ++ IMATH_INTERNAL_NAMESPACE::Vec3 outsideVec_side ( ++ 100.0f, 200.0f + 100.0f, 300 - 2.0f); ++ IMATH_INTERNAL_NAMESPACE::Vec3 outsideVec_up ( ++ 100.0f + 100.0f, 200.0f, 300 - 2.0f); + + assert (frustumTest.isVisible (insideVec)); + assert (!frustumTest.isVisible (outsideVec_near)); +@@ -64,54 +70,44 @@ testFrustumTest() + IMATH_INTERNAL_NAMESPACE::Vec3 hugeSize (1000.0f, 1000.0f, 1000.0f); + + // Empty box should NOT be visible +- assert (!frustumTest.isVisible ( +- IMATH_INTERNAL_NAMESPACE::Box>())); ++ assert (!frustumTest.isVisible (IMATH_INTERNAL_NAMESPACE::Box< ++ IMATH_INTERNAL_NAMESPACE::Vec3> ())); + + // Tiny box inside the frust should be visible + assert (frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- insideVec + tinySize, +- insideVec + tinySize))); ++ insideVec + tinySize, insideVec + tinySize))); + + // Huge boxes inside and outside should be visible + assert (frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- insideVec - hugeSize, +- insideVec + hugeSize))); ++ insideVec - hugeSize, insideVec + hugeSize))); + assert (frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- outsideVec_near - hugeSize, +- outsideVec_near + hugeSize))); ++ outsideVec_near - hugeSize, outsideVec_near + hugeSize))); + assert (frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- outsideVec_far - hugeSize, +- outsideVec_far + hugeSize))); ++ outsideVec_far - hugeSize, outsideVec_far + hugeSize))); + assert (frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- outsideVec_side - hugeSize, +- outsideVec_side + hugeSize))); ++ outsideVec_side - hugeSize, outsideVec_side + hugeSize))); + assert (frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- outsideVec_up - hugeSize, +- outsideVec_up + hugeSize))); ++ outsideVec_up - hugeSize, outsideVec_up + hugeSize))); + + // Tiny boxes outside should NOT be visible + assert (!frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- outsideVec_near - tinySize, +- outsideVec_near + tinySize))); ++ outsideVec_near - tinySize, outsideVec_near + tinySize))); + assert (!frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- outsideVec_far - tinySize, +- outsideVec_far + tinySize))); ++ outsideVec_far - tinySize, outsideVec_far + tinySize))); + assert (!frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- outsideVec_side - tinySize, +- outsideVec_side + tinySize))); ++ outsideVec_side - tinySize, outsideVec_side + tinySize))); + assert (!frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Box> ( +- outsideVec_up - tinySize, +- outsideVec_up + tinySize))); ++ outsideVec_up - tinySize, outsideVec_up + tinySize))); + cout << "passed Box\n"; + + ///////////////////////////////////////////////////// +@@ -120,28 +116,28 @@ testFrustumTest() + float hugeRadius = 1000.0f; + + // Tiny sphere inside the frust should be visible +- assert ( +- frustumTest.isVisible (IMATH_INTERNAL_NAMESPACE::Sphere3 (insideVec, tinyRadius))); ++ assert (frustumTest.isVisible ( ++ IMATH_INTERNAL_NAMESPACE::Sphere3 (insideVec, tinyRadius))); + + // Huge spheres inside and outside should be visible +- assert ( +- frustumTest.isVisible (IMATH_INTERNAL_NAMESPACE::Sphere3 (insideVec, hugeRadius))); + assert (frustumTest.isVisible ( +- IMATH_INTERNAL_NAMESPACE::Sphere3 (outsideVec_near, hugeRadius))); ++ IMATH_INTERNAL_NAMESPACE::Sphere3 (insideVec, hugeRadius))); ++ assert (frustumTest.isVisible (IMATH_INTERNAL_NAMESPACE::Sphere3 ( ++ outsideVec_near, hugeRadius))); + assert (frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Sphere3 (outsideVec_far, hugeRadius))); +- assert (frustumTest.isVisible ( +- IMATH_INTERNAL_NAMESPACE::Sphere3 (outsideVec_side, hugeRadius))); ++ assert (frustumTest.isVisible (IMATH_INTERNAL_NAMESPACE::Sphere3 ( ++ outsideVec_side, hugeRadius))); + assert (frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Sphere3 (outsideVec_up, hugeRadius))); + + // Tiny spheres outside should NOT be visible +- assert (!frustumTest.isVisible ( +- IMATH_INTERNAL_NAMESPACE::Sphere3 (outsideVec_near, tinyRadius))); ++ assert (!frustumTest.isVisible (IMATH_INTERNAL_NAMESPACE::Sphere3 ( ++ outsideVec_near, tinyRadius))); + assert (!frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Sphere3 (outsideVec_far, tinyRadius))); +- assert (!frustumTest.isVisible ( +- IMATH_INTERNAL_NAMESPACE::Sphere3 (outsideVec_side, tinyRadius))); ++ assert (!frustumTest.isVisible (IMATH_INTERNAL_NAMESPACE::Sphere3 ( ++ outsideVec_side, tinyRadius))); + assert (!frustumTest.isVisible ( + IMATH_INTERNAL_NAMESPACE::Sphere3 (outsideVec_up, tinyRadius))); + cout << "passed Sphere\n"; +diff --git a/src/ImathTest/testFrustumTest.h b/src/ImathTest/testFrustumTest.h +index 8bbe987..cc2af86 100644 +--- a/src/ImathTest/testFrustumTest.h ++++ b/src/ImathTest/testFrustumTest.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testFrustumTest(); ++void testFrustumTest (); +diff --git a/src/ImathTest/testFun.cpp b/src/ImathTest/testFun.cpp +index 91f25ae..c69ecd4 100644 +--- a/src/ImathTest/testFun.cpp ++++ b/src/ImathTest/testFun.cpp +@@ -11,29 +11,28 @@ + #if __cplusplus >= 202002L + # include + #endif +-#include ++#include "testFun.h" + #include +-#include + #include ++#include + #include +-#include "testFun.h" + + using namespace std; + + #if __cplusplus < 202002L +- template +- static inline To +- bit_cast (From from) ++template ++static inline To ++bit_cast (From from) ++{ ++ static_assert (sizeof (From) == sizeof (To), "Type sizes do not match"); ++ union + { +- static_assert (sizeof (From) == sizeof (To), "Type sizes do not match"); +- union +- { +- From f; +- To t; +- } u; +- u.f = from; +- return u.t; +- } ++ From f; ++ To t; ++ } u; ++ u.f = from; ++ return u.t; ++} + #endif + + void +@@ -43,14 +42,16 @@ testf (float f, bool changeExpected = true) + + float sf = IMATH_INTERNAL_NAMESPACE::succf (f); + float pf = IMATH_INTERNAL_NAMESPACE::predf (f); +- float spf = IMATH_INTERNAL_NAMESPACE::succf (IMATH_INTERNAL_NAMESPACE::predf (f)); +- float psf = IMATH_INTERNAL_NAMESPACE::predf (IMATH_INTERNAL_NAMESPACE::succf (f)); ++ float spf = ++ IMATH_INTERNAL_NAMESPACE::succf (IMATH_INTERNAL_NAMESPACE::predf (f)); ++ float psf = ++ IMATH_INTERNAL_NAMESPACE::predf (IMATH_INTERNAL_NAMESPACE::succf (f)); + +- printf ("f %.9g %x\n", f, bit_cast(f)); +- printf ("sf %.9g %x\n", sf, bit_cast(sf)); +- printf ("pf %.9g %x\n", pf, bit_cast(pf)); +- printf ("spf %.9g %x\n", spf, bit_cast(spf)); +- printf ("psf %.9g %x\n", psf, bit_cast(psf)); ++ printf ("f %.9g %x\n", f, bit_cast (f)); ++ printf ("sf %.9g %x\n", sf, bit_cast (sf)); ++ printf ("pf %.9g %x\n", pf, bit_cast (pf)); ++ printf ("spf %.9g %x\n", spf, bit_cast (spf)); ++ printf ("psf %.9g %x\n", psf, bit_cast (psf)); + + fflush (stdout); + +@@ -61,12 +62,12 @@ testf (float f, bool changeExpected = true) + } + else + { +- if (isnan(f)) ++ if (isnan (f)) + { + // If f is nan, pf and sf may be converted from signaling + // to quiet nan, but they'll still be nan's. +- assert (isnan(pf)); +- assert (isnan(sf)); ++ assert (isnan (pf)); ++ assert (isnan (sf)); + } + else + { +@@ -84,14 +85,16 @@ testd (double d, bool changeExpected = true) + + double sd = IMATH_INTERNAL_NAMESPACE::succd (d); + double pd = IMATH_INTERNAL_NAMESPACE::predd (d); +- double spd = IMATH_INTERNAL_NAMESPACE::succd (IMATH_INTERNAL_NAMESPACE::predd (d)); +- double psd = IMATH_INTERNAL_NAMESPACE::predd (IMATH_INTERNAL_NAMESPACE::succd (d)); ++ 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 %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)); + + fflush (stdout); + +@@ -102,12 +105,12 @@ testd (double d, bool changeExpected = true) + } + else + { +- if (isnan(d)) ++ if (isnan (d)) + { + // If f is nan, pf and sf may be converted from signaling + // to quiet nan, but they'll still be nan's. +- assert (isnan(pd)); +- assert (isnan(sd)); ++ assert (isnan (pd)); ++ assert (isnan (sd)); + } + else + { +@@ -119,7 +122,7 @@ testd (double d, bool changeExpected = true) + } + + void +-testFun() ++testFun () + { + cout << "Testing functions in ImathFun.h" << endl; + +@@ -155,99 +158,143 @@ testFun() + + cout << "divs / mods" << endl; + +- assert (IMATH_INTERNAL_NAMESPACE::divs (5, 2) == 2 && +- IMATH_INTERNAL_NAMESPACE::mods (5, 2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (4, 2) == 2 && +- IMATH_INTERNAL_NAMESPACE::mods (4, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (3, 2) == 1 && +- IMATH_INTERNAL_NAMESPACE::mods (3, 2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (2, 2) == 1 && +- IMATH_INTERNAL_NAMESPACE::mods (2, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (1, 2) == 0 && +- IMATH_INTERNAL_NAMESPACE::mods (1, 2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (0, 2) == 0 && +- IMATH_INTERNAL_NAMESPACE::mods (0, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-1, 2) == 0 && +- IMATH_INTERNAL_NAMESPACE::mods (-1, 2) == -1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-2, 2) == -1 && +- IMATH_INTERNAL_NAMESPACE::mods (-2, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-3, 2) == -1 && +- IMATH_INTERNAL_NAMESPACE::mods (-3, 2) == -1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-4, 2) == -2 && +- IMATH_INTERNAL_NAMESPACE::mods (-4, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-5, 2) == -2 && +- IMATH_INTERNAL_NAMESPACE::mods (-5, 2) == -1); +- +- assert (IMATH_INTERNAL_NAMESPACE::divs (5, -2) == -2 && +- IMATH_INTERNAL_NAMESPACE::mods (5, -2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (4, -2) == -2 && +- IMATH_INTERNAL_NAMESPACE::mods (4, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (3, -2) == -1 && +- IMATH_INTERNAL_NAMESPACE::mods (3, -2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (2, -2) == -1 && +- IMATH_INTERNAL_NAMESPACE::mods (2, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (1, -2) == 0 && +- IMATH_INTERNAL_NAMESPACE::mods (1, -2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (0, -2) == 0 && +- IMATH_INTERNAL_NAMESPACE::mods (0, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-1, -2) == 0 && +- IMATH_INTERNAL_NAMESPACE::mods (-1, -2) == -1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-2, -2) == 1 && +- IMATH_INTERNAL_NAMESPACE::mods (-2, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-3, -2) == 1 && +- IMATH_INTERNAL_NAMESPACE::mods (-3, -2) == -1); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-4, -2) == 2 && +- IMATH_INTERNAL_NAMESPACE::mods (-4, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divs (-5, -2) == 2 && +- IMATH_INTERNAL_NAMESPACE::mods (-5, -2) == -1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (5, 2) == 2 && ++ IMATH_INTERNAL_NAMESPACE::mods (5, 2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (4, 2) == 2 && ++ IMATH_INTERNAL_NAMESPACE::mods (4, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (3, 2) == 1 && ++ IMATH_INTERNAL_NAMESPACE::mods (3, 2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (2, 2) == 1 && ++ IMATH_INTERNAL_NAMESPACE::mods (2, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (1, 2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::mods (1, 2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (0, 2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::mods (0, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-1, 2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::mods (-1, 2) == -1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-2, 2) == -1 && ++ IMATH_INTERNAL_NAMESPACE::mods (-2, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-3, 2) == -1 && ++ IMATH_INTERNAL_NAMESPACE::mods (-3, 2) == -1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-4, 2) == -2 && ++ IMATH_INTERNAL_NAMESPACE::mods (-4, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-5, 2) == -2 && ++ IMATH_INTERNAL_NAMESPACE::mods (-5, 2) == -1); ++ ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (5, -2) == -2 && ++ IMATH_INTERNAL_NAMESPACE::mods (5, -2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (4, -2) == -2 && ++ IMATH_INTERNAL_NAMESPACE::mods (4, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (3, -2) == -1 && ++ IMATH_INTERNAL_NAMESPACE::mods (3, -2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (2, -2) == -1 && ++ IMATH_INTERNAL_NAMESPACE::mods (2, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (1, -2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::mods (1, -2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (0, -2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::mods (0, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-1, -2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::mods (-1, -2) == -1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-2, -2) == 1 && ++ IMATH_INTERNAL_NAMESPACE::mods (-2, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-3, -2) == 1 && ++ IMATH_INTERNAL_NAMESPACE::mods (-3, -2) == -1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-4, -2) == 2 && ++ IMATH_INTERNAL_NAMESPACE::mods (-4, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divs (-5, -2) == 2 && ++ IMATH_INTERNAL_NAMESPACE::mods (-5, -2) == -1); + + cout << "divp / modp" << endl; + +- assert (IMATH_INTERNAL_NAMESPACE::divp (5, 2) == 2 && +- IMATH_INTERNAL_NAMESPACE::modp (5, 2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (4, 2) == 2 && +- IMATH_INTERNAL_NAMESPACE::modp (4, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (3, 2) == 1 && +- IMATH_INTERNAL_NAMESPACE::modp (3, 2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (2, 2) == 1 && +- IMATH_INTERNAL_NAMESPACE::modp (2, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (1, 2) == 0 && +- IMATH_INTERNAL_NAMESPACE::modp (1, 2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (0, 2) == 0 && +- IMATH_INTERNAL_NAMESPACE::modp (0, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-1, 2) == -1 && +- IMATH_INTERNAL_NAMESPACE::modp (-1, 2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-2, 2) == -1 && +- IMATH_INTERNAL_NAMESPACE::modp (-2, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-3, 2) == -2 && +- IMATH_INTERNAL_NAMESPACE::modp (-3, 2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-4, 2) == -2 && +- IMATH_INTERNAL_NAMESPACE::modp (-4, 2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-5, 2) == -3 && +- IMATH_INTERNAL_NAMESPACE::modp (-5, 2) == 1); +- +- assert (IMATH_INTERNAL_NAMESPACE::divp (5, -2) == -2 && +- IMATH_INTERNAL_NAMESPACE::modp (5, -2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (4, -2) == -2 && +- IMATH_INTERNAL_NAMESPACE::modp (4, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (3, -2) == -1 && +- IMATH_INTERNAL_NAMESPACE::modp (3, -2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (2, -2) == -1 && +- IMATH_INTERNAL_NAMESPACE::modp (2, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (1, -2) == 0 && +- IMATH_INTERNAL_NAMESPACE::modp (1, -2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (0, -2) == 0 && +- IMATH_INTERNAL_NAMESPACE::modp (0, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-1, -2) == 1 && +- IMATH_INTERNAL_NAMESPACE::modp (-1, -2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-2, -2) == 1 && +- IMATH_INTERNAL_NAMESPACE::modp (-2, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-3, -2) == 2 && +- IMATH_INTERNAL_NAMESPACE::modp (-3, -2) == 1); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-4, -2) == 2 && +- IMATH_INTERNAL_NAMESPACE::modp (-4, -2) == 0); +- assert (IMATH_INTERNAL_NAMESPACE::divp (-5, -2) == 3 && +- IMATH_INTERNAL_NAMESPACE::modp (-5, -2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (5, 2) == 2 && ++ IMATH_INTERNAL_NAMESPACE::modp (5, 2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (4, 2) == 2 && ++ IMATH_INTERNAL_NAMESPACE::modp (4, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (3, 2) == 1 && ++ IMATH_INTERNAL_NAMESPACE::modp (3, 2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (2, 2) == 1 && ++ IMATH_INTERNAL_NAMESPACE::modp (2, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (1, 2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::modp (1, 2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (0, 2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::modp (0, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-1, 2) == -1 && ++ IMATH_INTERNAL_NAMESPACE::modp (-1, 2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-2, 2) == -1 && ++ IMATH_INTERNAL_NAMESPACE::modp (-2, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-3, 2) == -2 && ++ IMATH_INTERNAL_NAMESPACE::modp (-3, 2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-4, 2) == -2 && ++ IMATH_INTERNAL_NAMESPACE::modp (-4, 2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-5, 2) == -3 && ++ IMATH_INTERNAL_NAMESPACE::modp (-5, 2) == 1); ++ ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (5, -2) == -2 && ++ IMATH_INTERNAL_NAMESPACE::modp (5, -2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (4, -2) == -2 && ++ IMATH_INTERNAL_NAMESPACE::modp (4, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (3, -2) == -1 && ++ IMATH_INTERNAL_NAMESPACE::modp (3, -2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (2, -2) == -1 && ++ IMATH_INTERNAL_NAMESPACE::modp (2, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (1, -2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::modp (1, -2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (0, -2) == 0 && ++ IMATH_INTERNAL_NAMESPACE::modp (0, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-1, -2) == 1 && ++ IMATH_INTERNAL_NAMESPACE::modp (-1, -2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-2, -2) == 1 && ++ IMATH_INTERNAL_NAMESPACE::modp (-2, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-3, -2) == 2 && ++ IMATH_INTERNAL_NAMESPACE::modp (-3, -2) == 1); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-4, -2) == 2 && ++ IMATH_INTERNAL_NAMESPACE::modp (-4, -2) == 0); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::divp (-5, -2) == 3 && ++ IMATH_INTERNAL_NAMESPACE::modp (-5, -2) == 1); + + cout << "successor, predecessor" << endl; + +@@ -259,7 +306,11 @@ testFun() + testf (7); + testf (0.7); + +- union {float f; uint32_t i;} u; ++ union ++ { ++ float f; ++ uint32_t i; ++ } u; + u.i = 0x7f800000; // inf + testf (u.f, false); + u.i = 0xff800000; // -inf +@@ -279,7 +330,11 @@ testFun() + testd (7); + testd (0.7); + +- union {double d; uint64_t i;} v; ++ union ++ { ++ double d; ++ uint64_t i; ++ } v; + v.i = 0x7ff0000000000000ULL; // inf + testd (v.d, false); + v.i = 0xfff0000000000000ULL; // -inf +diff --git a/src/ImathTest/testFun.h b/src/ImathTest/testFun.h +index 830b92d..ecbf1f9 100644 +--- a/src/ImathTest/testFun.h ++++ b/src/ImathTest/testFun.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testFun(); ++void testFun (); +diff --git a/src/ImathTest/testFunction.cpp b/src/ImathTest/testFunction.cpp +index ad235a8..aed1f50 100644 +--- a/src/ImathTest/testFunction.cpp ++++ b/src/ImathTest/testFunction.cpp +@@ -7,10 +7,10 @@ + # undef NDEBUG + #endif + ++#include "testFunction.h" + #include "halfFunction.h" + #include + #include +-#include "testFunction.h" + + using namespace std; + +@@ -33,7 +33,7 @@ struct timesN + } // namespace + + void +-testFunction() ++testFunction () + { + cout << "halfFunction\n"; + +@@ -44,17 +44,18 @@ testFunction() + assert (d2 (-2) == -1); + assert (d2 (HALF_MAX) == HALF_MAX / 2); + assert (d2 (-HALF_MAX) == -HALF_MAX / 2); +- assert (d2 (half::posInf()) == 0); +- assert (d2 (half::negInf()) == 0); +- assert (d2 (half::qNan()) == 0); +- +- halfFunction t5 (timesN (5), // function +- 0, +- HALF_MAX / 8, // domain +- -1, // default value +- half::posInf(), // posInfValue +- half::negInf(), // negInfValue +- half::qNan()); // nanValue ++ assert (d2 (half::posInf ()) == 0); ++ assert (d2 (half::negInf ()) == 0); ++ assert (d2 (half::qNan ()) == 0); ++ ++ halfFunction t5 ( ++ timesN (5), // function ++ 0, ++ HALF_MAX / 8, // domain ++ -1, // default value ++ half::posInf (), // posInfValue ++ half::negInf (), // negInfValue ++ half::qNan ()); // nanValue + + assert (t5 (0) == 0); + assert (t5 (2) == 10); +@@ -62,13 +63,13 @@ testFunction() + assert (t5 (HALF_MAX) == -1); + assert (t5 (-HALF_MAX) == -1); + +- assert (t5 (half::posInf()).isInfinity()); +- assert (!t5 (half::posInf()).isNegative()); ++ assert (t5 (half::posInf ()).isInfinity ()); ++ assert (!t5 (half::posInf ()).isNegative ()); + +- assert (t5 (half::negInf()).isInfinity()); +- assert (t5 (half::negInf()).isNegative()); ++ assert (t5 (half::negInf ()).isInfinity ()); ++ assert (t5 (half::negInf ()).isNegative ()); + +- assert (t5 (half::qNan()).isNan()); ++ assert (t5 (half::qNan ()).isNan ()); + + cout << "ok\n\n" << flush; + } +diff --git a/src/ImathTest/testFunction.h b/src/ImathTest/testFunction.h +index daa14a9..51d3f68 100644 +--- a/src/ImathTest/testFunction.h ++++ b/src/ImathTest/testFunction.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testFunction(); ++void testFunction (); +diff --git a/src/ImathTest/testInterop.cpp b/src/ImathTest/testInterop.cpp +index f26680e..35b5435 100644 +--- a/src/ImathTest/testInterop.cpp ++++ b/src/ImathTest/testInterop.cpp +@@ -7,178 +7,173 @@ + # undef NDEBUG + #endif + ++#include "testVec.h" + #include +-#include + #include ++#include + #include + #include + #include + #include + #include +-#include "testVec.h" + + using namespace std; + using namespace IMATH_INTERNAL_NAMESPACE; + +- + // Imath::has_subscript fails for std::vector because its length does not + // appear to be the length of N elements. Carve out an exception here that + // allows this to work. + IMATH_INTERNAL_NAMESPACE_SOURCE_ENTER +-template +-struct has_subscript, T, N> : public std::true_type { }; ++template ++struct has_subscript, T, N> : public std::true_type ++{}; + IMATH_INTERNAL_NAMESPACE_SOURCE_EXIT + + #if IMATH_FOREIGN_VECTOR_INTEROP + +- + namespace + { + + // Extra simple vector that does nothing but allow element access, as an + // example of a vector type that an app might use and want interop with + // our vectors. +-template +-struct SimpleVec { ++template struct SimpleVec ++{ + T elements[N]; + +- SimpleVec(T val = T(0)) { ++ SimpleVec (T val = T (0)) ++ { + for (int i = 0; i < N; ++i) + elements[i] = val; + } +- ~SimpleVec() = default; +- constexpr T operator[](int i) const { return elements[i]; } +- T& operator[](int i) { return elements[i]; } ++ ~SimpleVec () = default; ++ constexpr T operator[] (int i) const { return elements[i]; } ++ T& operator[] (int i) { return elements[i]; } + }; + +- +- + // Extra simple matrix that does nothing but allow element access, as an + // example of a matrix type that an app might use and want interop with + // our vectors. +-template +-struct SimpleMx { ++template struct SimpleMx ++{ + T elements[N][N]; + +- SimpleMx(T val = T(0)) { ++ SimpleMx (T val = T (0)) ++ { + for (int j = 0; j < N; ++j) + for (int i = 0; i < N; ++i) + elements[j][i] = val; + } +- ~SimpleMx() = default; +- const T* operator[](int i) const { return elements[i]; } +- T* operator[](int i) { return elements[i]; } ++ ~SimpleMx () = default; ++ const T* operator[] (int i) const { return elements[i]; } ++ T* operator[] (int i) { return elements[i]; } + }; + +- +- + // Small structs containing just x,y,z,w elements. +-template +-struct xy { ++template struct xy ++{ + T x, y; + }; + +- +-template +-struct xyz { ++template struct xyz ++{ + T x, y, z; + }; + +- +-template +-struct xyzw { ++template struct xyzw ++{ + T x, y, z, w; + }; + +- +-template +-struct xyz_wrong { +- T x() { return 0; } +- T y() { return 1; } +- T z() { return 2; } ++template struct xyz_wrong ++{ ++ T x () { return 0; } ++ T y () { return 1; } ++ T z () { return 2; } + }; + +- +- + // A class that has *both* subscripting and named members +-template +-struct ComboVec2 { +- union { ++template struct ComboVec2 ++{ ++ union ++ { + T elements[2]; +- struct { T x, y; }; ++ struct ++ { ++ T x, y; ++ }; + }; + +- ComboVec2(T val = T(0)) : x(val), y(val) { } +- ~ComboVec2() = default; +- constexpr T operator[](int i) const { return elements[i]; } +- T& operator[](int i) { return elements[i]; } ++ ComboVec2 (T val = T (0)) : x (val), y (val) {} ++ ~ComboVec2 () = default; ++ constexpr T operator[] (int i) const { return elements[i]; } ++ T& operator[] (int i) { return elements[i]; } + }; + +- +- + // A class that has *both* subscripting and named members +-template +-struct ComboVec3 { +- union { ++template struct ComboVec3 ++{ ++ union ++ { + T elements[3]; +- struct { T x, y, z; }; ++ struct ++ { ++ T x, y, z; ++ }; + }; + +- ComboVec3(T val = T(0)) : x(val), y(val), z(val) { } +- ~ComboVec3() = default; +- constexpr T operator[](int i) const { return elements[i]; } +- T& operator[](int i) { return elements[i]; } ++ ComboVec3 (T val = T (0)) : x (val), y (val), z (val) {} ++ ~ComboVec3 () = default; ++ constexpr T operator[] (int i) const { return elements[i]; } ++ T& operator[] (int i) { return elements[i]; } + }; + +- +- + // A class that has *both* subscripting and named members +-template +-struct ComboVec4 { +- union { ++template struct ComboVec4 ++{ ++ union ++ { + T elements[4]; +- struct { T x, y, z, w; }; ++ struct ++ { ++ T x, y, z, w; ++ }; + }; + +- ComboVec4(T val = T(0)) : x(val), y(val), z(val), w(val) { } +- ~ComboVec4() = default; +- constexpr T operator[](int i) const { return elements[i]; } +- T& operator[](int i) { return elements[i]; } ++ ComboVec4 (T val = T (0)) : x (val), y (val), z (val), w (val) {} ++ ~ComboVec4 () = default; ++ constexpr T operator[] (int i) const { return elements[i]; } ++ T& operator[] (int i) { return elements[i]; } + }; + +- +- + // Test whether a Vec contains the given elements. + void +-testVecVal2f(const V2f& v, float a, float b) ++testVecVal2f (const V2f& v, float a, float b) + { +- assert(v[0] == a && v[1] == b); ++ assert (v[0] == a && v[1] == b); + } + + void +-testVecVal3f(const V3f& v, float a, float b, float c) ++testVecVal3f (const V3f& v, float a, float b, float c) + { +- assert(v[0] == a && v[1] == b && v[2] == c); ++ assert (v[0] == a && v[1] == b && v[2] == c); + } + + void +-testVecVal4f(const V4f& v, float a, float b, float c, float d) ++testVecVal4f (const V4f& v, float a, float b, float c, float d) + { +- assert(v[0] == a && v[1] == b && v[2] == c && v[3] == d); ++ assert (v[0] == a && v[1] == b && v[2] == c && v[3] == d); + } + +- +- +- + void +-testInteropVec2() ++testInteropVec2 () + { + std::cout << "has_xy, float>::value = " +- << has_xy, float>::value << "\n"; ++ << has_xy, float>::value << "\n"; + std::cout << "has_xy, float>::value = " +- << has_xy, float>::value << "\n"; ++ << has_xy, float>::value << "\n"; + std::cout << "has_xy, float>::value = " +- << has_xy, float>::value << "\n"; ++ << has_xy, float>::value << "\n"; + std::cout << "has_xy, float>::value = " + << has_xy, float>::value << "\n"; + std::cout << "has_xy, float>::value = " +@@ -191,11 +186,11 @@ testInteropVec2() + << has_xy, float>::value << "\n"; + std::cout << "\n"; + std::cout << "has_subscript, float, 2>::value = " +- << has_subscript, float, 2>::value << "\n"; ++ << has_subscript, float, 2>::value << "\n"; + std::cout << "has_subscript, float, 2>::value = " +- << has_subscript, float, 2>::value << "\n"; ++ << has_subscript, float, 2>::value << "\n"; + std::cout << "has_subscript, float, 2>::value = " +- << has_subscript, float, 2>::value << "\n"; ++ << has_subscript, float, 2>::value << "\n"; + std::cout << "has_subscript, float, 2>::value = " + << has_subscript, float, 2>::value << "\n"; + std::cout << "has_subscript, float, 2>::value = " +@@ -221,92 +216,91 @@ testInteropVec2() + << has_subscript, float, 2>::value << "\n"; + std::cout << "\n"; + +- assert((!has_xy, float>::value)); +- assert((has_xy, float>::value)); +- assert((!has_xy, float>::value)); ++ assert ((!has_xy, float>::value)); ++ assert ((has_xy, float>::value)); ++ assert ((!has_xy, float>::value)); + +- assert((has_subscript, float, 2>::value)); +- assert((!has_subscript, float, 2>::value)); +- assert((!has_subscript, int, 2>::value)); +- assert((!has_subscript, float, 2>::value)); +- assert((!has_subscript, float, 2>::value)); ++ assert ((has_subscript, float, 2>::value)); ++ assert ((!has_subscript, float, 2>::value)); ++ assert ((!has_subscript, int, 2>::value)); ++ assert ((!has_subscript, float, 2>::value)); ++ assert ((!has_subscript, float, 2>::value)); + + // Test construction/assignment/paramater pass of a vector type with + // subscripting to access components. + { +- SimpleVec s; ++ SimpleVec s; + s[0] = 1; + s[1] = 2; +- Vec2 v(s); +- assert(v[0] == 1 && v[1] == 2); ++ Vec2 v (s); ++ assert (v[0] == 1 && v[1] == 2); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42); +- testVecVal2f(V2f(s), 1.0f, 42.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42); ++ testVecVal2f (V2f (s), 1.0f, 42.0f); + } + // Test construction/assignment/paramater pass of a vector type with + // explicit .y, .y, .z components but no subscripting. + { +- xy s { 1, 2 }; +- Vec2 v(s); +- assert(v[0] == 1 && v[1] == 2); ++ xy s{1, 2}; ++ Vec2 v (s); ++ assert (v[0] == 1 && v[1] == 2); + s.y = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42); +- testVecVal2f(V2f(s), 1.0f, 42.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42); ++ testVecVal2f (V2f (s), 1.0f, 42.0f); + } + // Test construction/assignment/paramater pass of a std::vector of length 3 + { +- std::vector s { 1, 2 }; +- Vec2 v(s); +- assert(v[0] == 1 && v[1] == 2); ++ std::vector s{1, 2}; ++ Vec2 v (s); ++ assert (v[0] == 1 && v[1] == 2); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42); +- testVecVal2f(V2f(s), 1.0f, 42.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42); ++ testVecVal2f (V2f (s), 1.0f, 42.0f); + } + // Test construction/assignment/paramater pass of a std::array of length 3 + { +- std::array s { 1, 2 }; +- Vec2 v(s); +- assert(v[0] == 1 && v[1] == 2); ++ std::array s{1, 2}; ++ Vec2 v (s); ++ assert (v[0] == 1 && v[1] == 2); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42); +- testVecVal2f(V2f(s), 1.0f, 42.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42); ++ testVecVal2f (V2f (s), 1.0f, 42.0f); + } + // Test construction/assignment/paramater pass of initializer lists. + { +- Vec2 v({ 1.0f, 2.0f }); +- assert(v[0] == 1 && v[1] == 2); +- v = { 1.0f, 42.0f }; +- assert(v[0] == 1 && v[1] == 42); +- testVecVal2f({ 1.0f, 42.0f}, 1.0f, 42.0f); ++ Vec2 v ({1.0f, 2.0f}); ++ assert (v[0] == 1 && v[1] == 2); ++ v = {1.0f, 42.0f}; ++ assert (v[0] == 1 && v[1] == 42); ++ testVecVal2f ({1.0f, 42.0f}, 1.0f, 42.0f); + } + // Test construction/assignment/paramater pass of a C array + { +- float s[2] = { 1, 2 }; +- Vec2 v(s); +- assert(v[0] == 1 && v[1] == 2); ++ float s[2] = {1, 2}; ++ Vec2 v (s); ++ assert (v[0] == 1 && v[1] == 2); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42); +- testVecVal2f(V2f(s), 1.0f, 42.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42); ++ testVecVal2f (V2f (s), 1.0f, 42.0f); + } + } + +- + //--------- + + void +-testInteropVec3() ++testInteropVec3 () + { + std::cout << "has_xyz, float>::value = " +- << has_xyz, float>::value << "\n"; ++ << has_xyz, float>::value << "\n"; + std::cout << "has_xyz, float>::value = " +- << has_xyz, float>::value << "\n"; ++ << has_xyz, float>::value << "\n"; + std::cout << "has_xyz, float>::value = " +- << has_xyz, float>::value << "\n"; ++ << has_xyz, float>::value << "\n"; + std::cout << "has_xyz, float>::value = " + << has_xyz, float>::value << "\n"; + std::cout << "has_xyz, float>::value = " +@@ -319,11 +313,11 @@ testInteropVec3() + << has_xyz, float>::value << "\n"; + std::cout << "\n"; + std::cout << "has_subscript, float, 3>::value = " +- << has_subscript, float, 3>::value << "\n"; ++ << has_subscript, float, 3>::value << "\n"; + std::cout << "has_subscript, float, 3>::value = " +- << has_subscript, float, 3>::value << "\n"; ++ << has_subscript, float, 3>::value << "\n"; + std::cout << "has_subscript, float, 3>::value = " +- << has_subscript, float, 3>::value << "\n"; ++ << has_subscript, float, 3>::value << "\n"; + std::cout << "has_subscript, float, 3>::value = " + << has_subscript, float, 3>::value << "\n"; + std::cout << "has_subscript, float, 3>::value = " +@@ -349,93 +343,92 @@ testInteropVec3() + << has_subscript, float, 3>::value << "\n"; + std::cout << "\n"; + +- assert((!has_xyz, float>::value)); +- assert((has_xyz, float>::value)); +- assert((!has_xyz, float>::value)); ++ assert ((!has_xyz, float>::value)); ++ assert ((has_xyz, float>::value)); ++ assert ((!has_xyz, float>::value)); + +- assert((has_subscript, float, 3>::value)); +- assert((!has_subscript, float, 3>::value)); +- assert((!has_subscript, int, 3>::value)); +- assert((!has_subscript, float, 3>::value)); +- assert((!has_subscript, float, 3>::value)); ++ assert ((has_subscript, float, 3>::value)); ++ assert ((!has_subscript, float, 3>::value)); ++ assert ((!has_subscript, int, 3>::value)); ++ assert ((!has_subscript, float, 3>::value)); ++ assert ((!has_subscript, float, 3>::value)); + + // Test construction/assignment/paramater pass of a vector type with + // subscripting to access components. + { +- SimpleVec s; ++ SimpleVec s; + s[0] = 1; + s[1] = 2; + s[2] = 3; +- Vec3 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3); ++ Vec3 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3); +- testVecVal3f(V3f(s), 1.0f, 42.0f, 3.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3); ++ testVecVal3f (V3f (s), 1.0f, 42.0f, 3.0f); + } + // Test construction/assignment/paramater pass of a vector type with + // explicit .y, .y, .z components but no subscripting. + { +- xyz s { 1, 2, 3 }; +- Vec3 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3); ++ xyz s{1, 2, 3}; ++ Vec3 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3); + s.y = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3); +- testVecVal3f(V3f(s), 1.0f, 42.0f, 3.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3); ++ testVecVal3f (V3f (s), 1.0f, 42.0f, 3.0f); + } + // Test construction/assignment/paramater pass of a std::vector of length 3 + { +- std::vector s { 1, 2, 3 }; +- Vec3 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3); ++ std::vector s{1, 2, 3}; ++ Vec3 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3); +- testVecVal3f(V3f(s), 1.0f, 42.0f, 3.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3); ++ testVecVal3f (V3f (s), 1.0f, 42.0f, 3.0f); + } + // Test construction/assignment/paramater pass of a std::array of length 3 + { +- std::array s { 1, 2, 3 }; +- Vec3 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3); ++ std::array s{1, 2, 3}; ++ Vec3 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3); +- testVecVal3f(V3f(s), 1.0f, 42.0f, 3.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3); ++ testVecVal3f (V3f (s), 1.0f, 42.0f, 3.0f); + } + // Test construction/assignment/paramater pass of initializer lists. + { +- Vec3 v({ 1.0f, 2.0f, 3.0f }); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3); +- v = { 1.0f, 42.0f, 3.0f }; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3); +- testVecVal3f({ 1.0f, 42.0f, 3.0f }, 1, 42, 3); ++ Vec3 v ({1.0f, 2.0f, 3.0f}); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3); ++ v = {1.0f, 42.0f, 3.0f}; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3); ++ testVecVal3f ({1.0f, 42.0f, 3.0f}, 1, 42, 3); + } + // Test construction/assignment/paramater pass of a C array + { +- float s[3] = { 1, 2, 3 }; +- Vec3 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3); ++ float s[3] = {1, 2, 3}; ++ Vec3 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3); +- testVecVal3f(V3f(s), 1.0f, 42.0f, 3.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3); ++ testVecVal3f (V3f (s), 1.0f, 42.0f, 3.0f); + } + } + +- + //--------- + + void +-testInteropVec4() ++testInteropVec4 () + { + std::cout << "has_xyzw, float>::value = " +- << has_xyzw, float>::value << "\n"; ++ << has_xyzw, float>::value << "\n"; + std::cout << "has_xyzw, float>::value = " +- << has_xyzw, float>::value << "\n"; ++ << has_xyzw, float>::value << "\n"; + std::cout << "has_xyzw, float>::value = " +- << has_xyzw, float>::value << "\n"; ++ << has_xyzw, float>::value << "\n"; + std::cout << "has_xyzw, float>::value = " + << has_xyzw, float>::value << "\n"; + std::cout << "has_xyzw, float>::value = " +@@ -448,11 +441,11 @@ testInteropVec4() + << has_xyzw, float>::value << "\n"; + std::cout << "\n"; + std::cout << "has_subscript, float, 4>::value = " +- << has_subscript, float, 4>::value << "\n"; ++ << has_subscript, float, 4>::value << "\n"; + std::cout << "has_subscript, float, 4>::value = " +- << has_subscript, float, 4>::value << "\n"; ++ << has_subscript, float, 4>::value << "\n"; + std::cout << "has_subscript, float, 4>::value = " +- << has_subscript, float, 4>::value << "\n"; ++ << has_subscript, float, 4>::value << "\n"; + std::cout << "has_subscript, float, 4>::value = " + << has_subscript, float, 4>::value << "\n"; + std::cout << "has_subscript, float, 4>::value = " +@@ -478,235 +471,246 @@ testInteropVec4() + << has_subscript, float, 4>::value << "\n"; + std::cout << "\n"; + +- assert((!has_xyzw, float>::value)); +- assert((has_xyzw, float>::value)); +- assert((!has_xyzw, float>::value)); ++ assert ((!has_xyzw, float>::value)); ++ assert ((has_xyzw, float>::value)); ++ assert ((!has_xyzw, float>::value)); + +- assert((has_subscript, float, 4>::value)); +- assert((!has_subscript, float, 3>::value)); +- assert((!has_subscript, int, 4>::value)); +- assert((!has_subscript, float, 4>::value)); +- assert((!has_subscript, float, 4>::value)); ++ assert ((has_subscript, float, 4>::value)); ++ assert ((!has_subscript, float, 3>::value)); ++ assert ((!has_subscript, int, 4>::value)); ++ assert ((!has_subscript, float, 4>::value)); ++ assert ((!has_subscript, float, 4>::value)); + + // Test construction/assignment/paramater pass of a vector type with + // subscripting to access components. + { +- SimpleVec s; ++ SimpleVec s; + s[0] = 1; + s[1] = 2; + s[2] = 3; + s[3] = 4; +- Vec4 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); ++ Vec4 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); +- testVecVal4f(V4f(s), 1.0f, 42.0f, 3.0f, 4.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); ++ testVecVal4f (V4f (s), 1.0f, 42.0f, 3.0f, 4.0f); + } + // Test construction/assignment/paramater pass of a vector type with + // explicit .y, .y, .z components but no subscripting. + { +- xyzw s { 1, 2, 3, 4 }; +- Vec4 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); ++ xyzw s{1, 2, 3, 4}; ++ Vec4 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); + s.y = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); +- testVecVal4f(V4f(s), 1.0f, 42.0f, 3.0f, 4.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); ++ testVecVal4f (V4f (s), 1.0f, 42.0f, 3.0f, 4.0f); + } + // Test construction/assignment/paramater pass of a std::vector of length 3 + { +- std::vector s { 1, 2, 3, 4 }; +- Vec4 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); ++ std::vector s{1, 2, 3, 4}; ++ Vec4 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); +- testVecVal4f(V4f(s), 1.0f, 42.0f, 3.0f, 4.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); ++ testVecVal4f (V4f (s), 1.0f, 42.0f, 3.0f, 4.0f); + } + // Test construction/assignment/paramater pass of a std::array of length 3 + { +- std::array s { 1, 2, 3, 4 }; +- Vec4 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); ++ std::array s{1, 2, 3, 4}; ++ Vec4 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); +- testVecVal4f(V4f(s), 1.0f, 42.0f, 3.0f, 4.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); ++ testVecVal4f (V4f (s), 1.0f, 42.0f, 3.0f, 4.0f); + } + // Test construction/assignment/paramater pass of initializer lists. + { +- Vec4 v({ 1.0f, 2.0f, 3.0f, 4.0f }); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); +- v = { 1.0f, 42.0f, 3.0f, 4.0f }; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); +- testVecVal4f({ 1.0f, 42.0f, 3.0f, 4.0f }, 1, 42, 3, 4); ++ Vec4 v ({1.0f, 2.0f, 3.0f, 4.0f}); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); ++ v = {1.0f, 42.0f, 3.0f, 4.0f}; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); ++ testVecVal4f ({1.0f, 42.0f, 3.0f, 4.0f}, 1, 42, 3, 4); + } + // Test construction/assignment/paramater pass of a C array + { +- float s[4] = { 1, 2, 3, 4 }; +- Vec4 v(s); +- assert(v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); ++ float s[4] = {1, 2, 3, 4}; ++ Vec4 v (s); ++ assert (v[0] == 1 && v[1] == 2 && v[2] == 3 && v[3] == 4); + s[1] = 42; +- v = s; +- assert(v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); +- testVecVal4f(V4f(s), 1.0f, 42.0f, 3.0f, 4.0f); ++ v = s; ++ assert (v[0] == 1 && v[1] == 42 && v[2] == 3 && v[3] == 4); ++ testVecVal4f (V4f (s), 1.0f, 42.0f, 3.0f, 4.0f); + } + } + +- + //--------- + + void +-testInteropMx2() ++testInteropMx2 () + { +- std::cout << "has_double_subscript, float, 2, 2>::value = " +- << has_double_subscript, float, 2, 2>::value << "\n"; ++ std::cout ++ << "has_double_subscript, float, 2, 2>::value = " ++ << has_double_subscript, float, 2, 2>::value << "\n"; + std::cout << "has_double_subscript, float, 2, 2>::value = " +- << has_double_subscript, float, 2, 2>::value << "\n"; +- std::cout << "has_double_subscript, float, 4, 4>::value = " +- << has_double_subscript, float, 4, 4>::value << "\n"; ++ << has_double_subscript, float, 2, 2>::value ++ << "\n"; ++ std::cout ++ << "has_double_subscript, float, 4, 4>::value = " ++ << has_double_subscript, float, 4, 4>::value << "\n"; + std::cout << "has_double_subscript, float, 2, 2>::value = " + << has_double_subscript, float, 2, 2>::value << "\n"; + std::cout << "has_double_subscript, float, 2, 2>::value = " +- << has_double_subscript, float, 2, 2>::value << "\n"; ++ << has_double_subscript, float, 2, 2>::value ++ << "\n"; + std::cout << "\n"; + +- assert((has_double_subscript, float, 2, 2>::value)); +- assert((!has_double_subscript, float, 4, 4>::value)); +- assert((!has_double_subscript, int, 2, 2>::value)); +- assert((!has_double_subscript, float, 2, 2>::value)); +- assert((!has_double_subscript, float, 2, 2>::value)); ++ assert ((has_double_subscript, float, 2, 2>::value)); ++ assert ((!has_double_subscript, float, 4, 4>::value)); ++ assert ((!has_double_subscript, int, 2, 2>::value)); ++ assert ((!has_double_subscript, float, 2, 2>::value)); ++ assert ((!has_double_subscript, float, 2, 2>::value)); + + // Test construction/assignment/paramater pass of a vector type with + // subscripting to access components. + { +- Matrix22 ref; +- SimpleMx s; ++ Matrix22 ref; ++ SimpleMx s; + for (int j = 0; j < 2; ++j) +- for (int i = 0; i < 2; ++i) { +- s[j][i] = i + j * 2; ++ for (int i = 0; i < 2; ++i) ++ { ++ s[j][i] = i + j * 2; + ref[j][i] = i + j * 2; + } +- Matrix22 v(s); +- assert(v[0][0] == 0 && v[0][1] == 1 && +- v[1][0] == 2 && v[1][1] == 3); ++ Matrix22 v (s); ++ assert (v[0][0] == 0 && v[0][1] == 1 && v[1][0] == 2 && v[1][1] == 3); + s[1][1] = 42; +- v = s; +- assert(v[0][0] == 0 && v[0][1] == 1 && +- v[1][0] == 2 && v[1][1] == 42); ++ v = s; ++ assert (v[0][0] == 0 && v[0][1] == 1 && v[1][0] == 2 && v[1][1] == 42); + } + } + +- +- + void +-testInteropMx3() ++testInteropMx3 () + { +- std::cout << "has_double_subscript, float, 3, 3>::value = " +- << has_double_subscript, float, 3, 3>::value << "\n"; ++ std::cout ++ << "has_double_subscript, float, 3, 3>::value = " ++ << has_double_subscript, float, 3, 3>::value << "\n"; + std::cout << "has_double_subscript, float, 3, 3>::value = " +- << has_double_subscript, float, 3, 3>::value << "\n"; +- std::cout << "has_double_subscript, float, 4, 4>::value = " +- << has_double_subscript, float, 4, 4>::value << "\n"; ++ << has_double_subscript, float, 3, 3>::value ++ << "\n"; ++ std::cout ++ << "has_double_subscript, float, 4, 4>::value = " ++ << has_double_subscript, float, 4, 4>::value << "\n"; + std::cout << "has_double_subscript, float, 3, 3>::value = " + << has_double_subscript, float, 3, 3>::value << "\n"; + std::cout << "has_double_subscript, float, 3, 3>::value = " +- << has_double_subscript, float, 3, 3>::value << "\n"; ++ << has_double_subscript, float, 3, 3>::value ++ << "\n"; + std::cout << "\n"; + +- assert((has_double_subscript, float, 3, 3>::value)); +- assert((!has_double_subscript, float, 4, 4>::value)); +- assert((!has_double_subscript, int, 3, 3>::value)); +- assert((!has_double_subscript, float, 3, 3>::value)); +- assert((!has_double_subscript, float, 3, 3>::value)); ++ assert ((has_double_subscript, float, 3, 3>::value)); ++ assert ((!has_double_subscript, float, 4, 4>::value)); ++ assert ((!has_double_subscript, int, 3, 3>::value)); ++ assert ((!has_double_subscript, float, 3, 3>::value)); ++ assert ((!has_double_subscript, float, 3, 3>::value)); + + // Test construction/assignment/paramater pass of a vector type with + // subscripting to access components. + { +- Matrix33 ref; +- SimpleMx s; ++ Matrix33 ref; ++ SimpleMx s; + for (int j = 0; j < 3; ++j) +- for (int i = 0; i < 3; ++i) { +- s[j][i] = i + j * 3; ++ for (int i = 0; i < 3; ++i) ++ { ++ s[j][i] = i + j * 3; + ref[j][i] = i + j * 3; + } +- Matrix33 v(s); +- assert(v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && +- v[1][0] == 3 && v[1][1] == 4 && v[1][2] == 5 && +- v[2][0] == 6 && v[2][1] == 7 && v[2][2] == 8); ++ Matrix33 v (s); ++ assert ( ++ v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && v[1][0] == 3 && ++ v[1][1] == 4 && v[1][2] == 5 && v[2][0] == 6 && v[2][1] == 7 && ++ v[2][2] == 8); + s[1][1] = 42; +- v = s; +- assert(v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && +- v[1][0] == 3 && v[1][1] == 42 && v[1][2] == 5 && +- v[2][0] == 6 && v[2][1] == 7 && v[2][2] == 8); ++ v = s; ++ assert ( ++ v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && v[1][0] == 3 && ++ v[1][1] == 42 && v[1][2] == 5 && v[2][0] == 6 && v[2][1] == 7 && ++ v[2][2] == 8); + } + } + +- +- + void +-testInteropMx4() ++testInteropMx4 () + { +- std::cout << "has_double_subscript, float, 4, 4>::value = " +- << has_double_subscript, float, 4, 4>::value << "\n"; ++ std::cout ++ << "has_double_subscript, float, 4, 4>::value = " ++ << has_double_subscript, float, 4, 4>::value << "\n"; + std::cout << "has_double_subscript, float, 4, 4>::value = " +- << has_double_subscript, float, 4, 4>::value << "\n"; +- std::cout << "has_double_subscript, float, 4, 4>::value = " +- << has_double_subscript, float, 4, 4>::value << "\n"; ++ << has_double_subscript, float, 4, 4>::value ++ << "\n"; ++ std::cout ++ << "has_double_subscript, float, 4, 4>::value = " ++ << has_double_subscript, float, 4, 4>::value << "\n"; + std::cout << "has_double_subscript, float, 4, 4>::value = " + << has_double_subscript, float, 4, 4>::value << "\n"; + std::cout << "has_double_subscript, float, 4, 4>::value = " +- << has_double_subscript, float, 4, 4>::value << "\n"; ++ << has_double_subscript, float, 4, 4>::value ++ << "\n"; + std::cout << "\n"; + +- assert((has_double_subscript, float, 4, 4>::value)); +- assert((!has_double_subscript, float, 3, 3>::value)); +- assert((!has_double_subscript, int, 4, 4>::value)); +- assert((!has_double_subscript, float, 4, 4>::value)); +- assert((!has_double_subscript, float, 4, 4>::value)); ++ assert ((has_double_subscript, float, 4, 4>::value)); ++ assert ((!has_double_subscript, float, 3, 3>::value)); ++ assert ((!has_double_subscript, int, 4, 4>::value)); ++ assert ((!has_double_subscript, float, 4, 4>::value)); ++ assert ((!has_double_subscript, float, 4, 4>::value)); + + // Test construction/assignment/paramater pass of a vector type with + // subscripting to access components. + { +- Matrix44 ref; +- SimpleMx s; ++ Matrix44 ref; ++ SimpleMx s; + for (int j = 0; j < 4; ++j) +- for (int i = 0; i < 4; ++i) { +- s[j][i] = i + j * 4; ++ for (int i = 0; i < 4; ++i) ++ { ++ s[j][i] = i + j * 4; + ref[j][i] = i + j * 4; + } +- Matrix44 v(s); +- assert(v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && v[0][3] == 3 && +- v[1][0] == 4 && v[1][1] == 5 && v[1][2] == 6 && v[1][3] == 7 && +- v[2][0] == 8 && v[2][1] == 9 && v[2][2] == 10 && v[2][3] == 11 && +- v[3][0] == 12 && v[3][1] == 13 && v[3][2] == 14 && v[3][3] == 15); ++ Matrix44 v (s); ++ assert ( ++ v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && v[0][3] == 3 && ++ v[1][0] == 4 && v[1][1] == 5 && v[1][2] == 6 && v[1][3] == 7 && ++ v[2][0] == 8 && v[2][1] == 9 && v[2][2] == 10 && v[2][3] == 11 && ++ v[3][0] == 12 && v[3][1] == 13 && v[3][2] == 14 && v[3][3] == 15); + s[1][1] = 42; +- v = s; +- assert(v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && v[0][3] == 3 && +- v[1][0] == 4 && v[1][1] == 42 && v[1][2] == 6 && v[1][3] == 7 && +- v[2][0] == 8 && v[2][1] == 9 && v[2][2] == 10 && v[2][3] == 11 && +- v[3][0] == 12 && v[3][1] == 13 && v[3][2] == 14 && v[3][3] == 15); ++ v = s; ++ assert ( ++ v[0][0] == 0 && v[0][1] == 1 && v[0][2] == 2 && v[0][3] == 3 && ++ v[1][0] == 4 && v[1][1] == 42 && v[1][2] == 6 && v[1][3] == 7 && ++ v[2][0] == 8 && v[2][1] == 9 && v[2][2] == 10 && v[2][3] == 11 && ++ v[3][0] == 12 && v[3][1] == 13 && v[3][2] == 14 && v[3][3] == 15); + } + } + + } // namespace + #endif + +- + void +-testInterop() ++testInterop () + { + cout << "Testing interoperability with foreign types" << endl; + + #if IMATH_FOREIGN_VECTOR_INTEROP +- testInteropVec2(); +- testInteropVec3(); +- testInteropVec4(); ++ testInteropVec2 (); ++ testInteropVec3 (); ++ testInteropVec4 (); + +- testInteropMx2(); +- testInteropMx3(); +- testInteropMx4(); ++ testInteropMx2 (); ++ testInteropMx3 (); ++ testInteropMx4 (); + + cout << "ok\n" << endl; + #else +diff --git a/src/ImathTest/testInterop.h b/src/ImathTest/testInterop.h +index 9e3fd00..c6ebc05 100644 +--- a/src/ImathTest/testInterop.h ++++ b/src/ImathTest/testInterop.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testInterop(); ++void testInterop (); +diff --git a/src/ImathTest/testInterval.cpp b/src/ImathTest/testInterval.cpp +index ae8d58f..9c31a86 100644 +--- a/src/ImathTest/testInterval.cpp ++++ b/src/ImathTest/testInterval.cpp +@@ -36,14 +36,16 @@ testConstructors (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- assert (b.min == T (std::numeric_limits::max()) && b.max == T (std::numeric_limits::lowest())); ++ assert ( ++ b.min == T (std::numeric_limits::max ()) && ++ b.max == T (std::numeric_limits::lowest ())); + } + + // + // Single point + // + { +- T p (42); ++ T p (42); + IMATH_INTERNAL_NAMESPACE::Interval b (p); + assert (b.min == p && b.max == p); + } +@@ -52,15 +54,15 @@ testConstructors (const char* type) + // Min and max + // + { +- T p0 (42); +- T p1 (666); ++ T p0 (42); ++ T p1 (666); + IMATH_INTERNAL_NAMESPACE::Interval b (p0, p1); + assert (b.min == p0 && b.max == p1); + } + + { +- T p0 (666); +- T p1 (42); ++ T p0 (666); ++ T p1 (42); + IMATH_INTERNAL_NAMESPACE::Interval b (p0, p1); + assert (b.min == p0 && b.max == p1); + } +@@ -77,8 +79,10 @@ testMakeEmpty (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- b.makeEmpty(); +- assert (b.min == T (std::numeric_limits::max()) && b.max == T (std::numeric_limits::lowest())); ++ b.makeEmpty (); ++ assert ( ++ b.min == T (std::numeric_limits::max ()) && ++ b.max == T (std::numeric_limits::lowest ())); + } + + // +@@ -86,19 +90,23 @@ testMakeEmpty (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b (T (-1), T (1)); +- b.makeEmpty(); +- assert (b.min == T (std::numeric_limits::max()) && b.max == T (std::numeric_limits::lowest())); ++ b.makeEmpty (); ++ assert ( ++ b.min == T (std::numeric_limits::max ()) && ++ b.max == T (std::numeric_limits::lowest ())); + } + + // + // Non-empty, no volume + // + { +- T min (0); +- T max (10); ++ T min (0); ++ T max (10); + IMATH_INTERNAL_NAMESPACE::Interval b (min, max); +- b.makeEmpty(); +- assert (b.min == T (std::numeric_limits::max()) && b.max == T (std::numeric_limits::lowest())); ++ b.makeEmpty (); ++ assert ( ++ b.min == T (std::numeric_limits::max ()) && ++ b.max == T (std::numeric_limits::lowest ())); + } + } + +@@ -113,8 +121,10 @@ testMakeInfinite (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- b.makeInfinite(); +- assert (b.min == T (std::numeric_limits::lowest()) && b.max == T (std::numeric_limits::max())); ++ b.makeInfinite (); ++ assert ( ++ b.min == T (std::numeric_limits::lowest ()) && ++ b.max == T (std::numeric_limits::max ())); + } + + // +@@ -122,8 +132,10 @@ testMakeInfinite (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b (T (-1), T (1)); +- b.makeInfinite(); +- assert (b.min == T (std::numeric_limits::lowest()) && b.max == T (std::numeric_limits::max())); ++ b.makeInfinite (); ++ assert ( ++ b.min == T (std::numeric_limits::lowest ()) && ++ b.max == T (std::numeric_limits::max ())); + } + + // +@@ -134,8 +146,10 @@ testMakeInfinite (const char* type) + T max (1); + + IMATH_INTERNAL_NAMESPACE::Interval b (min, max); +- b.makeInfinite(); +- assert (b.min == T (std::numeric_limits::lowest()) && b.max == T (std::numeric_limits::max())); ++ b.makeInfinite (); ++ assert ( ++ b.min == T (std::numeric_limits::lowest ()) && ++ b.max == T (std::numeric_limits::max ())); + } + } + +@@ -154,7 +168,7 @@ testExtendByPoint (const char* type) + // + for (unsigned int i = 0; i < iters; i++) + { +- T p (rand.nextf (-12345, 12345)); ++ T p (rand.nextf (-12345, 12345)); + IMATH_INTERNAL_NAMESPACE::Interval b; + b.extendBy (p); + assert (b.min == p && b.max == p); +@@ -202,8 +216,10 @@ testExtendByInterval (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- b.extendBy (IMATH_INTERNAL_NAMESPACE::Interval()); +- assert (b.min == T (std::numeric_limits::max()) && b.max == T (std::numeric_limits::lowest())); ++ b.extendBy (IMATH_INTERNAL_NAMESPACE::Interval ()); ++ assert ( ++ b.min == T (std::numeric_limits::max ()) && ++ b.max == T (std::numeric_limits::lowest ())); + } + + // +@@ -218,7 +234,7 @@ testExtendByInterval (const char* type) + assert (b0.min == p0 && b0.max == p1); + + IMATH_INTERNAL_NAMESPACE::Interval b1 (p0, p1); +- b1.extendBy (IMATH_INTERNAL_NAMESPACE::Interval()); ++ b1.extendBy (IMATH_INTERNAL_NAMESPACE::Interval ()); + assert (b1.min == p0 && b1.max == p1); + } + +@@ -226,7 +242,7 @@ testExtendByInterval (const char* type) + // Extend non-empty interval with non-empty interval. Starts with empty, then builds. + // + IMATH_INTERNAL_NAMESPACE::Rand32 rand (0); +- const unsigned int iters = 10; ++ const unsigned int iters = 10; + { + IMATH_INTERNAL_NAMESPACE::Interval b; + +@@ -316,7 +332,7 @@ testIntersects (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- T p (1); ++ T p (1); + + assert (!b.intersects (p)); + } +@@ -326,9 +342,9 @@ testIntersects (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b (T (-1), T (1)); +- T p0 (0); +- T p1 (5); +- T p2 (-5); ++ T p0 (0); ++ T p1 (5); ++ T p2 (-5); + + assert (b.intersects (p0)); + assert (!b.intersects (p1)); +@@ -342,8 +358,8 @@ testIntersects (const char* type) + T min (0); + T max (1); + +- T p0 (0); +- T p1 (5); ++ T p0 (0); ++ T p1 (5); + IMATH_INTERNAL_NAMESPACE::Interval b (min, max); + + assert (b.intersects (p0)); +@@ -381,8 +397,8 @@ testIntersects (const char* type) + // + { + T min (0); +- T max = min; +- max[T::dimensions() - 1] = 1; ++ T max = min; ++ max[T::dimensions () - 1] = 1; + + IMATH_INTERNAL_NAMESPACE::Interval b0; + IMATH_INTERNAL_NAMESPACE::Interval b1 (min, max); +@@ -457,7 +473,7 @@ testSize (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- assert (b.size() == T (0)); ++ assert (b.size () == T (0)); + } + + // +@@ -465,12 +481,12 @@ testSize (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b0 (T (-1), T (1)); +- assert (b0.size() == T (2)); +- ++ assert (b0.size () == T (2)); ++ + T p (42); + + IMATH_INTERNAL_NAMESPACE::Interval b1 (-p, p); +- assert (b1.size() == p * T (2)); ++ assert (b1.size () == p * T (2)); + } + + // +@@ -482,7 +498,7 @@ testSize (const char* type) + + IMATH_INTERNAL_NAMESPACE::Interval b (min, max); + +- assert (b.size() == max); ++ assert (b.size () == max); + } + } + +@@ -497,7 +513,7 @@ testCenter (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- assert (b.center() == T (0)); ++ assert (b.center () == T (0)); + } + + // +@@ -505,13 +521,13 @@ testCenter (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b0 (T (-1), T (1)); +- assert (b0.center() == T (0)); ++ assert (b0.center () == T (0)); + + T p0 (1); + T p1 (2); + + IMATH_INTERNAL_NAMESPACE::Interval b1 (p0, p1); +- assert (b1.center() == (p1 + p0) / 2); ++ assert (b1.center () == (p1 + p0) / 2); + } + + // +@@ -523,7 +539,7 @@ testCenter (const char* type) + + IMATH_INTERNAL_NAMESPACE::Interval b (min, max); + +- assert (b.center() == max / 2); ++ assert (b.center () == max / 2); + } + } + +@@ -538,7 +554,7 @@ testIsEmpty (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- assert (b.isEmpty()); ++ assert (b.isEmpty ()); + } + + // +@@ -546,12 +562,12 @@ testIsEmpty (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b0 (T (-1), T (1)); +- assert (!b0.isEmpty()); ++ assert (!b0.isEmpty ()); + +- T p0 (2); +- T p1 (4); ++ T p0 (2); ++ T p1 (4); + IMATH_INTERNAL_NAMESPACE::Interval b1 (p0, p1); +- assert (!b1.isEmpty()); ++ assert (!b1.isEmpty ()); + } + + // +@@ -563,7 +579,7 @@ testIsEmpty (const char* type) + + IMATH_INTERNAL_NAMESPACE::Interval b (min, max); + +- assert (!b.isEmpty()); ++ assert (!b.isEmpty ()); + } + } + +@@ -578,8 +594,8 @@ testIsInfinite (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- b.makeInfinite(); +- assert (b.isInfinite()); ++ b.makeInfinite (); ++ assert (b.isInfinite ()); + } + + // +@@ -587,13 +603,13 @@ testIsInfinite (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b0 (T (-1), T (1)); +- assert (!b0.isInfinite()); ++ assert (!b0.isInfinite ()); + + T p0 (2); + T p1 (4); + + IMATH_INTERNAL_NAMESPACE::Interval b1 (p0, p1); +- assert (!b1.isInfinite()); ++ assert (!b1.isInfinite ()); + } + + // +@@ -605,7 +621,7 @@ testIsInfinite (const char* type) + + IMATH_INTERNAL_NAMESPACE::Interval b (min, max); + +- assert (!b.isInfinite()); ++ assert (!b.isInfinite ()); + } + } + +@@ -620,7 +636,7 @@ testHasVolume (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- assert (!b.hasVolume()); ++ assert (!b.hasVolume ()); + } + + // +@@ -628,8 +644,8 @@ testHasVolume (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b; +- b.makeInfinite(); +- assert (b.hasVolume()); ++ b.makeInfinite (); ++ assert (b.hasVolume ()); + } + + // +@@ -637,13 +653,13 @@ testHasVolume (const char* type) + // + { + IMATH_INTERNAL_NAMESPACE::Interval b0 (T (-1), T (1)); +- assert (b0.hasVolume()); ++ assert (b0.hasVolume ()); + + T p0 (2); + T p1 (4); + + IMATH_INTERNAL_NAMESPACE::Interval b1 (p0, p1); +- assert (b1.hasVolume()); ++ assert (b1.hasVolume ()); + } + + // +@@ -654,8 +670,8 @@ testHasVolume (const char* type) + T max (2); + + IMATH_INTERNAL_NAMESPACE::Interval b (min, max); +- b.makeEmpty(); +- assert (!b.hasVolume()); ++ b.makeEmpty (); ++ assert (!b.hasVolume ()); + } + } + +@@ -667,21 +683,21 @@ testStream (const char* type) + + T min (0); + T max (1); +- ++ + IMATH_INTERNAL_NAMESPACE::Interval b (min, max); +- std::stringstream s1; ++ std::stringstream s1; + s1 << '(' << min << ' ' << max << ')'; + + std::stringstream s2; + s2 << b; + +- assert (s1.str() == s2.str()); ++ assert (s1.str () == s2.str ()); + } + + } // anonymous namespace + + void +-testInterval() ++testInterval () + { + cout << "Testing interval methods" << endl; + +@@ -708,7 +724,7 @@ testInterval() + testMakeInfinite ("int"); + testMakeInfinite ("float"); + testMakeInfinite ("double"); +- ++ + // + // extendBy() (point) + // +@@ -764,7 +780,7 @@ testInterval() + testIsInfinite ("int"); + testIsInfinite ("float"); + testIsInfinite ("double"); +- ++ + // + // hasVolume() + // +diff --git a/src/ImathTest/testInterval.h b/src/ImathTest/testInterval.h +index fefbe7b..37f1cea 100644 +--- a/src/ImathTest/testInterval.h ++++ b/src/ImathTest/testInterval.h +@@ -2,4 +2,4 @@ + // SPDX-License-Identifier: BSD-3-Clause + // Copyright Contributors to the OpenEXR Project. + // +-void testInterval(); ++void testInterval (); +diff --git a/src/ImathTest/testInvert.cpp b/src/ImathTest/testInvert.cpp +index 4b8fbdf..1f8c5ef 100644 +--- a/src/ImathTest/testInvert.cpp ++++ b/src/ImathTest/testInvert.cpp +@@ -7,11 +7,11 @@ + # undef NDEBUG + #endif + ++#include "testInvert.h" + #include + #include + #include + #include +-#include "testInvert.h" + + using namespace std; + using namespace IMATH_INTERNAL_NAMESPACE; +@@ -20,10 +20,10 @@ namespace + { + + void +-invertM44f (const M44f &m, float e) ++invertM44f (const M44f& m, float e) + { +- M44f inv1 = m.inverse(); +- M44f inv2 = m.gjInverse(); ++ M44f inv1 = m.inverse (); ++ M44f inv2 = m.gjInverse (); + M44f ident1 = m * inv1; + M44f ident2 = m * inv2; + +@@ -35,12 +35,11 @@ invertM44f (const M44f &m, float e) + assert (ident2.equalWithAbsError (identity44f, e)); + } + +- + void +-invertM33f (const M33f &m, float e) ++invertM33f (const M33f& m, float e) + { +- M33f inv1 = m.inverse(); +- M33f inv2 = m.gjInverse(); ++ M33f inv1 = m.inverse (); ++ M33f inv2 = m.gjInverse (); + M33f ident1 = m * inv1; + M33f ident2 = m * inv2; + +@@ -52,17 +51,15 @@ invertM33f (const M33f &m, float e) + assert (ident2.equalWithAbsError (identity33f, e)); + } + +- + } // namespace + +- + void + testInvert () + { + cout << "Testing 4x4 and 3x3 matrix inversion:" << endl; + + { +- cout << "M44f" << endl; ++ cout << "M44f" << endl; + + // clang-format off + +@@ -93,15 +90,15 @@ testInvert () + + // 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-6); ++ invertM44f (m5, 1e-6); + } + + { +- cout << "M33f" << endl; ++ cout << "M33f" << endl; + + // clang-format off + +@@ -127,11 +124,11 @@ testInvert () + + // 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-6); ++ invertM33f (m5, 1e-6); + } + + cout << "ok\n" << endl; +diff --git a/src/ImathTest/testInvert.h b/src/ImathTest/testInvert.h +index 2f27f17..aa5b12a 100644 +--- a/src/ImathTest/testInvert.h ++++ b/src/ImathTest/testInvert.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testInvert(); ++void testInvert (); +diff --git a/src/ImathTest/testJacobiEigenSolver.cpp b/src/ImathTest/testJacobiEigenSolver.cpp +index 9fef124..8c202e0 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 (size_t i = 0; i < TM::dimensions (); ++i) ++ for (size_t 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); +@@ -73,222 +73,229 @@ verifyOrthonormal (const TM& A, const typename TM::BaseType threshold) + + template + typename TM::BaseType +-computeThreshold(const TM& A) ++computeThreshold (const TM& A) + { +- typedef typename TM::BaseType T; +- T maxAbsEntry(0); ++ 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 (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])); + +- const T eps = std::numeric_limits::epsilon(); +- maxAbsEntry = std::max(maxAbsEntry, eps); ++ const T eps = std::numeric_limits::epsilon (); ++ maxAbsEntry = std::max (maxAbsEntry, eps); + +- return maxAbsEntry * T(100) * eps; ++ return maxAbsEntry * T (100) * eps; + } + +-template ++template + void +-testJacobiEigenSolver(const TM& A) ++testJacobiEigenSolver (const TM& A) + { + using std::abs; + +- typedef typename TM::BaseType T; ++ typedef typename TM::BaseType T; + typedef typename TM::BaseVecType TV; + +- const T threshold = computeThreshold(A); ++ const T threshold = computeThreshold (A); + +- TM AA(A); ++ TM AA (A); + TV S; + TM V; + +- jacobiEigenSolver(AA, S, V); ++ jacobiEigenSolver (AA, S, V); + + // Orthogonality of V +- verifyOrthonormal(V, threshold); +- ++ verifyOrthonormal (V, threshold); ++ + // Determinant of V +- assert(abs(V.determinant()) - 1 < threshold); ++ assert (abs (V.determinant ()) - 1 < threshold); + + // 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 (size_t i = 0; i < TM::dimensions (); ++i) ++ for (size_t j = 0; j < TM::dimensions (); ++j) ++ if (i == j) + MS[i][j] = S[i]; + else + MS[i][j] = 0; + +- assert (abs (A.determinant()) - abs (MS.determinant()) < threshold); ++ assert (abs (A.determinant ()) - abs (MS.determinant ()) < threshold); + + // A = V * S * V^T +- TM MA = V * MS * V.transposed(); ++ 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 (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); + } + +-template ++template + void +-testMinMaxEigenValue(const TM& A) ++testMinMaxEigenValue (const TM& A) + { +- typedef typename TM::BaseVecType TV; +- typedef typename TM::BaseType T; +- +- TV minV, maxV, S; +- TM U, V; +- +- const T threshold = computeThreshold(A); +- +- { +- TM A1(A); +- minEigenVector(A1, minV); +- TM A2(A); +- maxEigenVector(A2, maxV); +- } +- { +- TM A3(A); +- jacobiSVD(A3, U, S, V); +- } +- +- const int dim = TM::dimensions(); ++ typedef typename TM::BaseVecType TV; ++ typedef typename TM::BaseType T; ++ ++ TV minV, maxV, S; ++ TM U, V; ++ ++ const T threshold = computeThreshold (A); ++ ++ { ++ TM A1 (A); ++ minEigenVector (A1, minV); ++ TM A2 (A); ++ maxEigenVector (A2, maxV); ++ } ++ { ++ TM A3 (A); ++ jacobiSVD (A3, U, S, V); ++ } ++ ++ const int dim = TM::dimensions (); + + for (int i = 0; i < dim; ++i) + { +- assert(abs(minV[i]-V[i][dim - 1]) < threshold); +- assert(abs(maxV[i]-V[i][0]) < threshold); +- } ++ assert (abs (minV[i] - V[i][dim - 1]) < threshold); ++ assert (abs (maxV[i] - V[i][0]) < threshold); ++ } + } + + template + void +-testJacobiTiming() ++testJacobiTiming () + { + +- int rounds(100000); +- clock_t tJacobi,tSVD, t; ++ int rounds (100000); ++ clock_t tJacobi, tSVD, t; + + { +- Matrix33 A,V,U; +- Vec3 S; ++ Matrix33 A, V, U; ++ Vec3 S; + +- t = clock(); ++ t = clock (); + for (int i = 0; i < rounds; ++i) + { +- A = Matrix33(A33_7); +- jacobiEigenSolver(A, S, V); +- A = Matrix33(A33_8); +- jacobiEigenSolver(A, S, V); ++ A = Matrix33 (A33_7); ++ jacobiEigenSolver (A, S, V); ++ A = Matrix33 (A33_8); ++ jacobiEigenSolver (A, S, V); + } +- tJacobi = clock() - t; +- cout << "Jacobi EigenSolver of 3x3 matrices took " << tJacobi << " clocks." << endl; ++ tJacobi = clock () - t; ++ cout << "Jacobi EigenSolver of 3x3 matrices took " << tJacobi ++ << " clocks." << endl; + +- t = clock(); ++ t = clock (); + for (int i = 0; i < rounds; ++i) + { +- A = Matrix33(A33_7); +- jacobiSVD(A, U, S, V); +- A = Matrix33(A33_8); +- jacobiSVD(A, U, S, V); ++ A = Matrix33 (A33_7); ++ jacobiSVD (A, U, S, V); ++ A = Matrix33 (A33_8); ++ jacobiSVD (A, U, S, V); + } +- tSVD = clock() - t; +- cout << "TinySVD of 3x3 matrices took " << tSVD << " clocks." << endl; +- cout << (float)(tSVD-tJacobi)*100.0f/(float)(tSVD) << "% speed up." << endl; ++ tSVD = clock () - t; ++ cout << "TinySVD of 3x3 matrices took " << tSVD << " clocks." ++ << endl; ++ cout << (float) (tSVD - tJacobi) * 100.0f / (float) (tSVD) ++ << "% speed up." << endl; + } + + { +- Matrix44 A,V,U; +- Vec4 S; ++ Matrix44 A, V, U; ++ Vec4 S; + +- t = clock(); ++ t = clock (); + for (int i = 0; i < rounds; ++i) + { +- A = Matrix44(A44_7); +- jacobiEigenSolver(A, S, V); +- A = Matrix44(A44_8); +- jacobiEigenSolver(A, S, V); ++ A = Matrix44 (A44_7); ++ jacobiEigenSolver (A, S, V); ++ A = Matrix44 (A44_8); ++ jacobiEigenSolver (A, S, V); + } +- tJacobi = clock() - t; +- cout << "Jacobi EigenSolver of 4x4 matrices took " << tJacobi << " clocks" << endl; ++ tJacobi = clock () - t; ++ cout << "Jacobi EigenSolver of 4x4 matrices took " << tJacobi ++ << " clocks" << endl; + +- t = clock(); ++ t = clock (); + for (int i = 0; i < rounds; ++i) + { +- A = Matrix44(A44_7); +- jacobiSVD(A, U, S, V); +- A = Matrix44(A44_8); +- jacobiSVD(A, U, S, V); ++ A = Matrix44 (A44_7); ++ jacobiSVD (A, U, S, V); ++ A = Matrix44 (A44_8); ++ jacobiSVD (A, U, S, V); + } +- tSVD = clock() - t; +- cout << "TinySVD of 4x4 matrices took " << tSVD << " clocks" << endl; +- cout << (float)(tSVD-tJacobi)*100.0f/(float)(tSVD) << "% speed up." << endl; ++ tSVD = clock () - t; ++ cout << "TinySVD of 4x4 matrices took " << tSVD << " clocks" ++ << endl; ++ cout << (float) (tSVD - tJacobi) * 100.0f / (float) (tSVD) ++ << "% speed up." << endl; + } + } + + template + void +-testJacobiEigenSolverImp() ++testJacobiEigenSolverImp () + { +- testJacobiEigenSolver(Matrix33(A33_1)); +- testJacobiEigenSolver(Matrix33(A33_2)); +- testJacobiEigenSolver(Matrix33(A33_3)); +- testJacobiEigenSolver(Matrix33(A33_4)); +- testJacobiEigenSolver(Matrix33(A33_5)); +- testJacobiEigenSolver(Matrix33(A33_6)); +- testJacobiEigenSolver(Matrix33(A33_7)); +- testJacobiEigenSolver(Matrix33(A33_8)); +- +- testJacobiEigenSolver(Matrix44(A44_1)); +- testJacobiEigenSolver(Matrix44(A44_2)); +- testJacobiEigenSolver(Matrix44(A44_3)); +- testJacobiEigenSolver(Matrix44(A44_4)); +- testJacobiEigenSolver(Matrix44(A44_5)); +- testJacobiEigenSolver(Matrix44(A44_6)); +- testJacobiEigenSolver(Matrix44(A44_7)); +- testJacobiEigenSolver(Matrix44(A44_8)); ++ testJacobiEigenSolver (Matrix33 (A33_1)); ++ testJacobiEigenSolver (Matrix33 (A33_2)); ++ testJacobiEigenSolver (Matrix33 (A33_3)); ++ testJacobiEigenSolver (Matrix33 (A33_4)); ++ testJacobiEigenSolver (Matrix33 (A33_5)); ++ testJacobiEigenSolver (Matrix33 (A33_6)); ++ testJacobiEigenSolver (Matrix33 (A33_7)); ++ testJacobiEigenSolver (Matrix33 (A33_8)); ++ ++ testJacobiEigenSolver (Matrix44 (A44_1)); ++ testJacobiEigenSolver (Matrix44 (A44_2)); ++ testJacobiEigenSolver (Matrix44 (A44_3)); ++ testJacobiEigenSolver (Matrix44 (A44_4)); ++ testJacobiEigenSolver (Matrix44 (A44_5)); ++ testJacobiEigenSolver (Matrix44 (A44_6)); ++ testJacobiEigenSolver (Matrix44 (A44_7)); ++ testJacobiEigenSolver (Matrix44 (A44_8)); + } + + template + void +-testMinMaxEigenValueImp() ++testMinMaxEigenValueImp () + { +- testMinMaxEigenValue(Matrix33(A33_7)); +- testMinMaxEigenValue(Matrix33(A33_8)); ++ testMinMaxEigenValue (Matrix33 (A33_7)); ++ testMinMaxEigenValue (Matrix33 (A33_8)); + +- testMinMaxEigenValue(Matrix44(A44_7)); +- testMinMaxEigenValue(Matrix44(A44_8)); ++ testMinMaxEigenValue (Matrix44 (A44_7)); ++ testMinMaxEigenValue (Matrix44 (A44_8)); + } + + void +-testJacobiEigenSolver() ++testJacobiEigenSolver () + { + cout << endl; +- cout << "************ Testing IMATH_INTERNAL_NAMESPACE::ImathJacobiEigenSolver ************" +- << endl; +- ++ cout ++ << "************ Testing IMATH_INTERNAL_NAMESPACE::ImathJacobiEigenSolver ************" ++ << endl; ++ + cout << "Jacobi EigenSolver in single precision..."; +- testJacobiEigenSolverImp(); ++ testJacobiEigenSolverImp (); + cout << "PASS" << endl; + + cout << "Jacobi EigenSolver in double precision..."; +- testJacobiEigenSolverImp(); ++ testJacobiEigenSolverImp (); + cout << "PASS" << endl; + + cout << "Min/Max EigenValue in single precision..."; +- testMinMaxEigenValueImp(); ++ testMinMaxEigenValueImp (); + cout << "PASS" << endl; + + cout << "Min/Max EigenValue in double precision..."; +- testMinMaxEigenValueImp(); ++ testMinMaxEigenValueImp (); + cout << "PASS" << endl; + + cout << "Timing Jacobi EigenSolver in single precision...\n"; +- testJacobiTiming(); ++ testJacobiTiming (); + + cout << "Timing Jacobi EigenSolver in double precision...\n"; +- testJacobiTiming(); +- ++ testJacobiTiming (); ++ + cout << "************ ALL PASS ************" << endl; + } +diff --git a/src/ImathTest/testJacobiEigenSolver.h b/src/ImathTest/testJacobiEigenSolver.h +index 2e9dbcd..e7b7bd9 100644 +--- a/src/ImathTest/testJacobiEigenSolver.h ++++ b/src/ImathTest/testJacobiEigenSolver.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testJacobiEigenSolver(); ++void testJacobiEigenSolver (); +diff --git a/src/ImathTest/testLimits.cpp b/src/ImathTest/testLimits.cpp +index 5372d59..994b474 100644 +--- a/src/ImathTest/testLimits.cpp ++++ b/src/ImathTest/testLimits.cpp +@@ -7,11 +7,11 @@ + # undef NDEBUG + #endif + ++#include "testLimits.h" + #include "halfLimits.h" + #include + #include + #include +-#include "testLimits.h" + + using namespace std; + +@@ -37,8 +37,7 @@ mypow (int x, int y) + y -= 1; + } + +- if (negative) +- z = 1 / z; ++ if (negative) z = 1 / z; + + return z; + } +@@ -46,7 +45,7 @@ mypow (int x, int y) + } // namespace + + void +-testLimits() ++testLimits () + { + cout << "values in std::numeric_limits\n"; + +@@ -54,58 +53,59 @@ testLimits() + + { + half h (mypow (2, numeric_limits::min_exponent - 1)); +- assert (h.isNormalized()); ++ assert (h.isNormalized ()); + } + + { + half h (mypow (2, numeric_limits::min_exponent - 2)); +- assert (h.isDenormalized()); ++ assert (h.isDenormalized ()); + } + + cout << "max_exponent\n"; + + { + half h (mypow (2, numeric_limits::max_exponent - 1)); +- assert (h.isNormalized()); ++ assert (h.isNormalized ()); + } + + { + half h (mypow (2, numeric_limits::max_exponent)); +- assert (h.isInfinity()); ++ assert (h.isInfinity ()); + } + + cout << "min_exponent10\n"; + + { + half h (mypow (10, numeric_limits::min_exponent10)); +- assert (h.isNormalized()); ++ assert (h.isNormalized ()); + } + + { + half h (mypow (10, numeric_limits::min_exponent10 - 1)); +- assert (h.isDenormalized()); ++ assert (h.isDenormalized ()); + } + + cout << "max_exponent10\n"; + + { + half h (mypow (10, numeric_limits::max_exponent10)); +- assert (h.isNormalized()); ++ assert (h.isNormalized ()); + } + + { + half h (mypow (10, numeric_limits::max_exponent10 + 1)); +- assert (h.isInfinity()); ++ assert (h.isInfinity ()); + } + + #if __cplusplus >= 201103L + + cout << "max_digits10\n"; +- assert (numeric_limits::max_digits10 == +- std::ceil (numeric_limits::digits * std::log10 (2) + 1)); ++ assert ( ++ numeric_limits::max_digits10 == ++ std::ceil (numeric_limits::digits * std::log10 (2) + 1)); + + cout << "lowest\n"; +- assert (numeric_limits::lowest() == -HALF_MAX); ++ assert (numeric_limits::lowest () == -HALF_MAX); + + #endif + +@@ -113,40 +113,97 @@ testLimits() + } + + void +-testHalfLimits() ++testHalfLimits () + { + cout << "values in std::numeric_limits\n"; + + // For reference: +- printf("HALF_DENORM_MIN %g -> 0x%04x\n", (float)HALF_DENORM_MIN, half(HALF_DENORM_MIN).bits()); +- printf("HALF_NRM_MIN %g -> 0x%04x\n", (float)HALF_NRM_MIN, half(HALF_NRM_MIN).bits()); +- printf("HALF_MIN %g -> 0x%04x\n", (float)HALF_MIN, half(HALF_MIN).bits()); +- printf("HALF_MAX %g -> 0x%04x\n", (float)HALF_MAX, half(HALF_MAX).bits()); +- printf("HALF_LOWEST %g -> 0x%04x\n", (float)-HALF_MAX, half(-HALF_MAX).bits()); +- printf("HALF_EPSILON %g -> 0x%04x\n", (float)HALF_EPSILON, half(HALF_EPSILON).bits()); +- printf("half posInf %g -> 0x%04x\n", (float)half::posInf(), half::posInf().bits()); +- printf("half negInf %g -> 0x%04x\n", (float)half::negInf(), half::negInf().bits()); +- printf("half qNan %g -> 0x%04x\n", (float)half::qNan(), half::qNan().bits()); +- printf("half sNan %g -> 0x%04x\n", (float)half::sNan(), half::sNan().bits()); +- printf("numeric_limits min %g -> 0x%04x\n", (float)std::numeric_limits::min(), std::numeric_limits::min().bits()); +- printf("numeric_limits max %g -> 0x%04x\n", (float)std::numeric_limits::max(), std::numeric_limits::max().bits()); +- printf("numeric_limits lowest %g -> 0x%04x\n", (float)std::numeric_limits::lowest(), std::numeric_limits::lowest().bits()); +- printf("numeric_limits epsilon %g -> 0x%04x\n", (float)std::numeric_limits::epsilon(), std::numeric_limits::epsilon().bits()); +- printf("numeric_limits round_error %g -> 0x%04x\n", (float)std::numeric_limits::round_error(), std::numeric_limits::round_error().bits()); +- printf("numeric_limits infinity %g -> 0x%04x\n", (float)std::numeric_limits::infinity(), std::numeric_limits::infinity().bits()); +- printf("numeric_limits quiet_NaN %g -> 0x%04x\n", (float)std::numeric_limits::quiet_NaN(), std::numeric_limits::quiet_NaN().bits()); +- printf("numeric_limits signaling_NaN %g -> 0x%04x\n", (float)std::numeric_limits::signaling_NaN(), std::numeric_limits::signaling_NaN().bits()); +- printf("numeric_limits denorm_min %g -> 0x%04x\n", (float)std::numeric_limits::denorm_min(), std::numeric_limits::denorm_min().bits()); +- +- assert (std::numeric_limits::max() == half(HALF_MAX)); +- assert (std::numeric_limits::min() == half(HALF_NRM_MIN)); +- assert (std::numeric_limits::denorm_min() == half(HALF_DENORM_MIN)); +- assert (std::numeric_limits::lowest() == half(-HALF_MAX)); +- assert (std::numeric_limits::epsilon() == half(HALF_EPSILON)); +- assert (std::numeric_limits::infinity() == half::posInf()); +- assert (std::numeric_limits::quiet_NaN().bits() == half::qNan().bits()); +- assert (std::numeric_limits::signaling_NaN().bits() == half::sNan().bits()); +- assert (std::numeric_limits::infinity() == half::posInf()); ++ printf ( ++ "HALF_DENORM_MIN %g -> 0x%04x\n", ++ (float) HALF_DENORM_MIN, ++ half (HALF_DENORM_MIN).bits ()); ++ printf ( ++ "HALF_NRM_MIN %g -> 0x%04x\n", ++ (float) HALF_NRM_MIN, ++ half (HALF_NRM_MIN).bits ()); ++ printf ( ++ "HALF_MIN %g -> 0x%04x\n", (float) HALF_MIN, half (HALF_MIN).bits ()); ++ printf ( ++ "HALF_MAX %g -> 0x%04x\n", (float) HALF_MAX, half (HALF_MAX).bits ()); ++ printf ( ++ "HALF_LOWEST %g -> 0x%04x\n", ++ (float) -HALF_MAX, ++ half (-HALF_MAX).bits ()); ++ printf ( ++ "HALF_EPSILON %g -> 0x%04x\n", ++ (float) HALF_EPSILON, ++ half (HALF_EPSILON).bits ()); ++ printf ( ++ "half posInf %g -> 0x%04x\n", ++ (float) half::posInf (), ++ half::posInf ().bits ()); ++ printf ( ++ "half negInf %g -> 0x%04x\n", ++ (float) half::negInf (), ++ half::negInf ().bits ()); ++ printf ( ++ "half qNan %g -> 0x%04x\n", ++ (float) half::qNan (), ++ half::qNan ().bits ()); ++ printf ( ++ "half sNan %g -> 0x%04x\n", ++ (float) half::sNan (), ++ half::sNan ().bits ()); ++ printf ( ++ "numeric_limits min %g -> 0x%04x\n", ++ (float) std::numeric_limits::min (), ++ std::numeric_limits::min ().bits ()); ++ printf ( ++ "numeric_limits max %g -> 0x%04x\n", ++ (float) std::numeric_limits::max (), ++ std::numeric_limits::max ().bits ()); ++ printf ( ++ "numeric_limits lowest %g -> 0x%04x\n", ++ (float) std::numeric_limits::lowest (), ++ std::numeric_limits::lowest ().bits ()); ++ printf ( ++ "numeric_limits epsilon %g -> 0x%04x\n", ++ (float) std::numeric_limits::epsilon (), ++ std::numeric_limits::epsilon ().bits ()); ++ printf ( ++ "numeric_limits round_error %g -> 0x%04x\n", ++ (float) std::numeric_limits::round_error (), ++ std::numeric_limits::round_error ().bits ()); ++ printf ( ++ "numeric_limits infinity %g -> 0x%04x\n", ++ (float) std::numeric_limits::infinity (), ++ std::numeric_limits::infinity ().bits ()); ++ printf ( ++ "numeric_limits quiet_NaN %g -> 0x%04x\n", ++ (float) std::numeric_limits::quiet_NaN (), ++ std::numeric_limits::quiet_NaN ().bits ()); ++ printf ( ++ "numeric_limits signaling_NaN %g -> 0x%04x\n", ++ (float) std::numeric_limits::signaling_NaN (), ++ std::numeric_limits::signaling_NaN ().bits ()); ++ printf ( ++ "numeric_limits denorm_min %g -> 0x%04x\n", ++ (float) std::numeric_limits::denorm_min (), ++ std::numeric_limits::denorm_min ().bits ()); ++ ++ assert (std::numeric_limits::max () == half (HALF_MAX)); ++ assert (std::numeric_limits::min () == half (HALF_NRM_MIN)); ++ assert (std::numeric_limits::denorm_min () == half (HALF_DENORM_MIN)); ++ assert (std::numeric_limits::lowest () == half (-HALF_MAX)); ++ assert (std::numeric_limits::epsilon () == half (HALF_EPSILON)); ++ assert (std::numeric_limits::infinity () == half::posInf ()); ++ assert ( ++ std::numeric_limits::quiet_NaN ().bits () == ++ half::qNan ().bits ()); ++ assert ( ++ std::numeric_limits::signaling_NaN ().bits () == ++ half::sNan ().bits ()); ++ assert (std::numeric_limits::infinity () == half::posInf ()); + + cout << "ok\n\n" << flush; + } +diff --git a/src/ImathTest/testLimits.h b/src/ImathTest/testLimits.h +index 309aa60..f91d944 100644 +--- a/src/ImathTest/testLimits.h ++++ b/src/ImathTest/testLimits.h +@@ -3,5 +3,5 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testLimits(); +-void testHalfLimits(); ++void testLimits (); ++void testHalfLimits (); +diff --git a/src/ImathTest/testLineAlgo.cpp b/src/ImathTest/testLineAlgo.cpp +index 9872ac9..503f4a6 100644 +--- a/src/ImathTest/testLineAlgo.cpp ++++ b/src/ImathTest/testLineAlgo.cpp +@@ -7,11 +7,11 @@ + # undef NDEBUG + #endif + ++#include "testLineAlgo.h" + #include + #include + #include + #include +-#include "testLineAlgo.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -23,74 +23,81 @@ namespace + { + + void +-testClosestPoints (const Line3f& line1, +- const Line3f& line2, +- bool returnValue, +- const V3f& point1, +- const V3f& point2) ++testClosestPoints ( ++ const Line3f& line1, ++ const Line3f& line2, ++ bool returnValue, ++ const V3f& point1, ++ const V3f& point2) + { +- V3f p1; +- V3f p2; ++ V3f p1; ++ V3f p2; + bool rv = closestPoints (line1, line2, p1, p2); + + assert (rv == returnValue); + + if (rv) + { +- float e = 10 * std::numeric_limits::epsilon(); ++ float e = 10 * std::numeric_limits::epsilon (); + assert (point1.equalWithAbsError (p1, e)); + assert (point2.equalWithAbsError (p2, e)); + } + } + + void +-testClosestPoints() ++testClosestPoints () + { + cout << "closest points on two lines" << endl; + + cout << " non-intersecting, non-parallel lines" << endl; + +- testClosestPoints (Line3f (V3f (0, -1, -1), V3f (0, 1, -1)), +- Line3f (V3f (-1, 0, 1), V3f (1, 0, 1)), +- true, +- V3f (0, 0, -1), +- V3f (0, 0, 1)); ++ testClosestPoints ( ++ Line3f (V3f (0, -1, -1), V3f (0, 1, -1)), ++ Line3f (V3f (-1, 0, 1), V3f (1, 0, 1)), ++ true, ++ V3f (0, 0, -1), ++ V3f (0, 0, 1)); + +- testClosestPoints (Line3f (V3f (2, -1, -1), V3f (2, 1, -1)), +- Line3f (V3f (-1, 3, 1), V3f (1, 3, 1)), +- true, +- V3f (2, 3, -1), +- V3f (2, 3, 1)); ++ testClosestPoints ( ++ Line3f (V3f (2, -1, -1), V3f (2, 1, -1)), ++ Line3f (V3f (-1, 3, 1), V3f (1, 3, 1)), ++ true, ++ V3f (2, 3, -1), ++ V3f (2, 3, 1)); + + cout << " intersecting, non-parallel lines" << endl; + +- testClosestPoints (Line3f (V3f (2, -1, 0), V3f (2, 1, 0)), +- Line3f (V3f (-1, 3, 0), V3f (1, 3, 0)), +- true, +- V3f (2, 3, 0), +- V3f (2, 3, 0)); ++ testClosestPoints ( ++ Line3f (V3f (2, -1, 0), V3f (2, 1, 0)), ++ Line3f (V3f (-1, 3, 0), V3f (1, 3, 0)), ++ true, ++ V3f (2, 3, 0), ++ V3f (2, 3, 0)); + + cout << " parallel lines" << endl; + +- testClosestPoints (Line3f (V3f (2, -1, 0), V3f (2, 1, 0)), +- Line3f (V3f (2, -1, 1), V3f (2, 1, 1)), +- false, +- V3f (0, 0, 0), +- V3f (0, 0, 0)); ++ testClosestPoints ( ++ Line3f (V3f (2, -1, 0), V3f (2, 1, 0)), ++ Line3f (V3f (2, -1, 1), V3f (2, 1, 1)), ++ false, ++ V3f (0, 0, 0), ++ V3f (0, 0, 0)); + +- testClosestPoints (Line3f (V3f (2, -1, 0), V3f (2, 1, 0)), +- Line3f (V3f (2, 1, 1), V3f (2, -1, 1)), +- false, +- V3f (0, 0, 0), +- V3f (0, 0, 0)); ++ testClosestPoints ( ++ Line3f (V3f (2, -1, 0), V3f (2, 1, 0)), ++ Line3f (V3f (2, 1, 1), V3f (2, -1, 1)), ++ false, ++ V3f (0, 0, 0), ++ V3f (0, 0, 0)); + + cout << " coincident lines" << endl; + +- testClosestPoints (Line3f (V3f (2, -1, 0), V3f (2, -1, 1)), +- Line3f (V3f (2, -1, 0), V3f (2, -1, 1)), +- false, +- V3f (0, 0, 0), +- V3f (0, 0, 0)); ++ testClosestPoints ( ++ Line3f (V3f (2, -1, 0), V3f (2, -1, 1)), ++ Line3f (V3f (2, -1, 0), V3f (2, -1, 1)), ++ false, ++ V3f (0, 0, 0), ++ V3f (0, 0, 0)); + + cout << " random lines" << endl; + +@@ -98,12 +105,16 @@ testClosestPoints() + + for (int i = 0; i < 10000; ++i) + { +- Line3f line1 (solidSphereRand (rand) * 100.f, solidSphereRand (rand) * 100.f); ++ Line3f line1 ( ++ solidSphereRand (rand) * 100.f, ++ solidSphereRand (rand) * 100.f); + +- Line3f line2 (solidSphereRand (rand) * 100.f, solidSphereRand (rand) * 100.f); ++ Line3f line2 ( ++ solidSphereRand (rand) * 100.f, ++ solidSphereRand (rand) * 100.f); + +- V3f point1; +- V3f point2; ++ V3f point1; ++ V3f point2; + bool rv = closestPoints (line1, line2, point1, point2); + + if (rv) +@@ -117,9 +128,9 @@ testClosestPoints() + // close to parallel. + // + +- float e = 2000 * std::numeric_limits::epsilon(); ++ float e = 2000 * std::numeric_limits::epsilon (); + float d = 1 - (line1.dir ^ line2.dir) * (line1.dir ^ line2.dir); +- V3f n = point1 - point2; ++ V3f n = point1 - point2; + + assert (equalWithAbsError (0.0f, (line1.dir ^ n) * d, e)); + assert (equalWithAbsError (0.0f, (line2.dir ^ n) * d, e)); +@@ -128,23 +139,24 @@ testClosestPoints() + } + + void +-testIntersect (const Line3f& line, +- const V3f& v0, +- const V3f& v1, +- const V3f& v2, +- const V3f& point, +- bool front, +- bool returnValue) ++testIntersect ( ++ const Line3f& line, ++ const V3f& v0, ++ const V3f& v1, ++ const V3f& v2, ++ const V3f& point, ++ bool front, ++ bool returnValue) + { +- V3f pt; +- V3f bary; ++ V3f pt; ++ V3f bary; + bool fr; + + bool rv = intersect (line, v0, v1, v2, pt, bary, fr); + + assert (rv == returnValue); + +- float e = 10 * std::numeric_limits::epsilon(); ++ float e = 10 * std::numeric_limits::epsilon (); + + if (rv) + { +@@ -156,161 +168,179 @@ testIntersect (const Line3f& line, + } + + void +-testIntersect() ++testIntersect () + { + cout << "line-triangle intersection" << endl; + + cout << " line-plane intersection inside triangle" << endl; + +- testIntersect (Line3f (V3f (0, 0, -1), V3f (0, 0, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 7), +- true, +- true); +- +- testIntersect (Line3f (V3f (0, 0, -1), V3f (-1, -2, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (-1, -2, 7), +- true, +- true); +- +- testIntersect (Line3f (V3f (0, 0, -1), V3f (-1, 1, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (-1, 1, 7), +- true, +- true); +- +- testIntersect (Line3f (V3f (0, 0, -1), V3f (-1, 1, 7)), +- V3f (4, -4, 7), +- V3f (-4, -4, 7), +- V3f (0, 6, 7), +- V3f (-1, 1, 7), +- false, +- true); +- +- testIntersect (Line3f (V3f (1, 1, 2), V3f (0, 0, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 7), +- true, +- true); +- +- testIntersect (Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (-1, -2, 7), +- true, +- true); +- +- testIntersect (Line3f (V3f (2, 8, -10), V3f (-1, 1, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (-1, 1, 7), +- true, +- true); +- +- testIntersect (Line3f (V3f (-10, 2, -1), V3f (-1, 1, 7)), +- V3f (4, -4, 7), +- V3f (-4, -4, 7), +- V3f (0, 6, 7), +- V3f (-1, 1, 7), +- false, +- true); ++ testIntersect ( ++ Line3f (V3f (0, 0, -1), V3f (0, 0, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 7), ++ true, ++ true); ++ ++ testIntersect ( ++ Line3f (V3f (0, 0, -1), V3f (-1, -2, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (-1, -2, 7), ++ true, ++ true); ++ ++ testIntersect ( ++ Line3f (V3f (0, 0, -1), V3f (-1, 1, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (-1, 1, 7), ++ true, ++ true); ++ ++ testIntersect ( ++ Line3f (V3f (0, 0, -1), V3f (-1, 1, 7)), ++ V3f (4, -4, 7), ++ V3f (-4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (-1, 1, 7), ++ false, ++ true); ++ ++ testIntersect ( ++ Line3f (V3f (1, 1, 2), V3f (0, 0, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 7), ++ true, ++ true); ++ ++ testIntersect ( ++ Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (-1, -2, 7), ++ true, ++ true); ++ ++ testIntersect ( ++ Line3f (V3f (2, 8, -10), V3f (-1, 1, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (-1, 1, 7), ++ true, ++ true); ++ ++ testIntersect ( ++ Line3f (V3f (-10, 2, -1), V3f (-1, 1, 7)), ++ V3f (4, -4, 7), ++ V3f (-4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (-1, 1, 7), ++ false, ++ true); + + cout << " line-plane intersection outside triangle" << endl; + +- testIntersect (Line3f (V3f (0, 0, -1), V3f (4, 0, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 0), +- false, +- false); +- +- testIntersect (Line3f (V3f (0, 0, -1), V3f (-4, 1, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 0), +- false, +- false); +- +- testIntersect (Line3f (V3f (0, 0, -1), V3f (0, -5, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 0), +- false, +- false); +- +- testIntersect (Line3f (V3f (0, 0, -1), V3f (0, -7, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 0), +- false, +- false); ++ testIntersect ( ++ Line3f (V3f (0, 0, -1), V3f (4, 0, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 0), ++ false, ++ false); ++ ++ testIntersect ( ++ Line3f (V3f (0, 0, -1), V3f (-4, 1, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 0), ++ false, ++ false); ++ ++ testIntersect ( ++ Line3f (V3f (0, 0, -1), V3f (0, -5, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 0), ++ false, ++ false); ++ ++ testIntersect ( ++ Line3f (V3f (0, 0, -1), V3f (0, -7, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 0), ++ false, ++ false); + + cout << " line parallel to triangle" << endl; + +- testIntersect (Line3f (V3f (0, 0, -1), V3f (4, 0, -1)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 0), +- false, +- false); +- +- testIntersect (Line3f (V3f (0, 4, 7), V3f (4, 0, 7)), +- V3f (-4, -4, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 0), +- false, +- false); ++ testIntersect ( ++ Line3f (V3f (0, 0, -1), V3f (4, 0, -1)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 0), ++ false, ++ false); ++ ++ testIntersect ( ++ Line3f (V3f (0, 4, 7), V3f (4, 0, 7)), ++ V3f (-4, -4, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 0), ++ false, ++ false); + + cout << " zero-area triangle" << endl; + +- testIntersect (Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), +- V3f (0, 6, 7), +- V3f (4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 0), +- false, +- false); +- +- testIntersect (Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), +- V3f (-4, -4, 7), +- V3f (-4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 0), +- false, +- false); +- +- testIntersect (Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), +- V3f (-4, -4, 7), +- V3f (0, 6, 7), +- V3f (0, 6, 7), +- V3f (0, 0, 0), +- false, +- false); +- +- testIntersect (Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), +- V3f (-4, -4, 7), +- V3f (-4, -4, 7), +- V3f (-4, -4, 7), +- V3f (0, 0, 0), +- false, +- false); ++ testIntersect ( ++ Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), ++ V3f (0, 6, 7), ++ V3f (4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 0), ++ false, ++ false); ++ ++ testIntersect ( ++ Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), ++ V3f (-4, -4, 7), ++ V3f (-4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 0), ++ false, ++ false); ++ ++ testIntersect ( ++ Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), ++ V3f (-4, -4, 7), ++ V3f (0, 6, 7), ++ V3f (0, 6, 7), ++ V3f (0, 0, 0), ++ false, ++ false); ++ ++ testIntersect ( ++ Line3f (V3f (2, 3, -5), V3f (-1, -2, 7)), ++ V3f (-4, -4, 7), ++ V3f (-4, -4, 7), ++ V3f (-4, -4, 7), ++ V3f (0, 0, 0), ++ false, ++ false); + + cout << " random lines and triangles" << endl; + +@@ -331,7 +361,7 @@ testIntersect() + v1 = solidSphereRand (rand); + v2 = solidSphereRand (rand); + normal = (v2 - v1) % (v1 - v0); +- } while (normal.length() < 0.01); ++ } while (normal.length () < 0.01); + + { + // +@@ -354,22 +384,24 @@ testIntersect() + do + { + p0 = solidSphereRand (rand); +- } while (abs (normal.normalized() ^ (p1 - p0).normalized()) < 0.1); ++ } while (abs (normal.normalized () ^ (p1 - p0).normalized ()) < ++ 0.1); + + // + // Test for intersection + // + +- V3f point; +- V3f bary; ++ V3f point; ++ V3f bary; + bool front; + +- bool rv = intersect (Line3f (p0, p1), v0, v1, v2, point, bary, front); ++ bool rv = ++ intersect (Line3f (p0, p1), v0, v1, v2, point, bary, front); + + assert (rv == true); + +- float nd = abs (normal.normalized() ^ (p1 - p0).normalized()); +- float ep = 20 * std::numeric_limits::epsilon() / nd; ++ float nd = abs (normal.normalized () ^ (p1 - p0).normalized ()); ++ float ep = 20 * std::numeric_limits::epsilon () / nd; + + assert (point.equalWithAbsError (p1, ep)); + } +@@ -396,17 +428,19 @@ testIntersect() + do + { + p0 = solidSphereRand (rand) * 10; +- } while (abs (normal.normalized() ^ (p1 - p0).normalized()) < 0.1); ++ } while (abs (normal.normalized () ^ (p1 - p0).normalized ()) < ++ 0.1); + + // + // Test for intersection + // + +- V3f point; +- V3f bary; ++ V3f point; ++ V3f bary; + bool front; + +- bool rv = intersect (Line3f (p0, p1), v0, v1, v2, point, bary, front); ++ bool rv = ++ intersect (Line3f (p0, p1), v0, v1, v2, point, bary, front); + + assert (rv == false); + } +@@ -416,12 +450,12 @@ testIntersect() + } // namespace + + void +-testLineAlgo() ++testLineAlgo () + { + cout << "Testing line algorithms" << endl; + +- testClosestPoints(); +- testIntersect(); ++ testClosestPoints (); ++ testIntersect (); + + cout << "ok\n" << endl; + } +diff --git a/src/ImathTest/testLineAlgo.h b/src/ImathTest/testLineAlgo.h +index bfd81ca..274dd24 100644 +--- a/src/ImathTest/testLineAlgo.h ++++ b/src/ImathTest/testLineAlgo.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testLineAlgo(); ++void testLineAlgo (); +diff --git a/src/ImathTest/testMatrix.cpp b/src/ImathTest/testMatrix.cpp +index 9fecbcb..8d37fee 100644 +--- a/src/ImathTest/testMatrix.cpp ++++ b/src/ImathTest/testMatrix.cpp +@@ -7,6 +7,7 @@ + # undef NDEBUG + #endif + ++#include "testMatrix.h" + #include + #include + #include +@@ -15,7 +16,6 @@ + #include + #include + #include +-#include "testMatrix.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -34,20 +34,20 @@ using IMATH_INTERNAL_NAMESPACE::Int64; + // + + void +-testMatrix() ++testMatrix () + { + cout << "Testing functions in ImathMatrix.h" << endl; + + union + { + float f; +- int i; ++ int i; + } nanf; + nanf.i = 0x7f800001; // NAN + + union + { +- double d; ++ double d; + uint64_t i; + } nand; + nand.i = 0x7ff0000000000001ULL; // NAN +@@ -66,7 +66,7 @@ testMatrix() + assert (test != test2); + + IMATH_INTERNAL_NAMESPACE::M22f test3; +- test3.makeIdentity(); ++ test3.makeIdentity (); + assert (test2 == test3); + } + +@@ -84,12 +84,13 @@ testMatrix() + assert (test != test2); + + IMATH_INTERNAL_NAMESPACE::M22d test3; +- test3.makeIdentity(); ++ test3.makeIdentity (); + assert (test2 == test3); + + IMATH_INTERNAL_NAMESPACE::M22f test4 (1.0f, 2.0f, 3.0f, 4.0f); + +- IMATH_INTERNAL_NAMESPACE::M22d test5 = IMATH_INTERNAL_NAMESPACE::M22d (test4); ++ IMATH_INTERNAL_NAMESPACE::M22d test5 = ++ IMATH_INTERNAL_NAMESPACE::M22d (test4); + + assert (test5[0][0] == 1.0); + assert (test5[0][1] == 2.0); +@@ -103,17 +104,17 @@ testMatrix() + + IMATH_INTERNAL_NAMESPACE::M22f m1 (3.0f, 3.0f, 5.0f, 5.0f); + IMATH_INTERNAL_NAMESPACE::M22f m2 = m1; +- assert(m1.inverse(false) == m1.inverse()); +- m2.invert(false); +- m1.invert(); +- assert(m1 == m2); ++ assert (m1.inverse (false) == m1.inverse ()); ++ m2.invert (false); ++ m1.invert (); ++ assert (m1 == m2); + + IMATH_INTERNAL_NAMESPACE::M22f m3 (4.0f, 7.0f, 2.0f, 6.0f); + m2 = m3; +- assert(m2.inverse(true) == m2.inverse()); +- m3.invert(true); +- m2.invert(); +- assert(m3 == m2); ++ assert (m2.inverse (true) == m2.inverse ()); ++ m3.invert (true); ++ m2.invert (); ++ assert (m3 == m2); + } + + { +@@ -121,24 +122,28 @@ testMatrix() + + IMATH_INTERNAL_NAMESPACE::M33f m1, m2; + m1.setShear (2.0f); +- assert (m1[0][0] == 1.0f && m1[0][1] == 0.0f && m1[0][2] == 0.0f && m1[1][0] == 2.0f && +- m1[1][1] == 1.0f && m1[1][2] == 0.0f && m1[2][0] == 0.0f && m1[2][1] == 0.0f && +- m1[2][2] == 1.0f); ++ assert ( ++ m1[0][0] == 1.0f && m1[0][1] == 0.0f && m1[0][2] == 0.0f && ++ m1[1][0] == 2.0f && m1[1][1] == 1.0f && m1[1][2] == 0.0f && ++ m1[2][0] == 0.0f && m1[2][1] == 0.0f && m1[2][2] == 1.0f); + + m2.setShear (IMATH_INTERNAL_NAMESPACE::V2f (3.0f, 4.0f)); +- assert (m2[0][0] == 1.0f && m2[0][1] == 4.0f && m2[0][2] == 0.0f && m2[1][0] == 3.0f && +- m2[1][1] == 1.0f && m2[1][2] == 0.0f && m2[2][0] == 0.0f && m2[2][1] == 0.0f && +- m2[2][2] == 1.0f); ++ assert ( ++ m2[0][0] == 1.0f && m2[0][1] == 4.0f && m2[0][2] == 0.0f && ++ m2[1][0] == 3.0f && m2[1][1] == 1.0f && m2[1][2] == 0.0f && ++ m2[2][0] == 0.0f && m2[2][1] == 0.0f && m2[2][2] == 1.0f); + + m1.shear (IMATH_INTERNAL_NAMESPACE::V2f (5.0f, 6.0f)); +- assert (m1[0][0] == 13.0f && m1[0][1] == 6.0f && m1[0][2] == 0.0f && m1[1][0] == 7.0f && +- m1[1][1] == 1.0f && m1[1][2] == 0.0f && m1[2][0] == 0.0f && m1[2][1] == 0.0f && +- m1[2][2] == 1.0f); ++ assert ( ++ m1[0][0] == 13.0f && m1[0][1] == 6.0f && m1[0][2] == 0.0f && ++ m1[1][0] == 7.0f && m1[1][1] == 1.0f && m1[1][2] == 0.0f && ++ m1[2][0] == 0.0f && m1[2][1] == 0.0f && m1[2][2] == 1.0f); + + m2.shear (7.0f); +- assert (m2[0][0] == 1.0f && m2[0][1] == 4.0f && m2[0][2] == 0.0f && m2[1][0] == 10.0f && +- m2[1][1] == 29.0f && m2[1][2] == 0.0f && m2[2][0] == 0.0f && m2[2][1] == 0.0f && +- m2[2][2] == 1.0f); ++ assert ( ++ m2[0][0] == 1.0f && m2[0][1] == 4.0f && m2[0][2] == 0.0f && ++ m2[1][0] == 10.0f && m2[1][1] == 29.0f && m2[1][2] == 0.0f && ++ m2[2][0] == 0.0f && m2[2][1] == 0.0f && m2[2][2] == 1.0f); + + cout << "M33f constructors and equality operators" << endl; + +@@ -149,40 +154,44 @@ testMatrix() + assert (test != test2); + + IMATH_INTERNAL_NAMESPACE::M33f test3; +- test3.makeIdentity(); ++ test3.makeIdentity (); + assert (test2 == test3); + } + + { +- cout << "M33f inversion operators" << endl; +- +- IMATH_INTERNAL_NAMESPACE::M33f m1 (0.0f, 2.0f, -1.0f, 3.0f, -2.0f, 1.0f, 3.0f, 2.0f, -1.0f); +- IMATH_INTERNAL_NAMESPACE::M33f m2 = m1; +- assert(m1.inverse(false) == m1.inverse()); +- m2.invert(false); +- m1.invert(); +- assert(m1 == m2); +- +- IMATH_INTERNAL_NAMESPACE::M33f m3 (1.0f, 0.0f, 5.0f, 2.0f, 1.0f, 6.0f, 3.0f, 4.0f, 0.0f); +- m2 = m3; +- assert(m3.inverse(true) == m3.inverse()); +- m3.invert(true); +- m2.invert(); +- assert(m3 == m2); +- +- IMATH_INTERNAL_NAMESPACE::M33f m4 (0.0f, 2.0f, -1.0f, 3.0f, -2.0f, 1.0f, 3.0f, 2.0f, -1.0f); +- m2 = m4; +- assert(m4.gjInverse(false) == m4.gjInverse()); +- m2.gjInvert(false); +- m4.gjInvert(); +- assert(m4 == m2); +- +- IMATH_INTERNAL_NAMESPACE::M33f m5 (1.0f, 0.0f, 5.0f, 2.0f, 1.0f, 6.0f, 3.0f, 4.0f, 0.0f); +- m2 = m5; +- assert(m5.gjInverse(true) == m5.gjInverse()); +- m5.gjInvert(true); +- m2.gjInvert(); +- assert(m5 == m2); ++ cout << "M33f inversion operators" << endl; ++ ++ IMATH_INTERNAL_NAMESPACE::M33f m1 ( ++ 0.0f, 2.0f, -1.0f, 3.0f, -2.0f, 1.0f, 3.0f, 2.0f, -1.0f); ++ IMATH_INTERNAL_NAMESPACE::M33f m2 = m1; ++ assert (m1.inverse (false) == m1.inverse ()); ++ m2.invert (false); ++ m1.invert (); ++ assert (m1 == m2); ++ ++ IMATH_INTERNAL_NAMESPACE::M33f m3 ( ++ 1.0f, 0.0f, 5.0f, 2.0f, 1.0f, 6.0f, 3.0f, 4.0f, 0.0f); ++ m2 = m3; ++ assert (m3.inverse (true) == m3.inverse ()); ++ m3.invert (true); ++ m2.invert (); ++ assert (m3 == m2); ++ ++ IMATH_INTERNAL_NAMESPACE::M33f m4 ( ++ 0.0f, 2.0f, -1.0f, 3.0f, -2.0f, 1.0f, 3.0f, 2.0f, -1.0f); ++ m2 = m4; ++ assert (m4.gjInverse (false) == m4.gjInverse ()); ++ m2.gjInvert (false); ++ m4.gjInvert (); ++ assert (m4 == m2); ++ ++ IMATH_INTERNAL_NAMESPACE::M33f m5 ( ++ 1.0f, 0.0f, 5.0f, 2.0f, 1.0f, 6.0f, 3.0f, 4.0f, 0.0f); ++ m2 = m5; ++ assert (m5.gjInverse (true) == m5.gjInverse ()); ++ m5.gjInvert (true); ++ m2.gjInvert (); ++ assert (m5 == m2); + } + + { +@@ -199,12 +208,14 @@ testMatrix() + assert (test != test2); + + IMATH_INTERNAL_NAMESPACE::M33d test3; +- test3.makeIdentity(); ++ test3.makeIdentity (); + assert (test2 == test3); + +- IMATH_INTERNAL_NAMESPACE::M33f test4 (1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); ++ IMATH_INTERNAL_NAMESPACE::M33f test4 ( ++ 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f); + +- IMATH_INTERNAL_NAMESPACE::M33d test5 = IMATH_INTERNAL_NAMESPACE::M33d (test4); ++ IMATH_INTERNAL_NAMESPACE::M33d test5 = ++ IMATH_INTERNAL_NAMESPACE::M33d (test4); + + assert (test5[0][0] == 1.0); + assert (test5[0][1] == 2.0); +@@ -233,7 +244,7 @@ testMatrix() + assert (test != test2); + + IMATH_INTERNAL_NAMESPACE::M44f test3; +- test3.makeIdentity(); ++ test3.makeIdentity (); + assert (test2 == test3); + + // +@@ -260,7 +271,7 @@ testMatrix() + assert (test != test2); + + IMATH_INTERNAL_NAMESPACE::M44d test3; +- test3.makeIdentity(); ++ test3.makeIdentity (); + assert (test2 == test3); + + // +@@ -272,24 +283,26 @@ testMatrix() + test3 = test2; + assert (test2 != test3); + +- IMATH_INTERNAL_NAMESPACE::M44f test4 (1.0f, +- 2.0f, +- 3.0f, +- 4.0f, +- 5.0f, +- 6.0f, +- 7.0f, +- 8.0f, +- 9.0f, +- 10.0f, +- 11.0f, +- 12.0f, +- 13.0f, +- 14.0f, +- 15.0f, +- 16.0f); +- +- IMATH_INTERNAL_NAMESPACE::M44d test5 = IMATH_INTERNAL_NAMESPACE::M44d (test4); ++ IMATH_INTERNAL_NAMESPACE::M44f test4 ( ++ 1.0f, ++ 2.0f, ++ 3.0f, ++ 4.0f, ++ 5.0f, ++ 6.0f, ++ 7.0f, ++ 8.0f, ++ 9.0f, ++ 10.0f, ++ 11.0f, ++ 12.0f, ++ 13.0f, ++ 14.0f, ++ 15.0f, ++ 16.0f); ++ ++ IMATH_INTERNAL_NAMESPACE::M44d test5 = ++ IMATH_INTERNAL_NAMESPACE::M44d (test4); + + assert (test5[0][0] == 1.0); + assert (test5[0][1] == 2.0); +@@ -313,95 +326,99 @@ testMatrix() + } + + { +- cout << "M44f inversion operators" << endl; +- +- IMATH_INTERNAL_NAMESPACE::M44f m1 (1.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 1.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 1.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 0.0f); +- IMATH_INTERNAL_NAMESPACE::M44f m2 = m1; +- assert(m1.inverse(false) == m1.inverse()); +- m2.invert(false); +- m1.invert(); +- assert(m1 == m2); +- +- IMATH_INTERNAL_NAMESPACE::M44f m3 (5.0f, +- 6.0f, +- 6.0f, +- 8.0f, +- 2.0f, +- 2.0f, +- 2.0f, +- 8.0f, +- 6.0f, +- 6.0f, +- 2.0f, +- 8.0f, +- 2.0f, +- 3.0f, +- 6.0f, +- 7.0f); +- m2 = m3; +- assert(m3.inverse(true) == m3.inverse()); +- m3.invert(true); +- m2.invert(); +- assert(m3 == m2); +- +- IMATH_INTERNAL_NAMESPACE::M44f m4 (1.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 1.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 1.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 0.0f, +- 0.0f); +- m2 = m4; +- assert(m4.gjInverse(false) == m4.gjInverse()); +- m2.gjInvert(false); +- m4.gjInvert(); +- assert(m4 == m2); +- +- IMATH_INTERNAL_NAMESPACE::M44f m5 (5.0f, +- 6.0f, +- 6.0f, +- 8.0f, +- 2.0f, +- 2.0f, +- 2.0f, +- 8.0f, +- 6.0f, +- 6.0f, +- 2.0f, +- 8.0f, +- 2.0f, +- 3.0f, +- 6.0f, +- 7.0f); +- m2 = m5; +- assert(m5.gjInverse(true) == m5.gjInverse()); +- m5.gjInvert(true); +- m2.gjInvert(); +- assert(m5 == m2); ++ cout << "M44f inversion operators" << endl; ++ ++ IMATH_INTERNAL_NAMESPACE::M44f m1 ( ++ 1.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 1.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 1.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f); ++ IMATH_INTERNAL_NAMESPACE::M44f m2 = m1; ++ assert (m1.inverse (false) == m1.inverse ()); ++ m2.invert (false); ++ m1.invert (); ++ assert (m1 == m2); ++ ++ IMATH_INTERNAL_NAMESPACE::M44f m3 ( ++ 5.0f, ++ 6.0f, ++ 6.0f, ++ 8.0f, ++ 2.0f, ++ 2.0f, ++ 2.0f, ++ 8.0f, ++ 6.0f, ++ 6.0f, ++ 2.0f, ++ 8.0f, ++ 2.0f, ++ 3.0f, ++ 6.0f, ++ 7.0f); ++ m2 = m3; ++ assert (m3.inverse (true) == m3.inverse ()); ++ m3.invert (true); ++ m2.invert (); ++ assert (m3 == m2); ++ ++ IMATH_INTERNAL_NAMESPACE::M44f m4 ( ++ 1.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 1.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 1.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f, ++ 0.0f); ++ m2 = m4; ++ assert (m4.gjInverse (false) == m4.gjInverse ()); ++ m2.gjInvert (false); ++ m4.gjInvert (); ++ assert (m4 == m2); ++ ++ IMATH_INTERNAL_NAMESPACE::M44f m5 ( ++ 5.0f, ++ 6.0f, ++ 6.0f, ++ 8.0f, ++ 2.0f, ++ 2.0f, ++ 2.0f, ++ 8.0f, ++ 6.0f, ++ 6.0f, ++ 2.0f, ++ 8.0f, ++ 2.0f, ++ 3.0f, ++ 6.0f, ++ 7.0f); ++ m2 = m5; ++ assert (m5.gjInverse (true) == m5.gjInverse ()); ++ m5.gjInvert (true); ++ m2.gjInvert (); ++ assert (m5 == m2); + } + + { +@@ -458,13 +475,15 @@ testMatrix() + IMATH_INTERNAL_NAMESPACE::M22f v; + IMATH_INTERNAL_NAMESPACE::M22f s; + +- u.setRotation (random.nextf()); +- v.setRotation (random.nextf()); +- s[0][0] = random.nextf(); +- s[1][1] = random.nextf(); ++ u.setRotation (random.nextf ()); ++ v.setRotation (random.nextf ()); ++ s[0][0] = random.nextf (); ++ s[1][1] = random.nextf (); + +- IMATH_INTERNAL_NAMESPACE::M22f c = u * s * v.transpose(); +- assert (fabsf (c.determinant() - s[0][0] * s[1][1]) <= u.baseTypeEpsilon()); ++ IMATH_INTERNAL_NAMESPACE::M22f c = u * s * v.transpose (); ++ assert ( ++ fabsf (c.determinant () - s[0][0] * s[1][1]) <= ++ u.baseTypeEpsilon ()); + } + { + IMATH_INTERNAL_NAMESPACE::Rand32 random; +@@ -473,13 +492,15 @@ testMatrix() + IMATH_INTERNAL_NAMESPACE::M22d v; + IMATH_INTERNAL_NAMESPACE::M22d s; + +- u.setRotation ((double) random.nextf()); +- v.setRotation ((double) random.nextf()); +- s[0][0] = (double) random.nextf(); +- s[1][1] = (double) random.nextf(); ++ u.setRotation ((double) random.nextf ()); ++ v.setRotation ((double) random.nextf ()); ++ s[0][0] = (double) random.nextf (); ++ s[1][1] = (double) random.nextf (); + +- IMATH_INTERNAL_NAMESPACE::M22d c = u * s * v.transpose(); +- assert (fabs (c.determinant() - s[0][0] * s[1][1]) <= u.baseTypeEpsilon()); ++ IMATH_INTERNAL_NAMESPACE::M22d c = u * s * v.transpose (); ++ assert ( ++ fabs (c.determinant () - s[0][0] * s[1][1]) <= ++ u.baseTypeEpsilon ()); + } + + { +@@ -491,14 +512,16 @@ testMatrix() + IMATH_INTERNAL_NAMESPACE::M33f v; + IMATH_INTERNAL_NAMESPACE::M33f s; + +- u.setRotation (random.nextf()); +- v.setRotation (random.nextf()); +- s[0][0] = random.nextf(); +- s[1][1] = random.nextf(); +- s[2][2] = random.nextf(); ++ u.setRotation (random.nextf ()); ++ v.setRotation (random.nextf ()); ++ s[0][0] = random.nextf (); ++ s[1][1] = random.nextf (); ++ s[2][2] = random.nextf (); + +- IMATH_INTERNAL_NAMESPACE::M33f c = u * s * v.transpose(); +- assert (fabsf (c.determinant() - s[0][0] * s[1][1] * s[2][2]) <= u.baseTypeEpsilon()); ++ IMATH_INTERNAL_NAMESPACE::M33f c = u * s * v.transpose (); ++ assert ( ++ fabsf (c.determinant () - s[0][0] * s[1][1] * s[2][2]) <= ++ u.baseTypeEpsilon ()); + } + { + IMATH_INTERNAL_NAMESPACE::Rand32 random; +@@ -507,23 +530,26 @@ testMatrix() + IMATH_INTERNAL_NAMESPACE::M33d v; + IMATH_INTERNAL_NAMESPACE::M33d s; + +- u.setRotation ((double) random.nextf()); +- v.setRotation ((double) random.nextf()); +- s[0][0] = (double) random.nextf(); +- s[1][1] = (double) random.nextf(); +- s[2][2] = (double) random.nextf(); ++ u.setRotation ((double) random.nextf ()); ++ v.setRotation ((double) random.nextf ()); ++ s[0][0] = (double) random.nextf (); ++ s[1][1] = (double) random.nextf (); ++ s[2][2] = (double) random.nextf (); + +- IMATH_INTERNAL_NAMESPACE::M33d c = u * s * v.transpose(); +- assert (fabs (c.determinant() - s[0][0] * s[1][1] * s[2][2]) <= u.baseTypeEpsilon()); ++ IMATH_INTERNAL_NAMESPACE::M33d c = u * s * v.transpose (); ++ assert ( ++ fabs (c.determinant () - s[0][0] * s[1][1] * s[2][2]) <= ++ u.baseTypeEpsilon ()); + } + + // Outer product of two 3D vectors + { + cout << "Outer product of two 3D vectors" << endl; + +- IMATH_INTERNAL_NAMESPACE::V3f a (1, 2, 3); +- IMATH_INTERNAL_NAMESPACE::V3f b (4, 5, 6); +- IMATH_INTERNAL_NAMESPACE::M33f p = IMATH_INTERNAL_NAMESPACE::outerProduct (a, b); ++ IMATH_INTERNAL_NAMESPACE::V3f a (1, 2, 3); ++ IMATH_INTERNAL_NAMESPACE::V3f b (4, 5, 6); ++ IMATH_INTERNAL_NAMESPACE::M33f p = ++ IMATH_INTERNAL_NAMESPACE::outerProduct (a, b); + + for (int i = 0; i < 3; i++) + { +@@ -534,9 +560,10 @@ testMatrix() + } + } + { +- IMATH_INTERNAL_NAMESPACE::V3d a (1, 2, 3); +- IMATH_INTERNAL_NAMESPACE::V3d b (4, 5, 6); +- IMATH_INTERNAL_NAMESPACE::M33d p = IMATH_INTERNAL_NAMESPACE::outerProduct (a, b); ++ IMATH_INTERNAL_NAMESPACE::V3d a (1, 2, 3); ++ IMATH_INTERNAL_NAMESPACE::V3d b (4, 5, 6); ++ IMATH_INTERNAL_NAMESPACE::M33d p = ++ IMATH_INTERNAL_NAMESPACE::outerProduct (a, b); + + for (int i = 0; i < 3; i++) + { +@@ -553,57 +580,72 @@ testMatrix() + + IMATH_INTERNAL_NAMESPACE::Rand32 random; + +- IMATH_INTERNAL_NAMESPACE::M44f u = IMATH_INTERNAL_NAMESPACE::rotationMatrix ( +- IMATH_INTERNAL_NAMESPACE::V3f (random.nextf(), random.nextf(), random.nextf()) +- .normalize(), +- IMATH_INTERNAL_NAMESPACE::V3f (random.nextf(), random.nextf(), random.nextf()) +- .normalize()); +- IMATH_INTERNAL_NAMESPACE::M44f v = IMATH_INTERNAL_NAMESPACE::rotationMatrix ( +- IMATH_INTERNAL_NAMESPACE::V3f (random.nextf(), random.nextf(), random.nextf()) +- .normalize(), +- IMATH_INTERNAL_NAMESPACE::V3f (random.nextf(), random.nextf(), random.nextf()) +- .normalize()); ++ IMATH_INTERNAL_NAMESPACE::M44f u = ++ IMATH_INTERNAL_NAMESPACE::rotationMatrix ( ++ IMATH_INTERNAL_NAMESPACE::V3f ( ++ random.nextf (), random.nextf (), random.nextf ()) ++ .normalize (), ++ IMATH_INTERNAL_NAMESPACE::V3f ( ++ random.nextf (), random.nextf (), random.nextf ()) ++ .normalize ()); ++ IMATH_INTERNAL_NAMESPACE::M44f v = ++ IMATH_INTERNAL_NAMESPACE::rotationMatrix ( ++ IMATH_INTERNAL_NAMESPACE::V3f ( ++ random.nextf (), random.nextf (), random.nextf ()) ++ .normalize (), ++ IMATH_INTERNAL_NAMESPACE::V3f ( ++ random.nextf (), random.nextf (), random.nextf ()) ++ .normalize ()); + IMATH_INTERNAL_NAMESPACE::M44f s; + +- s[0][0] = random.nextf(); +- s[1][1] = random.nextf(); +- s[2][2] = random.nextf(); +- s[3][3] = random.nextf(); ++ s[0][0] = random.nextf (); ++ s[1][1] = random.nextf (); ++ s[2][2] = random.nextf (); ++ s[3][3] = random.nextf (); + +- IMATH_INTERNAL_NAMESPACE::M44f c = u * s * v.transpose(); +- assert (fabsf (c.determinant() - s[0][0] * s[1][1] * s[2][2] * s[3][3]) <= +- u.baseTypeEpsilon()); ++ IMATH_INTERNAL_NAMESPACE::M44f c = u * s * v.transpose (); ++ assert ( ++ fabsf (c.determinant () - s[0][0] * s[1][1] * s[2][2] * s[3][3]) <= ++ u.baseTypeEpsilon ()); + } + { + IMATH_INTERNAL_NAMESPACE::Rand32 random; + +- IMATH_INTERNAL_NAMESPACE::M44d u = IMATH_INTERNAL_NAMESPACE::rotationMatrix ( +- IMATH_INTERNAL_NAMESPACE::V3d (random.nextf(), random.nextf(), random.nextf()) +- .normalize(), +- IMATH_INTERNAL_NAMESPACE::V3d (random.nextf(), random.nextf(), random.nextf()) +- .normalize()); +- IMATH_INTERNAL_NAMESPACE::M44d v = IMATH_INTERNAL_NAMESPACE::rotationMatrix ( +- IMATH_INTERNAL_NAMESPACE::V3d (random.nextf(), random.nextf(), random.nextf()) +- .normalize(), +- IMATH_INTERNAL_NAMESPACE::V3d (random.nextf(), random.nextf(), random.nextf()) +- .normalize()); ++ IMATH_INTERNAL_NAMESPACE::M44d u = ++ IMATH_INTERNAL_NAMESPACE::rotationMatrix ( ++ IMATH_INTERNAL_NAMESPACE::V3d ( ++ random.nextf (), random.nextf (), random.nextf ()) ++ .normalize (), ++ IMATH_INTERNAL_NAMESPACE::V3d ( ++ random.nextf (), random.nextf (), random.nextf ()) ++ .normalize ()); ++ IMATH_INTERNAL_NAMESPACE::M44d v = ++ IMATH_INTERNAL_NAMESPACE::rotationMatrix ( ++ IMATH_INTERNAL_NAMESPACE::V3d ( ++ random.nextf (), random.nextf (), random.nextf ()) ++ .normalize (), ++ IMATH_INTERNAL_NAMESPACE::V3d ( ++ random.nextf (), random.nextf (), random.nextf ()) ++ .normalize ()); + IMATH_INTERNAL_NAMESPACE::M44d s; + +- s[0][0] = random.nextf(); +- s[1][1] = random.nextf(); +- s[2][2] = random.nextf(); +- s[3][3] = random.nextf(); ++ s[0][0] = random.nextf (); ++ s[1][1] = random.nextf (); ++ s[2][2] = random.nextf (); ++ s[3][3] = random.nextf (); + +- IMATH_INTERNAL_NAMESPACE::M44d c = u * s * v.transpose(); +- assert (fabs (c.determinant() - s[0][0] * s[1][1] * s[2][2] * s[3][3]) <= +- u.baseTypeEpsilon()); ++ IMATH_INTERNAL_NAMESPACE::M44d c = u * s * v.transpose (); ++ assert ( ++ fabs (c.determinant () - s[0][0] * s[1][1] * s[2][2] * s[3][3]) <= ++ u.baseTypeEpsilon ()); + } + + // Matrix minors + { + cout << "4x4 matrix minors" << endl; + +- IMATH_INTERNAL_NAMESPACE::M44d a (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); ++ IMATH_INTERNAL_NAMESPACE::M44d a ( ++ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + + assert (a.minorOf (0, 0) == a.fastMinor (1, 2, 3, 1, 2, 3)); + assert (a.minorOf (0, 1) == a.fastMinor (1, 2, 3, 0, 2, 3)); +@@ -623,7 +665,8 @@ testMatrix() + assert (a.minorOf (3, 3) == a.fastMinor (0, 1, 2, 0, 1, 2)); + } + { +- IMATH_INTERNAL_NAMESPACE::M44f a (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); ++ IMATH_INTERNAL_NAMESPACE::M44f a ( ++ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); + + assert (a.minorOf (0, 0) == a.fastMinor (1, 2, 3, 1, 2, 3)); + assert (a.minorOf (0, 1) == a.fastMinor (1, 2, 3, 0, 2, 3)); +@@ -649,25 +692,26 @@ testMatrix() + // and ignores __restrict. + { + cout << "M44 multiplicaftion test" << endl; +- IMATH_INTERNAL_NAMESPACE::M44f M (1.0f, +- 2.0f, +- 3.0f, +- 4.0f, +- 5.0f, +- 6.0f, +- 7.0f, +- 8.0f, +- 9.0f, +- 10.0f, +- 11.0f, +- 12.0f, +- 13.0f, +- 14.0f, +- 15.0f, +- 16.0f); ++ IMATH_INTERNAL_NAMESPACE::M44f M ( ++ 1.0f, ++ 2.0f, ++ 3.0f, ++ 4.0f, ++ 5.0f, ++ 6.0f, ++ 7.0f, ++ 8.0f, ++ 9.0f, ++ 10.0f, ++ 11.0f, ++ 12.0f, ++ 13.0f, ++ 14.0f, ++ 15.0f, ++ 16.0f); + + IMATH_INTERNAL_NAMESPACE::M44f N; +- N.makeIdentity(); ++ N.makeIdentity (); + + // N should be equal to M + // This typical test fails +diff --git a/src/ImathTest/testMatrix.h b/src/ImathTest/testMatrix.h +index b4f7245..66edce4 100644 +--- a/src/ImathTest/testMatrix.h ++++ b/src/ImathTest/testMatrix.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testMatrix(); ++void testMatrix (); +diff --git a/src/ImathTest/testMiscMatrixAlgo.cpp b/src/ImathTest/testMiscMatrixAlgo.cpp +index 675a218..9b1aced 100644 +--- a/src/ImathTest/testMiscMatrixAlgo.cpp ++++ b/src/ImathTest/testMiscMatrixAlgo.cpp +@@ -7,13 +7,13 @@ + # undef NDEBUG + #endif + ++#include "testMiscMatrixAlgo.h" + #include + #include + #include + #include + #include + #include +-#include "testMiscMatrixAlgo.h" + + #if 0 + # define debug(x) (printf x, fflush (stdout)) +@@ -34,22 +34,31 @@ rad (float deg) + } + + void +-testComputeLocalFrame() ++testComputeLocalFrame () + { +- float eps = 0.00005; ++ float eps = 0.00005; + 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 ( ++ random.nextf (-10, 10), ++ random.nextf (-10, 10), ++ random.nextf (-10, 10)); + + // Random xDir +- V3f xDir (random.nextf (-10, 10), random.nextf (-10, 10), random.nextf (-10, 10)); ++ V3f xDir ( ++ random.nextf (-10, 10), ++ random.nextf (-10, 10), ++ random.nextf (-10, 10)); + + // Random normalDir +- V3f normalDir (random.nextf (-10, 10), random.nextf (-10, 10), random.nextf (-10, 10)); ++ V3f normalDir ( ++ random.nextf (-10, 10), ++ random.nextf (-10, 10), ++ random.nextf (-10, 10)); + + // Run computeLocalFrame we want to test + M44f L = computeLocalFrame (p, xDir, normalDir); +@@ -57,35 +66,30 @@ testComputeLocalFrame() + // test position + for (int j = 0; j < 3; j++) + { +- if (abs (L[3][j] - p[j]) > eps) +- assert (false); ++ if (abs (L[3][j] - p[j]) > eps) assert (false); + } +- if (abs (L[3][3] - 1.0) > eps) +- assert (false); ++ if (abs (L[3][3] - 1.0) > eps) assert (false); + + // check that xAxis has the same dir as xDir and that is is normalized + V3f x (L[0][0], L[0][1], L[0][2]); +- assert ((x % xDir).length() < eps); +- if (abs (L[0][3]) > eps) +- assert (false); +- assert ((abs (x.length() - 1.f) < eps)); ++ assert ((x % xDir).length () < eps); ++ if (abs (L[0][3]) > eps) assert (false); ++ assert ((abs (x.length () - 1.f) < eps)); + + // Check that y is normal to x and to normalDir, and is normalized + V3f y (L[1][0], L[1][1], L[1][2]); +- if (abs (L[1][3]) > eps) +- assert (false); ++ if (abs (L[1][3]) > eps) assert (false); + assert (abs (x ^ y) < eps); + /*std::cout< eps) +- assert (false); +- assert ((abs (z.length() - 1.f) < eps)); ++ if (abs (L[2][3]) > eps) assert (false); ++ assert ((abs (z.length () - 1.f) < eps)); + assert (abs (x ^ z) < eps); + assert (abs (y ^ z) < eps); + assert (((x % y) ^ z) > 0); +@@ -96,19 +100,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 ( ++ random.nextf (-10, 10), random.nextf (-10, 10), 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 (random.nextf (-180, 180)), ++ rad (random.nextf (-180, 180)), ++ rad (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 ( ++ random.nextf (0.000001, 2.0), ++ random.nextf (0.000001, 2.0), ++ 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; ++ if (random.nextf (0.0, 1.0) >= 0.5) s[j] *= -1; + scale = s; + } + +@@ -117,20 +123,20 @@ createRandomMat (Rand48& random, V3f& trans, V3f& rot, V3f& scale) + { + + M44f M; +- V3f t, r, s; ++ V3f t, r, s; + getRandTRS (random, t, r, s); + + M.translate (t); + 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 ( ++ random.nextf (0.000001, 2.0), ++ random.nextf (0.000001, 2.0), ++ random.nextf (0.000001, 2.0)); + + for (int j = 0; j < 3; j++) +- if (random.nextf (0.0, 1.0) >= 0.5) +- h[j] *= -1; ++ if (random.nextf (0.0, 1.0) >= 0.5) h[j] *= -1; + M.shear (h); + + M.scale (s); +@@ -185,7 +191,7 @@ compareMat (M44f& M, M44f& N) + } + + void +-testAddOffset() ++testAddOffset () + { + Rand48 random (0); + +@@ -193,8 +199,8 @@ testAddOffset() + { + debug (("iteration: %d\n", i)); + +- V3f transA, transB, rotA, rotB, scaleA, scaleB; +- V3f tOffset, rOffset, sOffset; ++ V3f transA, transB, rotA, rotB, scaleA, scaleB; ++ V3f tOffset, rOffset, sOffset; + M44f inMat = createRandomMat (random, transA, rotA, scaleA); + M44f refMat = createRandomMat (random, transB, rotB, scaleB); + getRandTRS (random, tOffset, rOffset, sOffset); +@@ -204,15 +210,16 @@ testAddOffset() + + // add the inverse offset + M44f invO; +- invO.rotate (V3f (rad (rOffset[0]), rad (rOffset[1]), rad (rOffset[2]))); ++ invO.rotate ( ++ V3f (rad (rOffset[0]), rad (rOffset[1]), rad (rOffset[2]))); + invO[3][0] = tOffset[0]; + invO[3][1] = tOffset[1]; + invO[3][2] = tOffset[2]; +- invO.invert(); ++ invO.invert (); + + M44f invS; + invS.scale (sOffset); +- invS.invert(); // zero scale is avoided in getRandTRS ++ invS.invert (); // zero scale is avoided in getRandTRS + + // in ref mat from the function result + M44f outInRefMat = invO * invS * outMat; +@@ -229,7 +236,7 @@ void + testRSMatrix (M44f& M, V3f& t, V3f& r, V3f& s) + { + M44f N; +- N.makeIdentity(); ++ N.makeIdentity (); + N.translate (t); // ... matrix compositions + N.rotate (r); + N.scale (s); +@@ -238,7 +245,7 @@ testRSMatrix (M44f& M, V3f& t, V3f& r, V3f& s) + } + + void +-testComputeRSMatrix() ++testComputeRSMatrix () + { + Rand48 random (0); + +@@ -268,17 +275,18 @@ testComputeRSMatrix() + } // namespace + + void +-testMiscMatrixAlgo() ++testMiscMatrixAlgo () + { + try + { + cout << "Testing misc functions in ImathMatrixAlgo.h" << endl; + +- cout << "Testing the building of an orthonormal direct frame from : a position, " +- << "an x axis direction and a normal to the y axis" << endl; ++ cout ++ << "Testing the building of an orthonormal direct frame from : a position, " ++ << "an x axis direction and a normal to the y axis" << endl; + cout << "IMATH_INTERNAL_NAMESPACE::computeLocalFrame()" << endl; + +- testComputeLocalFrame(); ++ testComputeLocalFrame (); + + cout << "ok\n" << endl; + +@@ -286,7 +294,7 @@ testMiscMatrixAlgo() + << "and put it in another frame of reference" << endl; + cout << "IMATH_INTERNAL_NAMESPACE::addOffset()" << endl; + +- testAddOffset(); ++ testAddOffset (); + + cout << "ok\n" << endl; + +@@ -294,12 +302,12 @@ testMiscMatrixAlgo() + cout << "with the Rotate/Scale of Matrix B" << endl; + cout << "IMATH_INTERNAL_NAMESPACE::computeRSMatrix()" << endl; + +- testComputeRSMatrix(); ++ testComputeRSMatrix (); + + cout << "ok\n" << endl; + } + catch (std::exception& e) + { +- cerr << " Caught exception: " << e.what() << endl; ++ cerr << " Caught exception: " << e.what () << endl; + } + } +diff --git a/src/ImathTest/testMiscMatrixAlgo.h b/src/ImathTest/testMiscMatrixAlgo.h +index fdc67dc..5dfd2e8 100644 +--- a/src/ImathTest/testMiscMatrixAlgo.h ++++ b/src/ImathTest/testMiscMatrixAlgo.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testMiscMatrixAlgo(); ++void testMiscMatrixAlgo (); +diff --git a/src/ImathTest/testProcrustes.cpp b/src/ImathTest/testProcrustes.cpp +index ff1c032..a141d90 100644 +--- a/src/ImathTest/testProcrustes.cpp ++++ b/src/ImathTest/testProcrustes.cpp +@@ -27,23 +27,24 @@ testTranslationRotationMatrix (const IMATH_INTERNAL_NAMESPACE::M44d& mat) + + static IMATH_INTERNAL_NAMESPACE::Rand48 rand (2047); + +- size_t numPoints = 7; ++ size_t numPoints = 7; + std::vector from; + from.reserve (numPoints); + std::vector to; + to.reserve (numPoints); + for (size_t i = 0; i < numPoints; ++i) + { +- IMATH_INTERNAL_NAMESPACE::V3d a (rand.nextf(), rand.nextf(), rand.nextf()); ++ IMATH_INTERNAL_NAMESPACE::V3d a ( ++ rand.nextf (), rand.nextf (), rand.nextf ()); + IMATH_INTERNAL_NAMESPACE::V3d b = a * mat; + + from.push_back (Vec (a)); + to.push_back (Vec (b)); + } + +- std::vector weights (numPoints, T (1)); +- const IMATH_INTERNAL_NAMESPACE::M44d m1 = +- procrustesRotationAndTranslation (&from[0], &to[0], &weights[0], numPoints); ++ std::vector weights (numPoints, T (1)); ++ const IMATH_INTERNAL_NAMESPACE::M44d m1 = procrustesRotationAndTranslation ( ++ &from[0], &to[0], &weights[0], numPoints); + const IMATH_INTERNAL_NAMESPACE::M44d m2 = + procrustesRotationAndTranslation (&from[0], &to[0], numPoints); + +@@ -55,8 +56,8 @@ testTranslationRotationMatrix (const IMATH_INTERNAL_NAMESPACE::M44d& mat) + const IMATH_INTERNAL_NAMESPACE::V3d b1 = a * m1; + const IMATH_INTERNAL_NAMESPACE::V3d b2 = a * m2; + +- assert ((b - b1).length() < eps); +- assert ((b - b2).length() < eps); ++ assert ((b - b1).length () < eps); ++ assert ((b - b2).length () < eps); + } + std::cout << " OK\n"; + } +@@ -71,58 +72,56 @@ testWithTranslateRotateAndScale (const IMATH_INTERNAL_NAMESPACE::M44d& m) + IMATH_INTERNAL_NAMESPACE::Rand48 rand (5376); + + typedef IMATH_INTERNAL_NAMESPACE::Vec3 V3; +- std::vector from; +- std::vector weights; ++ std::vector from; ++ std::vector weights; + + const float eps = 1e-4; + 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 (rand.nextf (), rand.nextf (), rand.nextf ())); ++ weights.push_back (rand.nextf ()); ++ std::cout << from.size () << " "; + + std::vector to; +- for (size_t i = 0; i < from.size(); ++i) ++ for (size_t i = 0; i < from.size (); ++i) + to.push_back (from[i] * m); + + // weighted: + IMATH_INTERNAL_NAMESPACE::M44d res = +- IMATH_INTERNAL_NAMESPACE::procrustesRotationAndTranslation (&from[0], +- &to[0], +- &weights[0], +- from.size(), +- true); +- for (size_t i = 0; i < from.size(); ++i) +- assert ((from[i] * res - to[i]).length() < eps); ++ IMATH_INTERNAL_NAMESPACE::procrustesRotationAndTranslation ( ++ &from[0], &to[0], &weights[0], from.size (), true); ++ for (size_t i = 0; i < from.size (); ++i) ++ assert ((from[i] * res - to[i]).length () < eps); + + // unweighted: +- res = IMATH_INTERNAL_NAMESPACE::procrustesRotationAndTranslation (&from[0], +- &to[0], +- from.size(), +- true); +- for (size_t i = 0; i < from.size(); ++i) +- assert ((from[i] * res - to[i]).length() < eps); ++ res = IMATH_INTERNAL_NAMESPACE::procrustesRotationAndTranslation ( ++ &from[0], &to[0], from.size (), true); ++ for (size_t i = 0; i < from.size (); ++i) ++ assert ((from[i] * res - to[i]).length () < eps); + } + std::cout << " OK\n"; + } + + template + double +-procrustesError (const IMATH_INTERNAL_NAMESPACE::Vec3* from, +- const IMATH_INTERNAL_NAMESPACE::Vec3* to, +- const T* weights, +- const size_t n, +- const IMATH_INTERNAL_NAMESPACE::M44d& xform) ++procrustesError ( ++ const IMATH_INTERNAL_NAMESPACE::Vec3* from, ++ const IMATH_INTERNAL_NAMESPACE::Vec3* to, ++ const T* weights, ++ const size_t n, ++ const IMATH_INTERNAL_NAMESPACE::M44d& xform) + { + double result = 0.0; + double residual = 0.0; + for (size_t i = 0; i < n; ++i) + { +- IMATH_INTERNAL_NAMESPACE::V3d xformed = IMATH_INTERNAL_NAMESPACE::V3d (from[i]) * xform; +- IMATH_INTERNAL_NAMESPACE::V3d diff = xformed - IMATH_INTERNAL_NAMESPACE::V3d (to[i]); +- const double w = weights[i]; +- const double mag = w * diff.length2(); ++ IMATH_INTERNAL_NAMESPACE::V3d xformed = ++ IMATH_INTERNAL_NAMESPACE::V3d (from[i]) * xform; ++ IMATH_INTERNAL_NAMESPACE::V3d diff = ++ xformed - IMATH_INTERNAL_NAMESPACE::V3d (to[i]); ++ const double w = weights[i]; ++ const double mag = w * diff.length2 (); + + // Use Kahan summation for the heck of it: + const double y = mag - residual; +@@ -135,19 +134,21 @@ procrustesError (const IMATH_INTERNAL_NAMESPACE::Vec3* from, + + template + void +-verifyProcrustes (const std::vector>& from, +- const std::vector>& to) ++verifyProcrustes ( ++ const std::vector>& from, ++ const std::vector>& to) + { +- const T eps = std::sqrt (std::numeric_limits::epsilon()); ++ const T eps = std::sqrt (std::numeric_limits::epsilon ()); + +- const size_t n = from.size(); ++ const size_t n = from.size (); + + // Validate that passing in uniform weights gives the same answer as + // passing in no weights: +- std::vector weights (from.size()); +- for (size_t i = 0; i < weights.size(); ++i) ++ std::vector weights (from.size ()); ++ for (size_t i = 0; i < weights.size (); ++i) + weights[i] = 1; +- IMATH_INTERNAL_NAMESPACE::M44d m1 = procrustesRotationAndTranslation (&from[0], &to[0], n); ++ IMATH_INTERNAL_NAMESPACE::M44d m1 = ++ procrustesRotationAndTranslation (&from[0], &to[0], n); + IMATH_INTERNAL_NAMESPACE::M44d m2 = + procrustesRotationAndTranslation (&from[0], &to[0], &weights[0], n); + for (int i = 0; i < 4; ++i) +@@ -155,18 +156,18 @@ 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) ++ for (size_t i = 0; i < weights.size (); ++i) + weights[i] = i + 1; + + IMATH_INTERNAL_NAMESPACE::M44d m = + procrustesRotationAndTranslation (&from[0], &to[0], &weights[0], n); + + // with scale: +- IMATH_INTERNAL_NAMESPACE::M44d ms = +- procrustesRotationAndTranslation (&from[0], &to[0], &weights[0], n, true); ++ IMATH_INTERNAL_NAMESPACE::M44d ms = 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 = m.determinant (); + assert (std::abs (det - T (1)) < eps); + + // Verify orthonormal: +@@ -174,7 +175,8 @@ verifyProcrustes (const std::vector>& from, + for (int i = 0; i < 3; ++i) + for (int j = 0; j < 3; ++j) + upperLeft[i][j] = m[i][j]; +- IMATH_INTERNAL_NAMESPACE::M33d product = upperLeft * upperLeft.transposed(); ++ IMATH_INTERNAL_NAMESPACE::M33d product = ++ upperLeft * upperLeft.transposed (); + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 3; ++j) +@@ -185,43 +187,51 @@ verifyProcrustes (const std::vector>& from, + } + + // Verify that nearby transforms are worse: +- const size_t numTries = 10; ++ const size_t numTries = 10; + IMATH_INTERNAL_NAMESPACE::Rand48 rand (1056); +- const double delta = 1e-3; ++ const double delta = 1e-3; + for (size_t i = 0; i < numTries; ++i) + { + // Construct an orthogonal rotation matrix using Euler angles: +- IMATH_INTERNAL_NAMESPACE::Eulerd diffRot (delta * rand.nextf(), +- delta * rand.nextf(), +- delta * rand.nextf()); ++ IMATH_INTERNAL_NAMESPACE::Eulerd diffRot ( ++ delta * rand.nextf (), ++ delta * rand.nextf (), ++ delta * rand.nextf ()); + +- assert (procrustesError (&from[0], &to[0], &weights[0], n, m * diffRot.toMatrix44()) > +- procrustesError (&from[0], &to[0], &weights[0], n, m)); ++ assert ( ++ procrustesError ( ++ &from[0], &to[0], &weights[0], n, m * diffRot.toMatrix44 ()) > ++ procrustesError (&from[0], &to[0], &weights[0], n, m)); + + // Try a small translation: +- IMATH_INTERNAL_NAMESPACE::V3d diffTrans (delta * rand.nextf(), +- delta * rand.nextf(), +- delta * rand.nextf()); ++ IMATH_INTERNAL_NAMESPACE::V3d diffTrans ( ++ delta * rand.nextf (), ++ delta * rand.nextf (), ++ delta * rand.nextf ()); + IMATH_INTERNAL_NAMESPACE::M44d translateMatrix; + translateMatrix.translate (diffTrans); +- assert (procrustesError (&from[0], &to[0], &weights[0], n, m * translateMatrix) > +- procrustesError (&from[0], &to[0], &weights[0], n, m)); ++ assert ( ++ procrustesError ( ++ &from[0], &to[0], &weights[0], n, m * translateMatrix) > ++ procrustesError (&from[0], &to[0], &weights[0], n, m)); + } + + // Try a small scale: +- IMATH_INTERNAL_NAMESPACE::M44d newMat = ms; +- const double scaleDiff = delta; ++ 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) + 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)); ++ 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) + 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)); ++ assert ( ++ procrustesError (&from[0], &to[0], &weights[0], n, newMat) > ++ procrustesError (&from[0], &to[0], &weights[0], n, ms)); + + // + // Verify the magical property that makes shape springs work: +@@ -242,8 +252,8 @@ verifyProcrustes (const std::vector>& from, + netTorque += to[iPoint].cross (force); + } + +- assert (netForce.length2() < eps); +- assert (netTorque.length2() < eps); ++ assert (netForce.length2 () < eps); ++ assert (netTorque.length2 () < eps); + } + } + +@@ -260,13 +270,12 @@ testProcrustesWithMatrix (const IMATH_INTERNAL_NAMESPACE::M44d& m) + for (size_t numPoints = 1; numPoints < 10; ++numPoints) + { + std::cout << numPoints << " " << std::flush; +- fromPoints.clear(); +- toPoints.clear(); ++ fromPoints.clear (); ++ toPoints.clear (); + for (size_t i = 0; i < numPoints; ++i) + { +- const IMATH_INTERNAL_NAMESPACE::V3d fromPt (random.nextf(), +- random.nextf(), +- random.nextf()); ++ const IMATH_INTERNAL_NAMESPACE::V3d fromPt ( ++ random.nextf (), random.nextf (), random.nextf ()); + const IMATH_INTERNAL_NAMESPACE::V3d toPt = fromPt * m; + fromPoints.push_back (IMATH_INTERNAL_NAMESPACE::Vec3 (fromPt)); + toPoints.push_back (IMATH_INTERNAL_NAMESPACE::Vec3 (toPt)); +@@ -278,25 +287,26 @@ testProcrustesWithMatrix (const IMATH_INTERNAL_NAMESPACE::M44d& m) + + template + void +-testProcrustesImp() ++testProcrustesImp () + { + // Test the empty case: +- IMATH_INTERNAL_NAMESPACE::M44d id = +- procrustesRotationAndTranslation ((IMATH_INTERNAL_NAMESPACE::Vec3*) 0, +- (IMATH_INTERNAL_NAMESPACE::Vec3*) 0, +- (T*) 0, +- 0); +- assert (id == IMATH_INTERNAL_NAMESPACE::M44d()); +- +- id = procrustesRotationAndTranslation ((IMATH_INTERNAL_NAMESPACE::Vec3*) 0, +- (IMATH_INTERNAL_NAMESPACE::Vec3*) 0, +- 0); +- assert (id == IMATH_INTERNAL_NAMESPACE::M44d()); ++ IMATH_INTERNAL_NAMESPACE::M44d id = procrustesRotationAndTranslation ( ++ (IMATH_INTERNAL_NAMESPACE::Vec3*) 0, ++ (IMATH_INTERNAL_NAMESPACE::Vec3*) 0, ++ (T*) 0, ++ 0); ++ assert (id == IMATH_INTERNAL_NAMESPACE::M44d ()); ++ ++ id = procrustesRotationAndTranslation ( ++ (IMATH_INTERNAL_NAMESPACE::Vec3*) 0, ++ (IMATH_INTERNAL_NAMESPACE::Vec3*) 0, ++ 0); ++ assert (id == IMATH_INTERNAL_NAMESPACE::M44d ()); + + // First we'll test with a bunch of known translation/rotation matrices + // to make sure we get back exactly the same points: + IMATH_INTERNAL_NAMESPACE::M44d m; +- m.makeIdentity(); ++ m.makeIdentity (); + testTranslationRotationMatrix (m); + + m.translate (IMATH_INTERNAL_NAMESPACE::V3d (3.0, 5.0, -0.2)); +@@ -311,7 +321,7 @@ testProcrustesImp() + m.rotate (IMATH_INTERNAL_NAMESPACE::V3d (0, 0, -3.0 / 4.0 * M_PI)); + testTranslationRotationMatrix (m); + +- m.makeIdentity(); ++ m.makeIdentity (); + testWithTranslateRotateAndScale (m); + + m.translate (IMATH_INTERNAL_NAMESPACE::V3d (0.4, 6.0, 10.0)); +@@ -336,30 +346,30 @@ testProcrustesImp() + // the various Procrustes properties: + std::vector> fromPoints; + std::vector> toPoints; +- fromPoints.clear(); +- toPoints.clear(); ++ fromPoints.clear (); ++ toPoints.clear (); + + 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)); ++ 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)); + } + verifyProcrustes (fromPoints, toPoints); + + IMATH_INTERNAL_NAMESPACE::Rand48 random (1209); + for (size_t numPoints = 1; numPoints < 10; ++numPoints) + { +- fromPoints.clear(); +- toPoints.clear(); ++ fromPoints.clear (); ++ 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 ( ++ random.nextf (), random.nextf (), random.nextf ())); ++ toPoints.push_back (IMATH_INTERNAL_NAMESPACE::Vec3 ( ++ random.nextf (), random.nextf (), random.nextf ())); + } + } + verifyProcrustes (fromPoints, toPoints); +@@ -374,14 +384,14 @@ testProcrustesImp() + testProcrustesWithMatrix (m); + + IMATH_INTERNAL_NAMESPACE::Eulerd rot (M_PI / 3.0, 3.0 * M_PI / 4.0, 0); +- m = m * rot.toMatrix44(); ++ m = m * rot.toMatrix44 (); + testProcrustesWithMatrix (m); + + m.scale (IMATH_INTERNAL_NAMESPACE::Vec3 (1.5, 6.4, 2.0)); + testProcrustesWithMatrix (m); + + IMATH_INTERNAL_NAMESPACE::Eulerd rot2 (1.0, M_PI, M_PI / 3.0); +- m = m * rot.toMatrix44(); ++ m = m * rot.toMatrix44 (); + + m.scale (IMATH_INTERNAL_NAMESPACE::Vec3 (-1, 1, 1)); + testProcrustesWithMatrix (m); +@@ -394,11 +404,13 @@ testProcrustesImp() + } + + void +-testProcrustes() ++testProcrustes () + { +- std::cout << "Testing Procrustes algorithms in single precision..." << std::endl; +- testProcrustesImp(); ++ std::cout << "Testing Procrustes algorithms in single precision..." ++ << std::endl; ++ testProcrustesImp (); + +- std::cout << "Testing Procrustes algorithms in double precision..." << std::endl; +- testProcrustesImp(); ++ std::cout << "Testing Procrustes algorithms in double precision..." ++ << std::endl; ++ testProcrustesImp (); + } +diff --git a/src/ImathTest/testProcrustes.h b/src/ImathTest/testProcrustes.h +index 5a1e3ba..2db5c57 100644 +--- a/src/ImathTest/testProcrustes.h ++++ b/src/ImathTest/testProcrustes.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testProcrustes(); ++void testProcrustes (); +diff --git a/src/ImathTest/testQuat.cpp b/src/ImathTest/testQuat.cpp +index c513e78..8af1cda 100644 +--- a/src/ImathTest/testQuat.cpp ++++ b/src/ImathTest/testQuat.cpp +@@ -7,6 +7,7 @@ + # undef NDEBUG + #endif + ++#include "testQuat.h" + #include + #include + #include +@@ -14,7 +15,6 @@ + #include + #include + #include +-#include "testQuat.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -29,25 +29,25 @@ template + void + testQuatT () + { +- const T s = std::numeric_limits::min(); +- const T e = 4 * std::numeric_limits::epsilon(); ++ const T s = std::numeric_limits::min (); ++ const T e = 4 * std::numeric_limits::epsilon (); + + // + // constructors, r(), v() + // + + { +- Quat q = Quat(); +- assert (q.r == 1 && q.v == Vec3 (0, 0, 0)); ++ Quat q = Quat (); ++ assert (q.r == 1 && q.v == Vec3 (0, 0, 0)); + +- q = Quat (2, 3, 4, 5); +- assert (q.r == 2 && q.v == Vec3 (3, 4, 5)); ++ q = Quat (2, 3, 4, 5); ++ assert (q.r == 2 && q.v == Vec3 (3, 4, 5)); + +- q = Quat (6, Vec3 (7, 8, 9)); +- assert (q.r == 6 && q.v == Vec3 (7, 8, 9)); ++ q = Quat (6, Vec3 (7, 8, 9)); ++ assert (q.r == 6 && q.v == Vec3 (7, 8, 9)); + +- Quat q1 = Quat (q); +- assert (q1.r == 6 && q1.v == Vec3 (7, 8, 9)); ++ Quat q1 = Quat (q); ++ assert (q1.r == 6 && q1.v == Vec3 (7, 8, 9)); + } + + // +@@ -55,11 +55,11 @@ testQuatT () + // + + { +- Quat q = Quat (1, 0, 0, 1); +- assert (q.inverse() == Quat (0.5, 0, 0, -0.5)); ++ Quat q = Quat (1, 0, 0, 1); ++ assert (q.inverse () == Quat (0.5, 0, 0, -0.5)); + +- q.invert(); +- assert (q == Quat (0.5, 0, 0, -0.5)); ++ q.invert (); ++ assert (q == Quat (0.5, 0, 0, -0.5)); + } + + // +@@ -67,17 +67,17 @@ testQuatT () + // + + { +- Quat q = Quat (2, Vec3 (0, 0, 0)); +- assert (q.normalized() == Quat (1, 0, 0, 0)); ++ Quat q = Quat (2, Vec3 (0, 0, 0)); ++ assert (q.normalized () == Quat (1, 0, 0, 0)); + +- q.normalize(); +- assert (q == Quat (1, 0, 0, 0)); ++ q.normalize (); ++ assert (q == Quat (1, 0, 0, 0)); + +- q = Quat (0, Vec3 (0, 2, 0)); +- assert (q.normalized() == Quat (0, 0, 1, 0)); ++ q = Quat (0, Vec3 (0, 2, 0)); ++ assert (q.normalized () == Quat (0, 0, 1, 0)); + +- q.normalize(); +- assert (q == Quat (0, 0, 1, 0)); ++ q.normalize (); ++ assert (q == Quat (0, 0, 1, 0)); + } + + // +@@ -85,8 +85,8 @@ testQuatT () + // + + { +- Quat q = Quat (3, 0, 4, 0); +- assert (q.length() == 5); ++ Quat q = Quat (3, 0, 4, 0); ++ assert (q.length () == 5); + } + + // +@@ -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), 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 *= 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 = 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 = 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)); + } + + // +@@ -148,10 +148,10 @@ testQuatT () + // + + { +- Quat q; +- q.setRotation (Vec3 (1, 0, 0), Vec3 (0, 1, 0)); ++ Quat q; ++ q.setRotation (Vec3 (1, 0, 0), Vec3 (0, 1, 0)); + +- Matrix33 m1 = q.toMatrix33(); ++ Matrix33 m1 = q.toMatrix33 (); + + // clang-format off + +@@ -174,23 +174,30 @@ testQuatT () + // +, - (unary and binary), ~ *, /, ^ + // + +- assert (Quat (1, 2, 3, 4) + Quat (5, 6, 7, 8) == Quat (6, 8, 10, 12)); ++ assert ( ++ Quat (1, 2, 3, 4) + Quat (5, 6, 7, 8) == Quat (6, 8, 10, 12)); + +- assert (Quat (-1, -2, -3, -4) - Quat (5, 6, 7, 8) == Quat (-6, -8, -10, -12)); ++ assert ( ++ Quat (-1, -2, -3, -4) - Quat (5, 6, 7, 8) == ++ Quat (-6, -8, -10, -12)); + + assert (-Quat (1, 2, 3, 4) == Quat (-1, -2, -3, -4)); +- ++ + assert (~Quat (1, 2, 3, 4) == Quat (1, -2, -3, -4)); + + assert (T (2) * Quat (1, 2, 3, 4) == Quat (2, 4, 6, 8)); + +- assert (Quat (1, 2, 3, 4) * T (2 )== Quat (2, 4, 6, 8)); ++ assert (Quat (1, 2, 3, 4) * T (2) == Quat (2, 4, 6, 8)); ++ ++ assert ( ++ Quat (1, 0, 0, 1) * Quat (1, 1, 0, 0) == Quat (1, 1, 1, 1)); + +- assert (Quat (1, 0, 0, 1) * Quat (1, 1, 0, 0) == Quat (1, 1, 1, 1)); ++ assert ( ++ Quat (1, 1, 0, 0) * Quat (1, 0, 0, 1) == Quat (1, 1, -1, 1)); + +- assert (Quat (1, 1, 0, 0) * Quat (1, 0, 0, 1) == Quat (1, 1, -1, 1)); +- +- assert (Quat (1, 0, 0, 1) / Quat (0.5, -0.5, 0, 0) == Quat (1, 1, 1, 1)); ++ assert ( ++ Quat (1, 0, 0, 1) / Quat (0.5, -0.5, 0, 0) == ++ Quat (1, 1, 1, 1)); + + assert (Quat (2, 4, 6, 8) / T (2) == Quat (1, 2, 3, 4)); + +@@ -201,47 +208,45 @@ testQuatT () + // + + { +- Vec3 vFrom (1, 0, 0); +- Vec3 vTo (0, 1, 1); +- Matrix44 m1 = rotationMatrix (vFrom, vTo); +- ++ Vec3 vFrom (1, 0, 0); ++ Vec3 vTo (0, 1, 1); ++ Matrix44 m1 = rotationMatrix (vFrom, vTo); ++ + Quat q = extractQuat (m1); + ; + +- Matrix44 m2 = q.toMatrix44(); ++ Matrix44 m2 = q.toMatrix44 (); + +- assert (m2.equalWithAbsError (m1, 2 * e)); ++ assert (m2.equalWithAbsError (m1, 2 * e)); + } + } + +- + void + testQuatConversions () + { + { +- Quatf q (1, V3f (2, 3, 4)); +- Quatd q1 = Quatd (q); +- assert (q1.r == 1 && q1.v == V3d (2, 3, 4)); ++ Quatf q (1, V3f (2, 3, 4)); ++ Quatd q1 = Quatd (q); ++ assert (q1.r == 1 && q1.v == V3d (2, 3, 4)); + } + + { +- Quatd q (1, V3d (2, 3, 4)); +- Quatf q1 = Quatf (q); +- assert (q1.r == 1 && q1.v == V3f (2, 3, 4)); ++ Quatd q (1, V3d (2, 3, 4)); ++ Quatf q1 = Quatf (q); ++ assert (q1.r == 1 && q1.v == V3f (2, 3, 4)); + } + } + + } // namespace + +- + void + testQuat () + { + cout << "Testing basic quaternion operations" << endl; + +- testQuatT(); +- testQuatT(); +- testQuatConversions(); ++ testQuatT (); ++ testQuatT (); ++ testQuatConversions (); + + cout << "ok\n" << endl; + } +diff --git a/src/ImathTest/testQuat.h b/src/ImathTest/testQuat.h +index 2bc00fc..7433000 100644 +--- a/src/ImathTest/testQuat.h ++++ b/src/ImathTest/testQuat.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testQuat(); ++void testQuat (); +diff --git a/src/ImathTest/testQuatSetRotation.cpp b/src/ImathTest/testQuatSetRotation.cpp +index 23c64ba..270b65d 100644 +--- a/src/ImathTest/testQuatSetRotation.cpp ++++ b/src/ImathTest/testQuatSetRotation.cpp +@@ -7,11 +7,11 @@ + # undef NDEBUG + #endif + ++#include "testQuatSetRotation.h" + #include + #include + #include + #include +-#include "testQuatSetRotation.h" + + using namespace std; + using namespace IMATH_INTERNAL_NAMESPACE; +@@ -28,19 +28,19 @@ testRotation (const V3f& from, const V3f& to) + + Quatf Q; + Q.setRotation (from, to); +- M44f M = Q.toMatrix44(); ++ M44f M = Q.toMatrix44 (); + + // + // Verify that the quaternion rotates vector from into vector to. + // + +- float e = 20 * std::numeric_limits::epsilon(); ++ float e = 20 * std::numeric_limits::epsilon (); + + V3f fromM = from * M; + V3f fromQ = from * Q; +- V3f t0 = to.normalized(); +- V3f fM0 = fromM.normalized(); +- V3f fQ0 = fromQ.normalized(); ++ V3f t0 = to.normalized (); ++ V3f fM0 = fromM.normalized (); ++ V3f fQ0 = fromQ.normalized (); + + assert (t0.equalWithAbsError (fM0, e)); + assert (t0.equalWithAbsError (fQ0, e)); +@@ -49,11 +49,11 @@ testRotation (const V3f& from, const V3f& to) + // Verify that the rotation axis is the cross product of from and to. + // + +- V3f f0 = from.normalized(); ++ V3f f0 = from.normalized (); + + if (abs (f0 ^ t0) < 0.9) + { +- V3f n0 = (from % to).normalized(); ++ V3f n0 = (from % to).normalized (); + V3f n0M = n0 * M; + + assert (n0.equalWithAbsError (n0M, e)); +@@ -61,7 +61,7 @@ testRotation (const V3f& from, const V3f& to) + } + + void +-specificVectors() ++specificVectors () + { + cout << " exact 90-degree rotations" << endl; + +@@ -108,7 +108,7 @@ specificVectors() + } + + void +-randomVectors() ++randomVectors () + { + cout << " random from and to vectors" << endl; + +@@ -123,12 +123,12 @@ randomVectors() + } + + void +-nearlyEqualVectors() ++nearlyEqualVectors () + { + cout << " nearly equal from and to vectors" << endl; + + Rand48 rand (19); +- float e = 100 * std::numeric_limits::epsilon(); ++ float e = 100 * std::numeric_limits::epsilon (); + + for (int i = 0; i < 500000; ++i) + { +@@ -139,12 +139,12 @@ nearlyEqualVectors() + } + + void +-nearlyOppositeVectors() ++nearlyOppositeVectors () + { + cout << " nearly opposite from and to vectors" << endl; + + Rand48 rand (19); +- float e = 100 * std::numeric_limits::epsilon(); ++ float e = 100 * std::numeric_limits::epsilon (); + + for (int i = 0; i < 500000; ++i) + { +@@ -157,14 +157,14 @@ nearlyOppositeVectors() + } // namespace + + void +-testQuatSetRotation() ++testQuatSetRotation () + { + cout << "Testing quaternion rotations" << endl; + +- specificVectors(); +- randomVectors(); +- nearlyEqualVectors(); +- nearlyOppositeVectors(); ++ specificVectors (); ++ randomVectors (); ++ nearlyEqualVectors (); ++ nearlyOppositeVectors (); + + cout << "ok\n" << endl; + } +diff --git a/src/ImathTest/testQuatSetRotation.h b/src/ImathTest/testQuatSetRotation.h +index fc3d30a..a7240e6 100644 +--- a/src/ImathTest/testQuatSetRotation.h ++++ b/src/ImathTest/testQuatSetRotation.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testQuatSetRotation(); ++void testQuatSetRotation (); +diff --git a/src/ImathTest/testQuatSlerp.cpp b/src/ImathTest/testQuatSlerp.cpp +index 0822bf6..4c437fa 100644 +--- a/src/ImathTest/testQuatSlerp.cpp ++++ b/src/ImathTest/testQuatSlerp.cpp +@@ -7,12 +7,12 @@ + # undef NDEBUG + #endif + ++#include "testQuatSlerp.h" + #include + #include + #include + #include + #include +-#include "testQuatSlerp.h" + + using namespace std; + using namespace IMATH_INTERNAL_NAMESPACE; +@@ -62,11 +62,11 @@ testSlerp (const Quatf q1, const Quatf q2, int m, int n) + // + + Quatf qi; +- Quatf q3 = q1.inverse() * q2; ++ Quatf q3 = q1.inverse () * q2; + Quatf q1q2 = slerp (q1, q2, float (m) / float (n)); + Quatf qiq3 = slerp (qi, q3, float (m) / float (n)); +- float e1 = 60 * std::numeric_limits::epsilon(); +- float e2 = 600 * std::numeric_limits::epsilon(); ++ float e1 = 60 * std::numeric_limits::epsilon (); ++ float e2 = 600 * std::numeric_limits::epsilon (); + + compareQuats (q1q2, q1 * qiq3, e1); + compareQuats (pow (qiq3, n), pow (q3, m), e2); +@@ -82,7 +82,7 @@ testSlerp (const Quatf q1, const Quatf q2) + } + + void +-specificRotations() ++specificRotations () + { + cout << " combinations of 90-degree rotations around x, y and z" << endl; + +@@ -125,7 +125,7 @@ specificRotations() + } + + void +-randomRotations() ++randomRotations () + { + cout << " random rotations" << endl; + +@@ -133,8 +133,8 @@ randomRotations() + + for (int i = 0; i < 10000; ++i) + { +- V3f axis1 = hollowSphereRand (rand); +- V3f axis2 = hollowSphereRand (rand); ++ V3f axis1 = hollowSphereRand (rand); ++ V3f axis2 = hollowSphereRand (rand); + float angle1 = rand.nextf (0, M_PI); + float angle2 = rand.nextf (0, M_PI); + +@@ -156,12 +156,12 @@ randomRotations() + } // namespace + + void +-testQuatSlerp() ++testQuatSlerp () + { + cout << "Testing quaternion spherical linear interpolation" << endl; + +- specificRotations(); +- randomRotations(); ++ specificRotations (); ++ randomRotations (); + + cout << "ok\n" << endl; + } +diff --git a/src/ImathTest/testQuatSlerp.h b/src/ImathTest/testQuatSlerp.h +index 6249123..7f7df29 100644 +--- a/src/ImathTest/testQuatSlerp.h ++++ b/src/ImathTest/testQuatSlerp.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testQuatSlerp(); ++void testQuatSlerp (); +diff --git a/src/ImathTest/testRandom.cpp b/src/ImathTest/testRandom.cpp +index e0c06e9..af66485 100644 +--- a/src/ImathTest/testRandom.cpp ++++ b/src/ImathTest/testRandom.cpp +@@ -7,13 +7,13 @@ + # undef NDEBUG + #endif + ++#include "testRandom.h" + #include + #include + #include + #include + #include + #include +-#include "testRandom.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -25,7 +25,7 @@ namespace + { + + void +-testErand48() ++testErand48 () + { + // + // Our implementation of erand48(), nrand48(), etc. +@@ -45,11 +45,16 @@ testErand48() + state[1] = 1; + state[2] = 2; + +- assert (abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.671004) < 0.00001); +- assert (abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.786905) < 0.00001); +- assert (abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.316850) < 0.00001); +- assert (abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.384870) < 0.00001); +- assert (abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.854650) < 0.00001); ++ assert ( ++ abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.671004) < 0.00001); ++ assert ( ++ abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.786905) < 0.00001); ++ assert ( ++ abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.316850) < 0.00001); ++ assert ( ++ abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.384870) < 0.00001); ++ assert ( ++ abs (IMATH_INTERNAL_NAMESPACE::erand48 (state) - 0.854650) < 0.00001); + + assert (IMATH_INTERNAL_NAMESPACE::nrand48 (state) == 0x4f4e8cb0); + assert (IMATH_INTERNAL_NAMESPACE::nrand48 (state) == 0x063e864b); +@@ -64,7 +69,7 @@ testErand48() + + template + void +-testGenerator() ++testGenerator () + { + // + // Test if the values, and the differences between +@@ -74,8 +79,8 @@ testGenerator() + const int N = 10; + const int M = 100000; + +- int values[N + 1]; +- int diffs[2 * N + 3]; ++ int values[N + 1]; ++ int diffs[2 * N + 3]; + int* v = &values[0]; + int* d = &diffs[N + 2]; + +@@ -85,7 +90,7 @@ testGenerator() + for (int i = -N; i <= N; ++i) + d[i] = 0; + +- Rand rand (0); ++ Rand rand (0); + float previous = 0; + + for (int i = 0; i < M * N; ++i) +@@ -135,11 +140,9 @@ testGenerator() + { + double r = rand.nextf (0.0, 1.0); + +- if (rMin > r) +- rMin = r; ++ if (rMin > r) rMin = r; + +- if (rMax < r) +- rMax = r; ++ if (rMax < r) rMax = r; + } + + assert (rMin < 0.0001 && rMax > 0.9999); +@@ -161,11 +164,11 @@ testGenerator() + + template + void +-testSolidSphere() ++testSolidSphere () + { + const int N = 10; + const int M = 10000; +- int v[N + 1]; ++ int v[N + 1]; + + for (int i = 0; i <= N; ++i) + v[i] = 0; +@@ -175,8 +178,9 @@ testSolidSphere() + for (int i = 0; i < M * N; ++i) + { + IMATH_INTERNAL_NAMESPACE::V3f p = +- IMATH_INTERNAL_NAMESPACE::solidSphereRand (rand); +- float l = p.length(); ++ IMATH_INTERNAL_NAMESPACE::solidSphereRand< ++ IMATH_INTERNAL_NAMESPACE::V3f> (rand); ++ float l = p.length (); + v[IMATH_INTERNAL_NAMESPACE::floor (l * N)] += 1; + + assert (l < 1.00001); +@@ -188,16 +192,17 @@ testSolidSphere() + + template + void +-testHollowSphere() ++testHollowSphere () + { + const int M = 100000; +- Rand rand (0); ++ Rand rand (0); + + for (int i = 0; i < M; ++i) + { + IMATH_INTERNAL_NAMESPACE::V3f p = +- IMATH_INTERNAL_NAMESPACE::hollowSphereRand (rand); +- float l = p.length(); ++ IMATH_INTERNAL_NAMESPACE::hollowSphereRand< ++ IMATH_INTERNAL_NAMESPACE::V3f> (rand); ++ float l = p.length (); + + assert (abs (l - 1) < 0.00001); + } +@@ -206,24 +211,24 @@ testHollowSphere() + } // namespace + + void +-testRandom() ++testRandom () + { + cout << "Testing random number generators" << endl; + + cout << "erand48(), nrand48()" << endl; +- testErand48(); ++ testErand48 (); + + cout << "Rand32" << endl; +- testGenerator(); ++ testGenerator (); + + cout << "Rand48" << endl; +- testGenerator(); ++ testGenerator (); + + cout << "solidSphereRand()" << endl; +- testSolidSphere(); ++ testSolidSphere (); + + cout << "hollowSphereRand()" << endl; +- testHollowSphere(); ++ testHollowSphere (); + + cout << "ok\n" << endl; + } +diff --git a/src/ImathTest/testRandom.h b/src/ImathTest/testRandom.h +index fd25453..f12fc4a 100644 +--- a/src/ImathTest/testRandom.h ++++ b/src/ImathTest/testRandom.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testRandom(); ++void testRandom (); +diff --git a/src/ImathTest/testRoots.cpp b/src/ImathTest/testRoots.cpp +index a82aa11..6aef933 100644 +--- a/src/ImathTest/testRoots.cpp ++++ b/src/ImathTest/testRoots.cpp +@@ -7,13 +7,13 @@ + # undef NDEBUG + #endif + ++#include "testRoots.h" + #include + #include + #include + #include + #include + #include +-#include "testRoots.h" + + using namespace std; + +@@ -22,18 +22,14 @@ sort (int nx, double& x0, double& x1, double& x2) + { + if (nx == 2) + { +- if (x0 > x1) +- swap (x0, x1); ++ if (x0 > x1) swap (x0, x1); + } + + if (nx == 3) + { +- if (x0 > x1) +- swap (x0, x1); +- if (x1 > x2) +- swap (x1, x2); +- if (x0 > x1) +- swap (x0, x1); ++ if (x0 > x1) swap (x0, x1); ++ if (x1 > x2) swap (x1, x2); ++ if (x0 > x1) swap (x0, x1); + } + } + +@@ -42,40 +38,37 @@ sort (int nx, double x[]) + { + if (nx == 2) + { +- if (x[0] > x[1]) +- swap (x[0], x[1]); ++ if (x[0] > x[1]) swap (x[0], x[1]); + } + + if (nx == 3) + { +- if (x[0] > x[1]) +- swap (x[0], x[1]); +- if (x[1] > x[2]) +- swap (x[1], x[2]); +- if (x[0] > x[1]) +- swap (x[0], x[1]); ++ if (x[0] > x[1]) swap (x[0], x[1]); ++ if (x[1] > x[2]) swap (x[1], x[2]); ++ if (x[0] > x[1]) swap (x[0], x[1]); + } + } + + void +-solve (double a, +- double b, +- double c, +- double d, // coefficients +- int nx, // number of expected solutions +- double x0, +- double x1, +- double x2) // expected solutions ++solve ( ++ double a, ++ double b, ++ double c, ++ double d, // coefficients ++ int nx, // number of expected solutions ++ double x0, ++ double x1, ++ double x2) // expected solutions + { +- cout << "coefficients: " << setw (3) << a << ' ' << setw (3) << b << ' ' << setw (3) << c << ' ' +- << setw (3) << d << ' '; ++ cout << "coefficients: " << setw (3) << a << ' ' << setw (3) << b << ' ' ++ << setw (3) << c << ' ' << setw (3) << d << ' '; + + // + // Solve the equation a*x^3 + b*x^2 + c*x +d + // + + double x[3]; +- int n = IMATH_INTERNAL_NAMESPACE::solveCubic (a, b, c, d, x); ++ int n = IMATH_INTERNAL_NAMESPACE::solveCubic (a, b, c, d, x); + + // + // Sort the numerical solutions. +@@ -92,11 +85,9 @@ solve (double a, + + cout << " solutions: "; + +- if (n == -1) +- cout << "[-inf, inf]"; ++ if (n == -1) cout << "[-inf, inf]"; + +- if (n == 0) +- cout << "none"; ++ if (n == 0) cout << "none"; + + const double e = 0.0000001; // maximum expected error for + // the test cases listed below +@@ -120,21 +111,22 @@ solve (double a, + } + + void +-solve (double a, +- double b, +- double c, // coefficients +- int nx, // number of expected solutions +- double x0, +- double x1) // expected solutions ++solve ( ++ double a, ++ double b, ++ double c, // coefficients ++ int nx, // number of expected solutions ++ double x0, ++ double x1) // expected solutions + { +- cout << "coefficients: " << setw (3) << a << ' ' << setw (3) << b << ' ' << setw (3) << c +- << ' '; ++ cout << "coefficients: " << setw (3) << a << ' ' << setw (3) << b << ' ' ++ << setw (3) << c << ' '; + // + // Solve the equation a*x^2 + b*x^1 + c*x + // + +- double x[2] = { 0.0, 0.0 }; +- int n = IMATH_INTERNAL_NAMESPACE::solveQuadratic (a, b, c, x); ++ double x[2] = {0.0, 0.0}; ++ int n = IMATH_INTERNAL_NAMESPACE::solveQuadratic (a, b, c, x); + + // + // Sort the numerical solutions. +@@ -152,11 +144,9 @@ solve (double a, + assert (n == nx); + cout << " solutions: "; + +- if (n == -1) +- cout << "[-inf, inf]"; ++ if (n == -1) cout << "[-inf, inf]"; + +- if (n == 0) +- cout << "none"; ++ if (n == 0) cout << "none"; + + const double e = 0.0000001; // maximum expected error for + // the test cases listed below +@@ -177,7 +167,7 @@ solve (double a, + } + + void +-testRoots() ++testRoots () + { + cout << "Testing functions in ImathRoots.h" << endl; + +diff --git a/src/ImathTest/testRoots.h b/src/ImathTest/testRoots.h +index b8234ea..1b7f9ac 100644 +--- a/src/ImathTest/testRoots.h ++++ b/src/ImathTest/testRoots.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testRoots(); ++void testRoots (); +diff --git a/src/ImathTest/testShear.cpp b/src/ImathTest/testShear.cpp +index 21b9e9b..110488f 100644 +--- a/src/ImathTest/testShear.cpp ++++ b/src/ImathTest/testShear.cpp +@@ -7,11 +7,11 @@ + # undef NDEBUG + #endif + ++#include "testShear.h" + #include + #include + #include + #include +-#include "testShear.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -19,20 +19,21 @@ + using namespace std; + + void +-testShear() ++testShear () + { + cout << "Testing functions in ImathShear.h" << endl; + + cout << "Imath::Shear6 constructors" << endl; + +- const float epsilon = std::numeric_limits::epsilon(); ++ const float epsilon = std::numeric_limits::epsilon (); + + IMATH_INTERNAL_NAMESPACE::Shear6f testConstructor1; + IMATH_INTERNAL_NAMESPACE::Shear6f testConstructor2 (testConstructor1); + + testConstructor1 = testConstructor2; + +- IMATH_INTERNAL_NAMESPACE::Shear6f testConstructor3 (52, 128, 254, 127, 12, -20); ++ IMATH_INTERNAL_NAMESPACE::Shear6f testConstructor3 ( ++ 52, 128, 254, 127, 12, -20); + IMATH_INTERNAL_NAMESPACE::Shear6f A (testConstructor3); + IMATH_INTERNAL_NAMESPACE::Shear6f B = A; + IMATH_INTERNAL_NAMESPACE::Shear6f X, Y, tmp; +@@ -41,23 +42,31 @@ testShear() + + cout << "Imath::Shear6 * f" << endl; + +- assert ((IMATH_INTERNAL_NAMESPACE::Shear6f (0.330f, 0.710f, 0.010f, 0.999f, -0.531f, -0.012f) * +- 0.999f) == IMATH_INTERNAL_NAMESPACE::Shear6f (0.330f * 0.999f, +- 0.710f * 0.999f, +- 0.010f * 0.999f, +- 0.999f * 0.999f, +- -0.531f * 0.999f, +- -0.012f * 0.999f)); ++ assert ( ++ (IMATH_INTERNAL_NAMESPACE::Shear6f ( ++ 0.330f, 0.710f, 0.010f, 0.999f, -0.531f, -0.012f) * ++ 0.999f) == ++ IMATH_INTERNAL_NAMESPACE::Shear6f ( ++ 0.330f * 0.999f, ++ 0.710f * 0.999f, ++ 0.010f * 0.999f, ++ 0.999f * 0.999f, ++ -0.531f * 0.999f, ++ -0.012f * 0.999f)); + + cout << "Imath::Shear6 / f" << endl; + +- assert ((IMATH_INTERNAL_NAMESPACE::Shear6f (0.330f, 0.710f, 0.010f, 0.999f, -0.531f, -0.012f) / +- 0.999f) == IMATH_INTERNAL_NAMESPACE::Shear6f (0.330f / 0.999f, +- 0.710f / 0.999f, +- 0.010f / 0.999f, +- 0.999f / 0.999f, +- -0.531f / 0.999f, +- -0.012f / 0.999f)); ++ assert ( ++ (IMATH_INTERNAL_NAMESPACE::Shear6f ( ++ 0.330f, 0.710f, 0.010f, 0.999f, -0.531f, -0.012f) / ++ 0.999f) == ++ IMATH_INTERNAL_NAMESPACE::Shear6f ( ++ 0.330f / 0.999f, ++ 0.710f / 0.999f, ++ 0.010f / 0.999f, ++ 0.999f / 0.999f, ++ -0.531f / 0.999f, ++ -0.012f / 0.999f)); + + cout << "Assignment and comparison" << endl; + +@@ -65,99 +74,112 @@ testShear() + assert (B == A); + assert (!(B != A)); + +- X = Y = IMATH_INTERNAL_NAMESPACE::Shear6f (0.123f, -0.420f, 0.501f, 0.998f, -0.231f, -0.034f); ++ X = Y = IMATH_INTERNAL_NAMESPACE::Shear6f ( ++ 0.123f, -0.420f, 0.501f, 0.998f, -0.231f, -0.034f); + + X *= 0.001f; + +- assert (std::fabs ((Y.xy * 0.001f) - X.xy) <= epsilon && +- std::fabs ((Y.xz * 0.001f) - X.xz) <= epsilon && +- std::fabs ((Y.yz * 0.001f) - X.yz) <= epsilon && +- std::fabs ((Y.yx * 0.001f) - X.yx) <= epsilon && +- std::fabs ((Y.zx * 0.001f) - X.zx) <= epsilon && +- std::fabs ((Y.zy * 0.001f) - X.zy) <= epsilon); ++ assert ( ++ std::fabs ((Y.xy * 0.001f) - X.xy) <= epsilon && ++ std::fabs ((Y.xz * 0.001f) - X.xz) <= epsilon && ++ std::fabs ((Y.yz * 0.001f) - X.yz) <= epsilon && ++ std::fabs ((Y.yx * 0.001f) - X.yx) <= epsilon && ++ std::fabs ((Y.zx * 0.001f) - X.zx) <= epsilon && ++ std::fabs ((Y.zy * 0.001f) - X.zy) <= epsilon); + +- X = Y = IMATH_INTERNAL_NAMESPACE::Shear6f (0.123f, -0.420f, 0.501f, 0.998f, -0.231f, -0.034f); ++ X = Y = IMATH_INTERNAL_NAMESPACE::Shear6f ( ++ 0.123f, -0.420f, 0.501f, 0.998f, -0.231f, -0.034f); + + X /= -1.001f; + +- assert (std::fabs ((Y.xy / -1.001f) - X.xy) <= epsilon && +- std::fabs ((Y.xz / -1.001f) - X.xz) <= epsilon && +- std::fabs ((Y.yz / -1.001f) - X.yz) <= epsilon && +- std::fabs ((Y.yx / -1.001f) - X.yx) <= epsilon && +- std::fabs ((Y.zx / -1.001f) - X.zx) <= epsilon && +- std::fabs ((Y.zy / -1.001f) - X.zy) <= epsilon); ++ assert ( ++ std::fabs ((Y.xy / -1.001f) - X.xy) <= epsilon && ++ std::fabs ((Y.xz / -1.001f) - X.xz) <= epsilon && ++ std::fabs ((Y.yz / -1.001f) - X.yz) <= epsilon && ++ std::fabs ((Y.yx / -1.001f) - X.yx) <= epsilon && ++ std::fabs ((Y.zx / -1.001f) - X.zx) <= epsilon && ++ std::fabs ((Y.zy / -1.001f) - X.zy) <= epsilon); + +- Y = IMATH_INTERNAL_NAMESPACE::Shear6f (0.998f, -0.001f, 0.501f, 1.001f, -0.231f, -0.034f); +- X = IMATH_INTERNAL_NAMESPACE::Shear6f (0.011f, -0.420f, -0.501f, 0.998f, -0.231f, -0.034f); ++ Y = IMATH_INTERNAL_NAMESPACE::Shear6f ( ++ 0.998f, -0.001f, 0.501f, 1.001f, -0.231f, -0.034f); ++ X = IMATH_INTERNAL_NAMESPACE::Shear6f ( ++ 0.011f, -0.420f, -0.501f, 0.998f, -0.231f, -0.034f); + + tmp = X + Y; + +- assert (std::fabs ((X.xy + Y.xy) - tmp.xy) <= epsilon && +- std::fabs ((X.xz + Y.xz) - tmp.xz) <= epsilon && +- std::fabs ((X.yz + Y.yz) - tmp.yz) <= epsilon && +- std::fabs ((X.yx + Y.yx) - tmp.yx) <= epsilon && +- std::fabs ((X.zx + Y.zx) - tmp.zx) <= epsilon && +- std::fabs ((X.zy + Y.zy) - tmp.zy) <= epsilon); ++ assert ( ++ std::fabs ((X.xy + Y.xy) - tmp.xy) <= epsilon && ++ std::fabs ((X.xz + Y.xz) - tmp.xz) <= epsilon && ++ std::fabs ((X.yz + Y.yz) - tmp.yz) <= epsilon && ++ std::fabs ((X.yx + Y.yx) - tmp.yx) <= epsilon && ++ std::fabs ((X.zx + Y.zx) - tmp.zx) <= epsilon && ++ std::fabs ((X.zy + Y.zy) - tmp.zy) <= epsilon); + + tmp = X - Y; + +- assert (std::fabs ((X.xy - Y.xy) - tmp.xy) <= epsilon && +- std::fabs ((X.xz - Y.xz) - tmp.xz) <= epsilon && +- std::fabs ((X.yz - Y.yz) - tmp.yz) <= epsilon && +- std::fabs ((X.yx - Y.yx) - tmp.yx) <= epsilon && +- std::fabs ((X.zx - Y.zx) - tmp.zx) <= epsilon && +- std::fabs ((X.zy - Y.zy) - tmp.zy) <= epsilon); ++ assert ( ++ std::fabs ((X.xy - Y.xy) - tmp.xy) <= epsilon && ++ std::fabs ((X.xz - Y.xz) - tmp.xz) <= epsilon && ++ std::fabs ((X.yz - Y.yz) - tmp.yz) <= epsilon && ++ std::fabs ((X.yx - Y.yx) - tmp.yx) <= epsilon && ++ std::fabs ((X.zx - Y.zx) - tmp.zx) <= epsilon && ++ std::fabs ((X.zy - Y.zy) - tmp.zy) <= epsilon); + + tmp = X * Y; + +- assert (std::fabs ((X.xy * Y.xy) - tmp.xy) <= epsilon && +- std::fabs ((X.xz * Y.xz) - tmp.xz) <= epsilon && +- std::fabs ((X.yz * Y.yz) - tmp.yz) <= epsilon && +- std::fabs ((X.yx * Y.yx) - tmp.yx) <= epsilon && +- std::fabs ((X.zx * Y.zx) - tmp.zx) <= epsilon && +- std::fabs ((X.zy * Y.zy) - tmp.zy) <= epsilon); ++ assert ( ++ std::fabs ((X.xy * Y.xy) - tmp.xy) <= epsilon && ++ std::fabs ((X.xz * Y.xz) - tmp.xz) <= epsilon && ++ std::fabs ((X.yz * Y.yz) - tmp.yz) <= epsilon && ++ std::fabs ((X.yx * Y.yx) - tmp.yx) <= epsilon && ++ std::fabs ((X.zx * Y.zx) - tmp.zx) <= epsilon && ++ std::fabs ((X.zy * Y.zy) - tmp.zy) <= epsilon); + + tmp = X / Y; + + // + // epsilon doesn't work here. + // +- assert (std::fabs ((X.xy / Y.xy) - tmp.xy) <= 1e-5f && +- std::fabs ((X.xz / Y.xz) - tmp.xz) <= 1e-5f && +- std::fabs ((X.yz / Y.yz) - tmp.yz) <= 1e-5f && +- std::fabs ((X.yx / Y.yx) - tmp.yx) <= 1e-5f && +- std::fabs ((X.zx / Y.zx) - tmp.zx) <= 1e-5f && +- std::fabs ((X.zy / Y.zy) - tmp.zy) <= 1e-5f); ++ assert ( ++ std::fabs ((X.xy / Y.xy) - tmp.xy) <= 1e-5f && ++ std::fabs ((X.xz / Y.xz) - tmp.xz) <= 1e-5f && ++ std::fabs ((X.yz / Y.yz) - tmp.yz) <= 1e-5f && ++ std::fabs ((X.yx / Y.yx) - tmp.yx) <= 1e-5f && ++ std::fabs ((X.zx / Y.zx) - tmp.zx) <= 1e-5f && ++ std::fabs ((X.zy / Y.zy) - tmp.zy) <= 1e-5f); + + tmp = X; + tmp += Y; + +- assert (std::fabs ((X.xy + Y.xy) - tmp.xy) <= epsilon && +- std::fabs ((X.xz + Y.xz) - tmp.xz) <= epsilon && +- std::fabs ((X.yz + Y.yz) - tmp.yz) <= epsilon && +- std::fabs ((X.yx + Y.yx) - tmp.yx) <= epsilon && +- std::fabs ((X.zx + Y.zx) - tmp.zx) <= epsilon && +- std::fabs ((X.zy + Y.zy) - tmp.zy) <= epsilon); ++ assert ( ++ std::fabs ((X.xy + Y.xy) - tmp.xy) <= epsilon && ++ std::fabs ((X.xz + Y.xz) - tmp.xz) <= epsilon && ++ std::fabs ((X.yz + Y.yz) - tmp.yz) <= epsilon && ++ std::fabs ((X.yx + Y.yx) - tmp.yx) <= epsilon && ++ std::fabs ((X.zx + Y.zx) - tmp.zx) <= epsilon && ++ std::fabs ((X.zy + Y.zy) - tmp.zy) <= epsilon); + + tmp = X; + tmp -= Y; + +- assert (std::fabs ((X.xy - Y.xy) - tmp.xy) <= epsilon && +- std::fabs ((X.xz - Y.xz) - tmp.xz) <= epsilon && +- std::fabs ((X.yz - Y.yz) - tmp.yz) <= epsilon && +- std::fabs ((X.yx - Y.yx) - tmp.yx) <= epsilon && +- std::fabs ((X.xz - Y.xz) - tmp.xz) <= epsilon && +- std::fabs ((X.yz - Y.yz) - tmp.yz) <= epsilon); ++ assert ( ++ std::fabs ((X.xy - Y.xy) - tmp.xy) <= epsilon && ++ std::fabs ((X.xz - Y.xz) - tmp.xz) <= epsilon && ++ std::fabs ((X.yz - Y.yz) - tmp.yz) <= epsilon && ++ std::fabs ((X.yx - Y.yx) - tmp.yx) <= epsilon && ++ std::fabs ((X.xz - Y.xz) - tmp.xz) <= epsilon && ++ std::fabs ((X.yz - Y.yz) - tmp.yz) <= epsilon); + + tmp = X; + tmp *= Y; + +- assert (std::fabs ((X.xy * Y.xy) - tmp.xy) <= epsilon && +- std::fabs ((X.xz * Y.xz) - tmp.xz) <= epsilon && +- std::fabs ((X.yz * Y.yz) - tmp.yz) <= epsilon && +- std::fabs ((X.yx * Y.yx) - tmp.yx) <= epsilon && +- std::fabs ((X.zx * Y.zx) - tmp.zx) <= epsilon && +- std::fabs ((X.zy * Y.zy) - tmp.zy) <= epsilon); ++ assert ( ++ std::fabs ((X.xy * Y.xy) - tmp.xy) <= epsilon && ++ std::fabs ((X.xz * Y.xz) - tmp.xz) <= epsilon && ++ std::fabs ((X.yz * Y.yz) - tmp.yz) <= epsilon && ++ std::fabs ((X.yx * Y.yx) - tmp.yx) <= epsilon && ++ std::fabs ((X.zx * Y.zx) - tmp.zx) <= epsilon && ++ std::fabs ((X.zy * Y.zy) - tmp.zy) <= epsilon); + + tmp = X; + tmp /= Y; +@@ -165,12 +187,13 @@ testShear() + // + // epsilon doesn't work here. + // +- assert (std::fabs ((X.xy / Y.xy) - tmp.xy) <= 1e-5f && +- std::fabs ((X.xz / Y.xz) - tmp.xz) <= 1e-5f && +- std::fabs ((X.yz / Y.yz) - tmp.yz) <= 1e-5f && +- std::fabs ((X.yx / Y.yx) - tmp.yx) <= 1e-5f && +- std::fabs ((X.zx / Y.zx) - tmp.zx) <= 1e-5f && +- std::fabs ((X.zy / Y.zy) - tmp.zy) <= 1e-5f); ++ assert ( ++ std::fabs ((X.xy / Y.xy) - tmp.xy) <= 1e-5f && ++ std::fabs ((X.xz / Y.xz) - tmp.xz) <= 1e-5f && ++ std::fabs ((X.yz / Y.yz) - tmp.yz) <= 1e-5f && ++ std::fabs ((X.yx / Y.yx) - tmp.yx) <= 1e-5f && ++ std::fabs ((X.zx / Y.zx) - tmp.zx) <= 1e-5f && ++ std::fabs ((X.zy / Y.zy) - tmp.zy) <= 1e-5f); + + cout << "ok\n" << endl; + } +diff --git a/src/ImathTest/testShear.h b/src/ImathTest/testShear.h +index ab3435d..46283ba 100644 +--- a/src/ImathTest/testShear.h ++++ b/src/ImathTest/testShear.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testShear(); ++void testShear (); +diff --git a/src/ImathTest/testSize.cpp b/src/ImathTest/testSize.cpp +index c57ed78..b95f313 100644 +--- a/src/ImathTest/testSize.cpp ++++ b/src/ImathTest/testSize.cpp +@@ -7,22 +7,22 @@ + # undef NDEBUG + #endif + ++#include "testSize.h" + #include "half.h" + #include + #include + #include +-#include "testSize.h" + + using namespace std; + + void +-testSize() ++testSize () + { + cout << "size and alignment\n"; + + half h[2]; + +- int size = sizeof (half); ++ int size = sizeof (half); + ptrdiff_t algn = (char*) &h[1] - (char*) &h[0]; + + cout << "sizeof (half) = " << size << endl; +diff --git a/src/ImathTest/testSize.h b/src/ImathTest/testSize.h +index 53cc512..5a535c9 100644 +--- a/src/ImathTest/testSize.h ++++ b/src/ImathTest/testSize.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testSize(); ++void testSize (); +diff --git a/src/ImathTest/testTinySVD.cpp b/src/ImathTest/testTinySVD.cpp +index 4c3be66..d2ca3d3 100644 +--- a/src/ImathTest/testTinySVD.cpp ++++ b/src/ImathTest/testTinySVD.cpp +@@ -18,9 +18,9 @@ template + void + verifyOrthonormal (const IMATH_INTERNAL_NAMESPACE::Matrix33& A) + { +- const T valueEps = T (100) * std::numeric_limits::epsilon(); ++ const T valueEps = T (100) * std::numeric_limits::epsilon (); + +- const IMATH_INTERNAL_NAMESPACE::Matrix33 prod = A * A.transposed(); ++ const IMATH_INTERNAL_NAMESPACE::Matrix33 prod = A * A.transposed (); + for (int i = 0; i < 3; ++i) + { + for (int j = 0; j < 3; ++j) +@@ -37,9 +37,9 @@ template + void + verifyOrthonormal (const IMATH_INTERNAL_NAMESPACE::Matrix44& A) + { +- const T valueEps = T (100) * std::numeric_limits::epsilon(); ++ const T valueEps = T (100) * std::numeric_limits::epsilon (); + +- const IMATH_INTERNAL_NAMESPACE::Matrix44 prod = A * A.transposed(); ++ const IMATH_INTERNAL_NAMESPACE::Matrix44 prod = A * A.transposed (); + for (int i = 0; i < 4; ++i) + { + for (int j = 0; j < 4; ++j) +@@ -61,7 +61,7 @@ verifyTinySVD_3x3 (const IMATH_INTERNAL_NAMESPACE::Matrix33& A) + for (int j = 0; j < 3; ++j) + maxEntry = std::max (maxEntry, std::abs (A[i][j])); + +- const T eps = std::numeric_limits::epsilon(); ++ const T eps = std::numeric_limits::epsilon (); + const T valueEps = maxEntry * T (10) * eps; + + for (int i = 0; i < 2; ++i) +@@ -69,14 +69,14 @@ verifyTinySVD_3x3 (const IMATH_INTERNAL_NAMESPACE::Matrix33& A) + const bool posDet = (i == 0); + + IMATH_INTERNAL_NAMESPACE::Matrix33 U, V; +- IMATH_INTERNAL_NAMESPACE::Vec3 S; ++ IMATH_INTERNAL_NAMESPACE::Vec3 S; + IMATH_INTERNAL_NAMESPACE::jacobiSVD (A, U, S, V, eps, posDet); + + IMATH_INTERNAL_NAMESPACE::Matrix33 S_times_Vt; + for (int i = 0; i < 3; ++i) + for (int j = 0; j < 3; ++j) + S_times_Vt[i][j] = S[j] * V[i][j]; +- S_times_Vt.transpose(); ++ S_times_Vt.transpose (); + + // Verify that the product of the matrices is A: + const IMATH_INTERNAL_NAMESPACE::Matrix33 product = U * S_times_Vt; +@@ -87,8 +87,8 @@ verifyTinySVD_3x3 (const IMATH_INTERNAL_NAMESPACE::Matrix33& A) + // Verify that U and V are orthogonal: + if (posDet) + { +- assert (U.determinant() > 0.9); +- assert (V.determinant() > 0.9); ++ assert (U.determinant () > 0.9); ++ assert (V.determinant () > 0.9); + } + + // Verify that the singular values are sorted: +@@ -99,8 +99,7 @@ verifyTinySVD_3x3 (const IMATH_INTERNAL_NAMESPACE::Matrix33& A) + for (int i = 0; i < 2; ++i) + assert (S[i] >= T (0)); + +- if (!posDet) +- assert (S[2] >= T (0)); ++ if (!posDet) assert (S[2] >= T (0)); + + verifyOrthonormal (U); + verifyOrthonormal (V); +@@ -116,7 +115,7 @@ verifyTinySVD_4x4 (const IMATH_INTERNAL_NAMESPACE::Matrix44& A) + for (int j = 0; j < 4; ++j) + maxEntry = std::max (maxEntry, std::abs (A[i][j])); + +- const T eps = std::numeric_limits::epsilon(); ++ const T eps = std::numeric_limits::epsilon (); + const T valueEps = maxEntry * T (100) * eps; + + for (int i = 0; i < 2; ++i) +@@ -124,14 +123,14 @@ verifyTinySVD_4x4 (const IMATH_INTERNAL_NAMESPACE::Matrix44& A) + const bool posDet = (i == 0); + + IMATH_INTERNAL_NAMESPACE::Matrix44 U, V; +- IMATH_INTERNAL_NAMESPACE::Vec4 S; ++ IMATH_INTERNAL_NAMESPACE::Vec4 S; + IMATH_INTERNAL_NAMESPACE::jacobiSVD (A, U, S, V, eps, posDet); + + IMATH_INTERNAL_NAMESPACE::Matrix44 S_times_Vt; + for (int i = 0; i < 4; ++i) + for (int j = 0; j < 4; ++j) + S_times_Vt[i][j] = S[j] * V[i][j]; +- S_times_Vt.transpose(); ++ S_times_Vt.transpose (); + + // Verify that the product of the matrices is A: + const IMATH_INTERNAL_NAMESPACE::Matrix44 product = U * S_times_Vt; +@@ -142,8 +141,8 @@ verifyTinySVD_4x4 (const IMATH_INTERNAL_NAMESPACE::Matrix44& A) + // Verify that U and V have positive determinant if requested: + if (posDet) + { +- assert (U.determinant() > 0.99); +- assert (V.determinant() > 0.99); ++ assert (U.determinant () > 0.99); ++ assert (V.determinant () > 0.99); + } + + // Verify that the singular values are sorted: +@@ -154,8 +153,7 @@ verifyTinySVD_4x4 (const IMATH_INTERNAL_NAMESPACE::Matrix44& A) + for (int i = 0; i < 3; ++i) + assert (S[i] >= T (0)); + +- if (!posDet) +- assert (S[3] >= T (0)); ++ if (!posDet) assert (S[3] >= T (0)); + + verifyOrthonormal (U); + verifyOrthonormal (V); +@@ -166,15 +164,16 @@ template + void + testTinySVD_3x3 (const IMATH_INTERNAL_NAMESPACE::Matrix33& A) + { +- std::cout << "Verifying SVD for [[" << A[0][0] << ", " << A[0][1] << ", " << A[0][2] << "], " ++ std::cout << "Verifying SVD for [[" << A[0][0] << ", " << A[0][1] << ", " ++ << A[0][2] << "], " + << "[" << A[1][0] << ", " << A[1][1] << ", " << A[1][2] << "], " + << "[" << A[2][0] << ", " << A[2][1] << ", " << A[2][2] << "]]\n"; + + verifyTinySVD_3x3 (A); +- verifyTinySVD_3x3 (A.transposed()); ++ verifyTinySVD_3x3 (A.transposed ()); + + // Try all different orderings of the columns of A: +- int cols[3] = { 0, 1, 2 }; ++ int cols[3] = {0, 1, 2}; + do + { + IMATH_INTERNAL_NAMESPACE::Matrix33 B; +@@ -188,15 +187,16 @@ testTinySVD_3x3 (const IMATH_INTERNAL_NAMESPACE::Matrix33& A) + + template + void +-testTinySVD_3x3 (const T a, +- const T b, +- const T c, +- const T d, +- const T e, +- const T f, +- const T g, +- const T h, +- const T i) ++testTinySVD_3x3 ( ++ const T a, ++ const T b, ++ const T c, ++ const T d, ++ const T e, ++ const T f, ++ const T g, ++ const T h, ++ const T i) + { + const IMATH_INTERNAL_NAMESPACE::Matrix33 A (a, b, c, d, e, f, g, h, i); + testTinySVD_3x3 (A); +@@ -206,17 +206,20 @@ template + void + testTinySVD_4x4 (const IMATH_INTERNAL_NAMESPACE::Matrix44& A) + { +- std::cout << "Verifying SVD for [[" << A[0][0] << ", " << A[0][1] << ", " << A[0][2] << ", " +- << A[0][3] << "], " +- << "[" << A[1][0] << ", " << A[1][1] << ", " << A[1][2] << ", " << A[1][3] << "], " +- << "[" << A[2][0] << ", " << A[2][1] << ", " << A[2][2] << ", " << A[2][3] << "], " +- << "[" << A[3][0] << ", " << A[3][1] << ", " << A[3][2] << ", " << A[3][3] << "]]\n"; ++ std::cout << "Verifying SVD for [[" << A[0][0] << ", " << A[0][1] << ", " ++ << A[0][2] << ", " << A[0][3] << "], " ++ << "[" << A[1][0] << ", " << A[1][1] << ", " << A[1][2] << ", " ++ << A[1][3] << "], " ++ << "[" << A[2][0] << ", " << A[2][1] << ", " << A[2][2] << ", " ++ << A[2][3] << "], " ++ << "[" << A[3][0] << ", " << A[3][1] << ", " << A[3][2] << ", " ++ << A[3][3] << "]]\n"; + + verifyTinySVD_4x4 (A); +- verifyTinySVD_4x4 (A.transposed()); ++ verifyTinySVD_4x4 (A.transposed ()); + + // Try all different orderings of the columns of A: +- int cols[4] = { 0, 1, 2, 3 }; ++ int cols[4] = {0, 1, 2, 3}; + do + { + IMATH_INTERNAL_NAMESPACE::Matrix44 B; +@@ -230,30 +233,32 @@ testTinySVD_4x4 (const IMATH_INTERNAL_NAMESPACE::Matrix44& A) + + template + void +-testTinySVD_4x4 (const T a, +- const T b, +- const T c, +- const T d, +- const T e, +- const T f, +- const T g, +- const T h, +- const T i, +- const T j, +- const T k, +- const T l, +- const T m, +- const T n, +- const T o, +- const T p) ++testTinySVD_4x4 ( ++ const T a, ++ const T b, ++ const T c, ++ const T d, ++ const T e, ++ const T f, ++ const T g, ++ const T h, ++ const T i, ++ const T j, ++ const T k, ++ const T l, ++ const T m, ++ const T n, ++ const T o, ++ const T p) + { +- const IMATH_INTERNAL_NAMESPACE::Matrix44 A (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p); ++ const IMATH_INTERNAL_NAMESPACE::Matrix44 A ( ++ a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p); + testTinySVD_4x4 (A); + } + + template + void +-testTinySVDImp() ++testTinySVDImp () + { + // Try a bunch of 3x3 matrices: + testTinySVD_3x3 (1, 0, 0, 0, 1, 0, 0, 0, 1); +@@ -266,67 +271,77 @@ testTinySVDImp() + testTinySVD_3x3 (1, 0, 0, 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, 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))); + + // 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 ( ++ 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 (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 ( ++ 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); + // 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); + // problematic 2x2 one for lapack on suse (see below), padded with 0's and 1 +@@ -340,23 +355,46 @@ 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, ++ -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))); + } + + void +-testTinySVD() ++testTinySVD () + { +- std::cout << "Testing TinySVD algorithms in single precision..." << std::endl; +- testTinySVDImp(); ++ std::cout << "Testing TinySVD algorithms in single precision..." ++ << std::endl; ++ testTinySVDImp (); + +- std::cout << "Testing TinySVD algorithms in double precision..." << std::endl; +- testTinySVDImp(); ++ std::cout << "Testing TinySVD algorithms in double precision..." ++ << std::endl; ++ testTinySVDImp (); + } +diff --git a/src/ImathTest/testTinySVD.h b/src/ImathTest/testTinySVD.h +index c600d32..864a854 100644 +--- a/src/ImathTest/testTinySVD.h ++++ b/src/ImathTest/testTinySVD.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testTinySVD(); ++void testTinySVD (); +diff --git a/src/ImathTest/testToFloat.cpp b/src/ImathTest/testToFloat.cpp +index 7bcb33a..7c7b553 100644 +--- a/src/ImathTest/testToFloat.cpp ++++ b/src/ImathTest/testToFloat.cpp +@@ -94,10 +94,8 @@ halfToFloat (unsigned short y) + return (s << 31) | (e << 23) | m; + } + +- +- + void +-testToFloat() ++testToFloat () + { + std::cout << "running testToFloat" << std::endl; + +@@ -109,8 +107,8 @@ testToFloat() + + for (unsigned int s = 0; s < iMax; s++) + { +- half hs(half::FromBits, static_cast(s)); +- assert (hs.bits() == s); ++ half hs (half::FromBits, static_cast (s)); ++ assert (hs.bits () == s); + + // + // cast these bits to a float, using the cast-to-float +@@ -141,12 +139,12 @@ testToFloat() + + if (isnan (f)) + { +- assert (h.isNan()); ++ assert (h.isNan ()); + assert (isnan (uif.f)); + } + else if (isinf (f)) + { +- assert (h.isInfinity()); ++ assert (h.isInfinity ()); + assert (isinf (uif.f)); + } + else +diff --git a/src/ImathTest/testToFloat.h b/src/ImathTest/testToFloat.h +index 8b2ed74..46a13b4 100644 +--- a/src/ImathTest/testToFloat.h ++++ b/src/ImathTest/testToFloat.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testToFloat(); ++void testToFloat (); +diff --git a/src/ImathTest/testVec.cpp b/src/ImathTest/testVec.cpp +index 5bcab00..e653eaf 100644 +--- a/src/ImathTest/testVec.cpp ++++ b/src/ImathTest/testVec.cpp +@@ -7,12 +7,12 @@ + # undef NDEBUG + #endif + ++#include "testVec.h" + #include + #include + #include + #include + #include +-#include "testVec.h" + + // Include ImathForward *after* other headers to validate forward declarations + #include +@@ -25,234 +25,242 @@ namespace + + template + void +-testLength2T() ++testLength2T () + { +- const T s = std::sqrt (std::numeric_limits::min()); +- const T e = 4 * std::numeric_limits::epsilon(); ++ const T s = std::sqrt (std::numeric_limits::min ()); ++ const T e = 4 * std::numeric_limits::epsilon (); + + Vec2 v; + + v = Vec2 (0, 0); +- assert (v.length() == 0); +- assert (v.normalized().length() == 0); ++ assert (v.length () == 0); ++ assert (v.normalized ().length () == 0); + + v = Vec2 (3, 4); +- assert (v.length() == 5); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (v.length () == 5); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + v = Vec2 (3000, 4000); +- assert (v.length() == 5000); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (v.length () == 5000); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + T t = s * (1 << 4); + + v = Vec2 (t, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec2 (0, t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec2 (-t, -t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t * std::sqrt (2), t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal ( ++ v.length (), t * std::sqrt (2), t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + t = s / (1 << 4); + + v = Vec2 (t, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec2 (0, t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec2 (-t, -t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t * std::sqrt (2), t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal ( ++ v.length (), t * std::sqrt (2), t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + t = s / (1 << 20); + + v = Vec2 (t, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec2 (0, t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec2 (-t, -t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t * std::sqrt (2), t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal ( ++ v.length (), t * std::sqrt (2), t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + } + + template + void +-testLength3T() ++testLength3T () + { +- const T s = std::sqrt (std::numeric_limits::min()); +- const T e = 4 * std::numeric_limits::epsilon(); ++ const T s = std::sqrt (std::numeric_limits::min ()); ++ const T e = 4 * std::numeric_limits::epsilon (); + + Vec3 v; + + v = Vec3 (0, 0, 0); +- assert (v.length() == 0); +- assert (v.normalized().length() == 0); ++ assert (v.length () == 0); ++ assert (v.normalized ().length () == 0); + + v = Vec3 (3, 4, 0); +- assert (v.length() == 5); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (v.length () == 5); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + v = Vec3 (3000, 4000, 0); +- assert (v.length() == 5000); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (v.length () == 5000); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + v = Vec3 (1, -1, 1); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), 1 * std::sqrt (3), e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert ( ++ IMATH_INTERNAL_NAMESPACE::equal (v.length (), 1 * std::sqrt (3), e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + v = Vec3 (1000, -1000, 1000); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), 1000 * std::sqrt (3), 1000 * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal ( ++ v.length (), 1000 * std::sqrt (3), 1000 * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + T t = s * (1 << 4); + + v = Vec3 (t, 0, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec3 (0, t, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec3 (0, 0, t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec3 (-t, -t, -t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t * std::sqrt (3), t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal ( ++ v.length (), t * std::sqrt (3), t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + t = s / (1 << 4); + + v = Vec3 (t, 0, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec3 (0, t, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec3 (0, 0, t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec3 (-t, -t, -t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t * std::sqrt (3), t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal ( ++ v.length (), t * std::sqrt (3), t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + t = s / (1 << 20); + + v = Vec3 (t, 0, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec3 (0, t, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec3 (0, 0, t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec3 (-t, -t, -t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t * std::sqrt (3), t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal ( ++ v.length (), t * std::sqrt (3), t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + } + + template + void +-testLength4T() ++testLength4T () + { +- const T s = std::sqrt (std::numeric_limits::min()); +- const T e = 4 * std::numeric_limits::epsilon(); ++ const T s = std::sqrt (std::numeric_limits::min ()); ++ const T e = 4 * std::numeric_limits::epsilon (); + + Vec4 v; + + v = Vec4 (0, 0, 0, 0); +- assert (v.length() == 0); +- assert (v.normalized().length() == 0); ++ assert (v.length () == 0); ++ assert (v.normalized ().length () == 0); + + v = Vec4 (3, 4, 0, 0); +- assert (v.length() == 5); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (v.length () == 5); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + v = Vec4 (3000, 4000, 0, 0); +- assert (v.length() == 5000); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (v.length () == 5000); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + v = Vec4 (1, -1, 1, 1); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), 2, e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), 2, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + v = Vec4 (1000, -1000, 1000, 1000); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), 2000, 1000 * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), 2000, 1000 * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + T t = s * (1 << 4); + + v = Vec4 (t, 0, 0, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (0, t, 0, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (0, 0, t, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (0, 0, 0, t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (-t, -t, -t, -t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t * 2, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t * 2, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + t = s / (1 << 4); + + v = Vec4 (t, 0, 0, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (0, t, 0, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (0, 0, t, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (0, 0, 0, t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (-t, -t, -t, -t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t * 2, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t * 2, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + + t = s / (1 << 20); + + v = Vec4 (t, 0, 0, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (0, t, 0, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (0, 0, t, 0); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (0, 0, 0, t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + v = Vec4 (-t, -t, -t, -t); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.length(), t * 2, t * e)); +- assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized().length(), 1, e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.length (), t * 2, t * e)); ++ assert (IMATH_INTERNAL_NAMESPACE::equal (v.normalized ().length (), 1, e)); + } + + } // namespace + + void +-testVec() ++testVec () + { + cout << "Testing some basic vector operations" << endl; + +- testLength2T(); +- testLength2T(); +- testLength3T(); +- testLength3T(); +- testLength4T(); +- testLength4T(); ++ testLength2T (); ++ testLength2T (); ++ testLength3T (); ++ testLength3T (); ++ testLength4T (); ++ testLength4T (); + + cout << "ok\n" << endl; + } +diff --git a/src/ImathTest/testVec.h b/src/ImathTest/testVec.h +index 652c142..964e106 100644 +--- a/src/ImathTest/testVec.h ++++ b/src/ImathTest/testVec.h +@@ -3,4 +3,4 @@ + // Copyright Contributors to the OpenEXR Project. + // + +-void testVec(); ++void testVec (); +diff --git a/src/python/config/PyImathConfig.h.in b/src/python/config/PyImathConfig.h.in +index 6e7cd79..87b00bd 100644 +--- a/src/python/config/PyImathConfig.h.in ++++ b/src/python/config/PyImathConfig.h.in +@@ -33,4 +33,3 @@ + // + + #undef HAVE_LARGE_STACK +- +-- +2.33.0 + diff --git a/Imath.spec b/Imath.spec index 1b558c9..204f309 100644 --- a/Imath.spec +++ b/Imath.spec @@ -2,12 +2,13 @@ %global sover 29 Name: Imath Version: 3.1.4 -Release: 1 +Release: 2 Summary: Library of 2D and 3D vector, matrix, and math operations for computer graphics License: BSD URL: https://github.com/AcademySoftwareFoundation/Imath Source0: https://github.com/AcademySoftwareFoundation/%{srcname}/archive/v%{version}/%{srcname}-%{version}.tar.gz Patch0: Imath-python-test.patch +Patch1: 0001-reformat-Run-clang-format-over-repository.patch BuildRequires: cmake gcc gcc-c++ make boost-devel python3-devel BuildRequires: python3-breathe python3-numpy doxygen python3-sphinx %description @@ -73,5 +74,8 @@ make test %{_libdir}/libPyImath_Python3_10-3_1.so %changelog +* Thu Jan 5 2023 liyanan - 3.1.4-2 +- Run clang-format over repository + * Mon Feb 7 2022 liyanan - 3.1.4-1 - package init -- Gitee