From 0836852dcb68db8fbfb3c30cd5396647c1c790a5 Mon Sep 17 00:00:00 2001 From: Frank Dellaert Date: Mon, 28 Oct 2024 15:14:46 -0700 Subject: [PATCH] Fix test on windows --- .../geometry/tests/testFundamentalMatrix.cpp | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/gtsam/geometry/tests/testFundamentalMatrix.cpp b/gtsam/geometry/tests/testFundamentalMatrix.cpp index 3e136caa7..00876e415 100644 --- a/gtsam/geometry/tests/testFundamentalMatrix.cpp +++ b/gtsam/geometry/tests/testFundamentalMatrix.cpp @@ -40,30 +40,20 @@ TEST(FundamentalMatrix, Retract) { } //************************************************************************* -// Test conversion from an F-matrix +// Test conversion from F matrices, including non-rotations TEST(FundamentalMatrix, Conversion) { - const Matrix3 F = trueU.matrix() * Vector3(1, trueS, 0).asDiagonal() * - trueV.matrix().transpose(); - FundamentalMatrix actual(F); - EXPECT(assert_equal(trueF, actual)); -} + Matrix3 U = trueU.matrix(); + Matrix3 V = trueV.matrix(); + std::vector Fs = { + FundamentalMatrix(U, trueS, V), FundamentalMatrix(U, trueS, -V), + FundamentalMatrix(-U, trueS, V), FundamentalMatrix(-U, trueS, -V)}; -//************************************************************************* -// Test conversion with a *non-rotation* U -TEST(FlippedFundamentalMatrix, Conversion1) { - FundamentalMatrix trueF(trueU.matrix(), trueS, -trueV.matrix()); - const Matrix3 F = trueF.matrix(); - FundamentalMatrix actual(F); - CHECK(assert_equal(F, actual.matrix())); -} - -//************************************************************************* -// Test conversion with a *non-rotation* U -TEST(FlippedFundamentalMatrix, Conversion2) { - FundamentalMatrix trueF(-trueU.matrix(), trueS, trueV.matrix()); - const Matrix3 F = trueF.matrix(); - FundamentalMatrix actual(F); - CHECK(assert_equal(F, actual.matrix())); + for (const auto& trueF : Fs) { + const Matrix3 F = trueF.matrix(); + FundamentalMatrix actual(F); + // We check the matrices as the underlying representation is not unique + CHECK(assert_equal(F, actual.matrix())); + } } //*************************************************************************