Skip to content

Commit

Permalink
test(core/geometry): test qcp for reflection too
Browse files Browse the repository at this point in the history
  • Loading branch information
jnooree committed Oct 25, 2024
1 parent 6a96613 commit ab6934f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/core/geometry_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,19 +346,33 @@ TEST_F(AlignTest, KabschBoth) {
TEST_F(AlignTest, QcpMSDOnly) {
auto [_, msd] = qcp(query_, templ_, AlignMode::kMsdOnly);
EXPECT_NEAR(msd, msd_reflected_, 1e-6);

std::tie(_, msd) = qcp(query_, templ_, AlignMode::kMsdOnly, true);
EXPECT_NEAR(msd, msd_, 1e-6);
}

TEST_F(AlignTest, QcpXformOnly) {
auto [xform, flag] = qcp(query_, templ_, AlignMode::kXformOnly);
ASSERT_GE(flag, 0);
NURI_EXPECT_EIGEN_EQ_TOL(xform.matrix(), xform_reflected_.matrix(), 1e-3);

std::tie(xform, flag) = qcp(query_, templ_, AlignMode::kXformOnly, true);
ASSERT_GE(flag, 0);
NURI_EXPECT_EIGEN_EQ_TOL(xform.linear(), -xform_.linear(), 1e-3);
NURI_EXPECT_EIGEN_EQ_TOL(xform.translation(), xform_.translation(), 1e-3);
}

TEST_F(AlignTest, QcpBoth) {
auto [xform, msd] = qcp(query_, templ_, AlignMode::kBoth);
ASSERT_GE(msd, 0);
NURI_EXPECT_EIGEN_EQ_TOL(xform.matrix(), xform_reflected_.matrix(), 1e-3);
EXPECT_NEAR(msd, msd_reflected_, 1e-6);

std::tie(xform, msd) = qcp(query_, templ_, AlignMode::kBoth, true);
ASSERT_GE(msd, 0);
NURI_EXPECT_EIGEN_EQ_TOL(xform.linear(), -xform_.linear(), 1e-3);
NURI_EXPECT_EIGEN_EQ_TOL(xform.translation(), xform_.translation(), 1e-3);
EXPECT_NEAR(msd, msd_, 1e-6);
}

class AlignSingularTest: public ::testing::Test {
Expand Down Expand Up @@ -420,7 +434,7 @@ TEST_F(AlignSingularTest, Kabsch) {
TEST_F(AlignSingularTest, Qcp) {
run_test([](const auto &q, const auto &t, auto mode) {
// might fail on optimized builds if evecprec is too high
return qcp(q, t, mode, 1e-11, 1e-8);
return qcp(q, t, mode, false, 1e-11, 1e-8);
});
}

Expand Down

0 comments on commit ab6934f

Please sign in to comment.