Skip to content

Commit

Permalink
Merge pull request #82 from gadomski/rigid-denormalize-bug
Browse files Browse the repository at this point in the history
Fix rigid denormalization bug, with test
  • Loading branch information
gadomski authored Nov 17, 2016
2 parents 59ee0bc + 0f3b835 commit e27692d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rigid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions test/rigid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e27692d

Please sign in to comment.