From eeb744dc8d8608df22d3e8c512f42fb507f402ae Mon Sep 17 00:00:00 2001 From: Chen-Pang He Date: Sun, 14 Jul 2013 02:00:50 +0800 Subject: Add test3dRotation. --- unsupported/test/matrix_power.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'unsupported/test/matrix_power.cpp') diff --git a/unsupported/test/matrix_power.cpp b/unsupported/test/matrix_power.cpp index b9b72b528..8e33d6038 100644 --- a/unsupported/test/matrix_power.cpp +++ b/unsupported/test/matrix_power.cpp @@ -82,6 +82,20 @@ void test2dHyperbolicRotation(double tol) } } +template +void test3dRotation(double tol) +{ + Matrix v; + T angle; + + for (int i=0; i<=20; ++i) { + v = Matrix::Random(); + v.normalize(); + angle = pow(10, (i-10) / 5.); + VERIFY(AngleAxis(angle, v).matrix().isApprox(AngleAxis(1,v).matrix().pow(angle), tol)); + } +} + template void testGeneral(const MatrixType& m, double tol) { @@ -156,6 +170,7 @@ void testLogThenExp(MatrixType m, double tol) } typedef Matrix Matrix3dRowMajor; +typedef Matrix Matrix3e; typedef Matrix MatrixXe; void test_matrix_power() @@ -167,6 +182,10 @@ void test_matrix_power() CALL_SUBTEST_1(test2dHyperbolicRotation(1e-5)); CALL_SUBTEST_9(test2dHyperbolicRotation(1e-14)); + CALL_SUBTEST_10(test3dRotation(1e-13)); + CALL_SUBTEST_11(test3dRotation(1e-5)); + CALL_SUBTEST_12(test3dRotation(1e-13)); + CALL_SUBTEST_2(testGeneral(Matrix2d(), 1e-13)); CALL_SUBTEST_7(testGeneral(Matrix3dRowMajor(), 1e-13)); CALL_SUBTEST_3(testGeneral(Matrix4cd(), 1e-13)); @@ -176,6 +195,9 @@ void test_matrix_power() CALL_SUBTEST_8(testGeneral(Matrix4f(), 1e-4)); CALL_SUBTEST_6(testGeneral(MatrixXf(2,2), 1e-3)); // see bug 614 CALL_SUBTEST_9(testGeneral(MatrixXe(7,7), 1e-13)); + CALL_SUBTEST_10(testGeneral(Matrix3d(), 1e-13)); + CALL_SUBTEST_11(testGeneral(Matrix3f(), 1e-4)); + CALL_SUBTEST_12(testGeneral(Matrix3e(), 1e-13)); CALL_SUBTEST_2(testSingular(Matrix2d(), 1e-13)); CALL_SUBTEST_7(testSingular(Matrix3dRowMajor(), 1e-13)); @@ -186,6 +208,9 @@ void test_matrix_power() CALL_SUBTEST_8(testSingular(Matrix4f(), 1e-4)); CALL_SUBTEST_6(testSingular(MatrixXf(2,2), 1e-3)); CALL_SUBTEST_9(testSingular(MatrixXe(7,7), 1e-13)); + CALL_SUBTEST_10(testSingular(Matrix3d(), 1e-13)); + CALL_SUBTEST_11(testSingular(Matrix3f(), 1e-4)); + CALL_SUBTEST_12(testSingular(Matrix3e(), 1e-13)); CALL_SUBTEST_2(testLogThenExp(Matrix2d(), 1e-13)); CALL_SUBTEST_7(testLogThenExp(Matrix3dRowMajor(), 1e-13)); @@ -196,4 +221,7 @@ void test_matrix_power() CALL_SUBTEST_8(testLogThenExp(Matrix4f(), 1e-4)); CALL_SUBTEST_6(testLogThenExp(MatrixXf(2,2), 1e-3)); CALL_SUBTEST_9(testLogThenExp(MatrixXe(7,7), 1e-13)); + CALL_SUBTEST_10(testLogThenExp(Matrix3d(), 1e-13)); + CALL_SUBTEST_11(testLogThenExp(Matrix3f(), 1e-4)); + CALL_SUBTEST_12(testLogThenExp(Matrix3e(), 1e-13)); } -- cgit v1.2.3