Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions pointmatcher/TransformationsImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ void TransformationsImpl<T>::RigidTransformation::inPlaceCompute(
if(this->checkParameters(parameters) == false)
throw TransformationError("RigidTransformation: Error, rotation matrix is not orthogonal.");

// Apply the transformation to features
cloud.features.applyOnTheLeft(parameters);
// Apply the transformation to features.
// B = A * B translates to B.transpose *= A.transpose()
cloud.features.transpose().applyOnTheRight(parameters.transpose());

// Apply the transformation to descriptors
int row(0);
Expand All @@ -85,7 +86,9 @@ void TransformationsImpl<T>::RigidTransformation::inPlaceCompute(
const std::string& name(cloud.descriptorLabels[i].text);
if (name == "normals" || name == "observationDirections")
{
cloud.descriptors.block(row, 0, span, descCols).applyOnTheLeft(R);
// Rotate descriptors.
// B = A * B translates to B.transpose *= A.transpose()
cloud.descriptors.block(row, 0, span, descCols).transpose() *= R.transpose();
}

row += span;
Expand Down Expand Up @@ -188,7 +191,8 @@ void TransformationsImpl<T>::SimilarityTransformation::inPlaceCompute(
throw TransformationError("SimilarityTransformation: Error, invalid similarity transform.");

// Apply the transformation to features
cloud.features.applyOnTheLeft(parameters);
// B = A * B translates to B.transpose *= A.transpose()
cloud.features.transpose().applyOnTheRight(parameters.transpose());

// Apply the transformation to descriptors
int row(0);
Expand All @@ -199,7 +203,9 @@ void TransformationsImpl<T>::SimilarityTransformation::inPlaceCompute(
const std::string& name(cloud.descriptorLabels[i].text);
if (name == "normals" || name == "observationDirections")
{
cloud.descriptors.block(row, 0, span, descCols).applyOnTheLeft(R);
// Rotate descriptors.
// B = A * B translates to B.transpose *= A.transpose()
cloud.descriptors.block(row, 0, span, descCols).transpose() *= R.transpose();
}

row += span;
Expand Down Expand Up @@ -242,8 +248,9 @@ void TransformationsImpl<T>::PureTranslation::inPlaceCompute(
if(this->checkParameters(parameters) == false)
throw PointMatcherSupport::TransformationError("PureTranslation: Error, left part not identity.");

// Apply the transformation to features
cloud.features.applyOnTheLeft(parameters);
// Apply the transformation to features.
// B = A * B translates to B.transpose() *= A.transpose()
cloud.features.transpose().applyOnTheRight(parameters.transpose());
}

template<typename T>
Expand Down
2 changes: 1 addition & 1 deletion utest/ui/Transformations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static inline Eigen::Transform<NumericType, 3, Eigen::Affine> buildUpTransformat

static inline void assertOnDataPointsTransformation(const PM::DataPoints& cloud, const PM::TransformationParameters& transformation,
std::shared_ptr<PM::Transformation>& transformator,
const NumericType kEpsilonNumericalError = 0)
const NumericType kEpsilonNumericalError = 1e-13)
{
// Transform point cloud.
auto transformedCloud = cloud;
Expand Down