From pcl/segmentation/include/pcl/segmentation/impl/lccp_segmentation.hpp Lines 434++
const Eigen::Vector3f source_normal = sv_source->normal_.getNormalVector3fMap (). normalized ();
const Eigen::Vector3f target_normal = sv_target->normal_.getNormalVector3fMap (). normalized ();
float dot_normal = source_normal.dot (target_normal);
float normal_angle = std::acos (dot_normal) * 180. / M_PI;
This leads in some cases to dot_normal > 1 or dot_normal < 1 and to normal_angle being NaN.
This again causes LCCP to treat some connections on perfectly flat surfaces to be concave.
I implemented a quick fix:
if (dot_normal > 1)
{
dot_normal = 1;
}
if (dot_normal < -1)
{
dot_normal = -1;
}
but this is not nice, obviously. Does anybody know the cause why Eigen's dot product returns numbers not correctly normalized and how to prevent it?