32 #define TEST_NAME "base/similarity_transform"
47 BOOST_CHECK_EQUAL(tform.
Scale(), 1);
49 BOOST_CHECK_EQUAL(tform.
Rotation()[0], 1);
50 BOOST_CHECK_EQUAL(tform.
Rotation()[1], 0);
51 BOOST_CHECK_EQUAL(tform.
Rotation()[2], 0);
52 BOOST_CHECK_EQUAL(tform.
Rotation()[3], 0);
60 const Eigen::Vector4d qvec =
65 BOOST_CHECK_CLOSE(tform.
Scale(), 2, 1
e-10);
67 BOOST_CHECK_CLOSE(tform.
Rotation()[0], qvec(0), 1
e-10);
68 BOOST_CHECK_CLOSE(tform.
Rotation()[1], qvec(1), 1
e-10);
69 BOOST_CHECK_CLOSE(tform.
Rotation()[2], qvec(2), 1
e-10);
70 BOOST_CHECK_CLOSE(tform.
Rotation()[3], qvec(3), 1
e-10);
79 Eigen::Vector3d(100, 10, 0.5));
81 std::vector<Eigen::Vector3d> src;
82 std::vector<Eigen::Vector3d> dst;
84 for (
size_t i = 0; i < num_coords; ++i) {
85 src.emplace_back(i, i + 2, i * i);
86 dst.push_back(src.back());
91 BOOST_CHECK(est_tform.
Estimate(src, dst));
93 BOOST_CHECK((orig_tform.
Matrix() - est_tform.
Matrix()).norm() < 1
e-6);
95 std::vector<Eigen::Vector3d> invalid_src_dst(3, Eigen::Vector3d::Zero());
96 BOOST_CHECK(!est_tform.
Estimate(invalid_src_dst, invalid_src_dst));
106 const std::string
path =
"test_from_file_transform.txt";
108 std::ofstream out(
path);
109 out <<
"0.0 2.0 0.0 3.0 0.0 0.0 2.0 4.0 2.0 0.0 0.0 5.0 0.0 0.0 0.0 1.0"
113 BOOST_CHECK_CLOSE(tform.
Scale(), 2.0, 1
e-10);
114 BOOST_CHECK_LE((tform.
Translation() - Eigen::Vector3d(3.0, 4.0, 5.0)).norm(),
117 (tform.
Rotation() - Eigen::Vector4d(-0.5, 0.5, 0.5, 0.5)).norm(), 1
e-6);
QTextStream & endl(QTextStream &stream)
static const std::string path
Eigen::Vector4d NormalizeQuaternion(const Eigen::Vector4d &qvec)