Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncomment previously failing Transformations unit tests #532

Closed
wants to merge 2 commits into from
Closed
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
200 changes: 99 additions & 101 deletions utest/ui/Transformations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,46 +258,45 @@ TEST(Transformation, ComputeRigidTransformDataPoints2D)
}
}

//// (CRITICAL) ToDo: investigate unit-test failure (ref task NMO-301)
//TEST(Transformation, ComputeRigidTransformDataPoints3D)
//{
// std::shared_ptr<PM::Transformation> transformator = PM::get().REG(Transformation).create("RigidTransformation");
//
// // Identity.
// {
// const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
// const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
// }
//
// // Pure translation.
// {
// const Eigen::Matrix<NumericType, 3, 1> translation{ -1.0001, 5, -12321.234 };
// const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
// }
// // Pure rotation.
// {
// const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
// const Eigen::Quaternion<NumericType> rotation{ 1, -5, 23, 0.5 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
// }
// // Translation + rotation.
// {
// const NumericType kEpsilonNumericalError = 1e-6;
// const Eigen::Matrix<NumericType, 3, 1> translation{ 1, -3, -4 };
// const Eigen::Quaternion<NumericType> rotation{ 0, -2.54, 0, 0.5 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator, kEpsilonNumericalError);
// }
//}
TEST(Transformation, ComputeRigidTransformDataPoints3D)
{
std::shared_ptr<PM::Transformation> transformator = PM::get().REG(Transformation).create("RigidTransformation");

// Identity.
{
const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
}

// Pure translation.
{
const Eigen::Matrix<NumericType, 3, 1> translation{ -1.0001, 5, -12321.234 };
const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
}
// Pure rotation.
{
const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
const Eigen::Quaternion<NumericType> rotation{ 1, -5, 23, 0.5 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
}
// Translation + rotation.
{
const NumericType kEpsilonNumericalError = 1e-6;
const Eigen::Matrix<NumericType, 3, 1> translation{ 1, -3, -4 };
const Eigen::Quaternion<NumericType> rotation{ 0, -2.54, 0, 0.5 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator, kEpsilonNumericalError);
}
}

TEST(Transformation, ComputeSimilarityTransformDataPoints2D)
{
Expand Down Expand Up @@ -359,64 +358,63 @@ TEST(Transformation, ComputeSimilarityTransformDataPoints2D)
}
}

//// (CRITICAL) ToDo: investigate unit-test failure (ref task NMO-301)
//TEST(Transformation, ComputeSimilarityTransformDataPoints3D)
//{
// std::shared_ptr<PM::Transformation> transformator = PM::get().REG(Transformation).create("SimilarityTransformation");
//
// // Identity.
// {
// const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
// const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
// const NumericType scale{ 1.0 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
// }
// // Pure Upscaling.
// {
// const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
// const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
// const NumericType scale{ 5.0 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
// }
// // Pure Downscaling.
// {
// const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
// const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
// const NumericType scale{ 0.1 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
// }
// // Pure translation + Downscaling.
// {
// const Eigen::Matrix<NumericType, 3, 1> translation{ -1.0001, 5, -12321.234 };
// const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
// const NumericType scale{ 0.5 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
// }
// // Pure rotation + Upscaling.
// {
// const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
// const Eigen::Quaternion<NumericType> rotation{ 1, -5, 23, 0.5 };
// const NumericType scale{ 1.9 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
// }
// // Translation + rotation + Upscaling.
// {
// const NumericType kEpsilonNumericalError = 1e-6;
// const Eigen::Matrix<NumericType, 3, 1> translation{ 1, -3, -4 };
// const Eigen::Quaternion<NumericType> rotation{ 0, -2.54, 0, 0.5 };
// const NumericType scale{ 1.9 };
// const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// // Transform and assert on the result.
// assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator, kEpsilonNumericalError);
// }
//}
TEST(Transformation, ComputeSimilarityTransformDataPoints3D)
{
std::shared_ptr<PM::Transformation> transformator = PM::get().REG(Transformation).create("SimilarityTransformation");

// Identity.
{
const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
const NumericType scale{ 1.0 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
}
// Pure Upscaling.
{
const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
const NumericType scale{ 5.0 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
}
// Pure Downscaling.
{
const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
const NumericType scale{ 0.1 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
}
// Pure translation + Downscaling.
{
const Eigen::Matrix<NumericType, 3, 1> translation{ -1.0001, 5, -12321.234 };
const Eigen::Quaternion<NumericType> rotation{ 1, 0, 0, 0 };
const NumericType scale{ 0.5 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
}
// Pure rotation + Upscaling.
{
const Eigen::Matrix<NumericType, 3, 1> translation{ 0, 0, 0 };
const Eigen::Quaternion<NumericType> rotation{ 1, -5, 23, 0.5 };
const NumericType scale{ 1.9 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator);
}
// Translation + rotation + Upscaling.
{
const NumericType kEpsilonNumericalError = 1e-6;
const Eigen::Matrix<NumericType, 3, 1> translation{ 1, -3, -4 };
const Eigen::Quaternion<NumericType> rotation{ 0, -2.54, 0, 0.5 };
const NumericType scale{ 1.9 };
const Eigen::Transform<NumericType, 3, Eigen::Affine> transformation = buildUpTransformation3D(translation, rotation, scale);
// Transform and assert on the result.
assertOnDataPointsTransformation(data3D, transformation.matrix(), transformator, kEpsilonNumericalError);
}
}