This is very weird, but take a look at the following tests:
point_cloud::Point point;
point.set_x(19502);
point.set_y(-12092.632);
point.set_z(259.90189);
Eigen::Vector3f point_meter =
Eigen::Vector3f(point.x() * 0.01, point.y() * 0.01, point.z() * 0.01);
Eigen::Vector3f point_centimeter = Eigen::Vector3f(
point_meter.x() * 100, point_meter.y() * 100, point_meter.z() * 100);
EXPECT_EQ(point.x(), point_centimeter.x());
EXPECT_EQ(point.y(), point_centimeter.y());
EXPECT_EQ(point.z(), point_centimeter.z());
Eigen::Vector3f from_proto = Eigen::Vector3f(point.x(), point.y(), point.z());
EXPECT_EQ(point.x(), from_proto.x());
EXPECT_EQ(point.y(), from_proto.y());
EXPECT_EQ(point.z(), from_proto.z());
point_meter = from_proto * 0.01;
point_centimeter = point_meter * 100;
EXPECT_EQ(point.x(), point_centimeter.x()); // Failed. WHY??
EXPECT_EQ(point.y(), point_centimeter.y());
EXPECT_EQ(point.z(), point_centimeter.z());
If I used from_proto / 100, then the test works.
No comments:
Post a Comment