diff --git a/src/rigid.cpp b/src/rigid.cpp index f3357dbf..36fe8b48 100644 --- a/src/rigid.cpp +++ b/src/rigid.cpp @@ -75,8 +75,9 @@ void Rigid::denormalize(const Normalization& normalization, result.translation = normalization.scale * result.translation + normalization.fixed_mean - result.scale * result.rotation * normalization.moving_mean; - result.points = result.points * normalization.scale + - normalization.fixed_mean.replicate(result.points.rows(), 1); + result.points = + result.points * normalization.scale + + normalization.fixed_mean.transpose().replicate(result.points.rows(), 1); } Rigid::Result rigid(const Matrix& fixed, const Matrix& moving) { diff --git a/test/rigid.cpp b/test/rigid.cpp index b4ff286b..9aaeed1c 100644 --- a/test/rigid.cpp +++ b/test/rigid.cpp @@ -93,6 +93,7 @@ TEST_F(Rigid2DTest, Normalize) { m_fish_transformed = m_fish * rotation; auto result = rigid(m_fish_transformed, m_fish); EXPECT_TRUE(result.rotation.isApprox(rotation.transpose(), TOLERANCE)); + EXPECT_EQ(result.points.rows(), m_fish.rows()); } TEST_P(Rotation2D, IsRecovered) {