7 Vector4f point_in, point_out;
8 point_in << pt.x, pt.y, pt.z,
10 double qx, qy, qz, qw;
15 MatrixXf transform_mat(4, 4);
19 transform_mat << 1 - 2 * qz * qz - 2 * qy * qy, -2 * qz * qw + 2 * qy * qx,
20 2 * qy * qw + 2 * qz * qx, translation[0], 2 * qx * qy + 2 * qw * qz,
21 1 - 2 * qz * qz - 2 * qx * qx, 2 * qz * qy - 2 * qx * qw, translation[1],
22 2 * qx * qz - 2 * qw * qy, 2 * qy * qz + 2 * qw * qx, 1 - 2 * qy * qy - 2 * qx * qx,
23 translation[2], 0.0, 0.0, 0.0, 1;
24 point_out = transform_mat * point_in;
32 Vector4f normal_in, normal_out;
33 normal_in << pt.normal_x, pt.normal_y, pt.normal_z, 1;
34 normal_out = (transform_mat.inverse().transpose()) * normal_in;
37 pt.normal_x = normal_out[0];
38 pt.normal_y = normal_out[1];
39 pt.normal_z = normal_out[2];
46 auto isqrtf = [](
float number) {
49 const float threehalfs = 1.5F;
54 i = 0x5f3759df - (i >> 1);
56 y = y * (threehalfs - (x2 * y * y));
60 pcl::PointXYZINormal o;
65 o.intensity = i.intensity;
68 float len = isqrtf(i.location.x * i.location.x + i.location.y * i.location.y +
69 i.location.z * i.location.z);
71 o.normal_x = -i.location.x * len;
72 o.normal_y = -i.location.y * len;
73 o.normal_z = -i.location.z * len;
pcl::PointXYZINormal convertToXYZINormal(toposens_msgs::TsPoint i)
Converts a point from a TsPoint message to a standard PCL point (PointXYZINormal).
void doTransform(pcl::PointXYZINormal &pt, Vector3f translation, Vector4f quaternion)