Skip to content

Commit

Permalink
Merge pull request #1728 from carlosmccosta/fix_normal_accumulator
Browse files Browse the repository at this point in the history
Fixed normal accumulator vector normalization when there is no normal information (0,0,0).
  • Loading branch information
SergioRAgostinho authored Oct 3, 2016
2 parents a87ef3c + 7197fed commit dd532fe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions common/include/pcl/common/impl/accumulators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ namespace pcl
template <typename PointT> void
get (PointT& t, size_t) const
{
t.getNormalVector4fMap () = normal;
t.getNormalVector4fMap ().normalize ();
#if EIGEN_VERSION_AT_LEAST (3, 3, 0)
t.getNormalVector4fMap () = normal.normalized ();
#else
if (normal.squaredNorm() > 0)
t.getNormalVector4fMap () = normal.normalized ();
else
t.getNormalVector4fMap () = Eigen::Vector4f::Zero ();
#endif
}

EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Expand Down

0 comments on commit dd532fe

Please sign in to comment.