8 const Eigen::Rotation2D<NumericType>&
rotation,
11 const Eigen::Transform<NumericType, 2, Eigen::Affine>
transformation =
12 Eigen::Translation<NumericType, 2>(
translation) * rotation * Eigen::Scaling(scale);
17 const Eigen::Quaternion<NumericType>&
rotation,
20 const Eigen::Transform<NumericType, 3, Eigen::Affine>
transformation =
21 Eigen::Translation<NumericType, 3>(
translation) * Eigen::AngleAxis<NumericType>(rotation.normalized()) * Eigen::Scaling(scale);
26 std::shared_ptr<PM::Transformation>& transformator,
30 auto transformedCloud = cloud;
31 transformator->inPlaceCompute(transformation, transformedCloud);
34 EXPECT_TRUE(transformator->checkParameters(transformation));
36 for (
size_t i = 0; i < cloud.getNbPoints(); ++i)
38 const auto transformedFeature = transformation * cloud.features.col(i);
39 ASSERT_TRUE(transformedFeature.isApprox(transformedCloud.features.col(i), kEpsilonNumericalError));
44 const int descCols(cloud.descriptors.cols());
45 const unsigned int nbRows = transformation.rows() - 1;
46 const unsigned int nbCols = transformation.cols() - 1;
48 for (
size_t i = 0; i < cloud.descriptorLabels.size(); ++i)
50 const int span(cloud.descriptorLabels[i].span);
52 if (name ==
"normals" || name ==
"observationDirections")
54 const auto transformedDescriptor = R * cloud.descriptors.block(row, 0, span, descCols);
55 ASSERT_TRUE(transformedDescriptor.isApprox(transformedCloud.descriptors.block(row, 0, span, descCols), kEpsilonNumericalError));
59 EXPECT_EQ(cloud.featureLabels, transformedCloud.featureLabels);
60 EXPECT_EQ(cloud.descriptorLabels, transformedCloud.descriptorLabels);
61 EXPECT_EQ(cloud.timeLabels, transformedCloud.timeLabels);
62 EXPECT_EQ(cloud.times, transformedCloud.times);
82 icp.transformationCheckers.clear();
90 transformCheck =
PM::get().TransformationCheckerRegistrar.create(name, params);
92 icp.transformationCheckers.push_back(transformCheck);
99 addFilter(
"CounterTransformationChecker", { {
"maxIterationCount",
toParam(20) } });
100 validate2dTransformation();
105 addFilter(
"DifferentialTransformationChecker",
106 { {
"minDiffRotErr",
toParam(0.001) }, {
"minDiffTransErr",
toParam(0.001) }, {
"smoothLength",
toParam(4) } });
107 validate2dTransformation();
115 std::shared_ptr<PM::TransformationChecker> extraTransformCheck;
117 extraTransformCheck =
PM::get().TransformationCheckerRegistrar.create(
"CounterTransformationChecker");
118 icp.transformationCheckers.push_back(extraTransformCheck);
120 addFilter(
"BoundTransformationChecker", { {
"maxRotationNorm",
toParam(1.0) }, {
"maxTranslationNorm",
toParam(1.0) } });
121 validate2dTransformation();
129 std::shared_ptr<PM::Transformation> rigidTrans;
137 T_3D << 0.99935116, 0.13669771, 0.03436585, 1.71138524, -0.02633967, 0.99326295, -0.04907545, -0.10860933, -0.03615132, 0.04400287,
138 0.99820427, -0.04454497, 0., 0., 0., 1.;
145 for (
int i = 0; i < 10; i++)
147 T_3D = rigidTrans->correctParameters(T_3D);
153 PM::Matrix T_2D_non_ortho = PM::Matrix::Identity(3, 3);
154 T_2D_non_ortho(0, 0) = 0.8;
155 T_2D_non_ortho(0, 1) = -0.5;
156 T_2D_non_ortho(1, 0) = 0.5;
157 T_2D_non_ortho(1, 1) = 0.8;
159 EXPECT_FALSE(rigidTrans->checkParameters(T_2D_non_ortho));
165 for (
int i = 0; i < 10; i++)
167 T_2D_non_ortho = rigidTrans->correctParameters(T_2D_non_ortho);
168 EXPECT_TRUE(rigidTrans->checkParameters(T_2D_non_ortho));
173 PM::Matrix T_2D_reflection = PM::Matrix::Identity(3, 3);
174 T_2D_reflection(1, 1) = -1;
181 std::shared_ptr<PM::Transformation> transformator =
PM::get().REG(
Transformation).create(
"PureTranslation");
185 const Eigen::Matrix<NumericType, 2, 1>
translation{ 0, 0 };
186 const Eigen::Rotation2D<NumericType>
rotation{ 0 };
193 const Eigen::Matrix<NumericType, 2, 1>
translation{ -1.0001, 34.5 };
194 const Eigen::Rotation2D<NumericType>
rotation{ 0 };
203 std::shared_ptr<PM::Transformation> transformator =
PM::get().REG(
Transformation).create(
"PureTranslation");
207 const Eigen::Matrix<NumericType, 3, 1>
translation{ 0, 0, 0 };
208 const Eigen::Quaternion<NumericType>
rotation{ 1, 0, 0, 0 };
216 const Eigen::Matrix<NumericType, 3, 1>
translation{ -1.0001, 5, -12321.234 };
217 const Eigen::Quaternion<NumericType>
rotation{ 1, 0, 0, 0 };
226 std::shared_ptr<PM::Transformation> transformator =
PM::get().REG(
Transformation).create(
"RigidTransformation");
230 const Eigen::Matrix<NumericType, 2, 1>
translation{ 0, 0 };
231 const Eigen::Rotation2D<NumericType>
rotation{ 0 };
238 const Eigen::Matrix<NumericType, 2, 1>
translation{ -1.0001, 34.5 };
239 const Eigen::Rotation2D<NumericType>
rotation{ 0 };
246 const Eigen::Matrix<NumericType, 2, 1>
translation{ 0, 0 };
247 const Eigen::Rotation2D<NumericType>
rotation{ 3.53453 };
254 const Eigen::Matrix<NumericType, 2, 1>
translation{ -3.11, 100.222 };
255 const Eigen::Rotation2D<NumericType>
rotation{ -123.3 };
264 std::shared_ptr<PM::Transformation> transformator =
PM::get().REG(
Transformation).create(
"RigidTransformation");
268 const Eigen::Matrix<NumericType, 3, 1>
translation{ 0, 0, 0 };
269 const Eigen::Quaternion<NumericType>
rotation{ 1, 0, 0, 0 };
277 const Eigen::Matrix<NumericType, 3, 1>
translation{ -1.0001, 5, -12321.234 };
278 const Eigen::Quaternion<NumericType>
rotation{ 1, 0, 0, 0 };
285 const Eigen::Matrix<NumericType, 3, 1>
translation{ 0, 0, 0 };
286 const Eigen::Quaternion<NumericType>
rotation{ 1, -5, 23, 0.5 };
294 const Eigen::Matrix<NumericType, 3, 1>
translation{ 1, -3, -4 };
295 const Eigen::Quaternion<NumericType>
rotation{ 0, -2.54, 0, 0.5 };
304 std::shared_ptr<PM::Transformation> transformator =
PM::get().REG(
Transformation).create(
"SimilarityTransformation");
308 const Eigen::Matrix<NumericType, 2, 1>
translation{ 0, 0 };
309 const Eigen::Rotation2D<NumericType>
rotation{ 0 };
317 const Eigen::Matrix<NumericType, 2, 1>
translation{ 0, 0 };
318 const Eigen::Rotation2D<NumericType>
rotation{ 0 };
326 const Eigen::Matrix<NumericType, 2, 1>
translation{ 0, 0 };
327 const Eigen::Rotation2D<NumericType>
rotation{ 0 };
335 const Eigen::Matrix<NumericType, 2, 1>
translation{ -1.0001, 34.5 };
336 const Eigen::Rotation2D<NumericType>
rotation{ 0 };
344 const Eigen::Matrix<NumericType, 2, 1>
translation{ 0, 0 };
345 const Eigen::Rotation2D<NumericType>
rotation{ 3.53453 };
353 const Eigen::Matrix<NumericType, 2, 1>
translation{ -3.11, 100.222 };
354 const Eigen::Rotation2D<NumericType>
rotation{ -123.3 };
364 std::shared_ptr<PM::Transformation> transformator =
PM::get().REG(
Transformation).create(
"SimilarityTransformation");
368 const Eigen::Matrix<NumericType, 3, 1>
translation{ 0, 0, 0 };
369 const Eigen::Quaternion<NumericType>
rotation{ 1, 0, 0, 0 };
377 const Eigen::Matrix<NumericType, 3, 1>
translation{ 0, 0, 0 };
378 const Eigen::Quaternion<NumericType>
rotation{ 1, 0, 0, 0 };
386 const Eigen::Matrix<NumericType, 3, 1>
translation{ 0, 0, 0 };
387 const Eigen::Quaternion<NumericType>
rotation{ 1, 0, 0, 0 };
395 const Eigen::Matrix<NumericType, 3, 1>
translation{ -1.0001, 5, -12321.234 };
396 const Eigen::Quaternion<NumericType>
rotation{ 1, 0, 0, 0 };
404 const Eigen::Matrix<NumericType, 3, 1>
translation{ 0, 0, 0 };
405 const Eigen::Quaternion<NumericType>
rotation{ 1, -5, 23, 0.5 };
414 const Eigen::Matrix<NumericType, 3, 1>
translation{ 1, -3, -4 };
415 const Eigen::Quaternion<NumericType>
rotation{ 0, -2.54, 0, 0.5 };
#define EXPECT_THROW(statement, expected_exception)
std::string toParam(const S &value)
Return the a string value using lexical_cast.
PM::DataPoints DataPoints
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dense matrix over ScalarType.
Parametrizable::Parameters Parameters
alias
Functions and classes that are not dependant on scalar type are defined in this namespace.
#define ASSERT_TRUE(condition)
static const PointMatcher & get()
Return instances.
#define EXPECT_EQ(expected, actual)
#define EXPECT_TRUE(condition)
#define EXPECT_FALSE(condition)
Matrix TransformationParameters
A matrix holding the parameters a transformation.