Skip to content

Commit

Permalink
Fixed #1413
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed Dec 16, 2024
1 parent 97c5636 commit 02e30ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions corelib/src/util3d_filtering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,7 @@ pcl::IndicesPtr normalFilteringImpl(
for(unsigned int i=0; i<cloud_normals->size(); ++i)
{
Eigen::Vector4f v(cloud_normals->at(i).normal_x, cloud_normals->at(i).normal_y, cloud_normals->at(i).normal_z, 0.0f);
if(groundNormalsUp>0.0f && v[2] < -groundNormalsUp && cloud->at(indices->size()!=0?indices->at(i):i).z < viewpoint[3]) // some far velodyne rays on road can have normals toward ground
if(groundNormalsUp>0.0f && v[2] < -groundNormalsUp && cloud->at(indices->size()!=0?indices->at(i):i).z < viewpoint[2]) // some far velodyne rays on road can have normals toward ground
{
//reverse normal
v *= -1.0f;
Expand Down Expand Up @@ -2226,7 +2226,7 @@ pcl::IndicesPtr normalFilteringImpl(
for(unsigned int i=0; i<indices->size(); ++i)
{
Eigen::Vector4f v(cloud->at(indices->at(i)).normal_x, cloud->at(indices->at(i)).normal_y, cloud->at(indices->at(i)).normal_z, 0.0f);
if(groundNormalsUp>0.0f && v[2] < -groundNormalsUp && cloud->at(indices->at(i)).z < viewpoint[3]) // some far velodyne rays on road can have normals toward ground
if(groundNormalsUp>0.0f && v[2] < -groundNormalsUp && cloud->at(indices->at(i)).z < viewpoint[2]) // some far velodyne rays on road can have normals toward ground
{
//reverse normal
v *= -1.0f;
Expand All @@ -2244,7 +2244,7 @@ pcl::IndicesPtr normalFilteringImpl(
for(unsigned int i=0; i<cloud->size(); ++i)
{
Eigen::Vector4f v(cloud->at(i).normal_x, cloud->at(i).normal_y, cloud->at(i).normal_z, 0.0f);
if(groundNormalsUp>0.0f && v[2] < -groundNormalsUp && cloud->at(i).z < viewpoint[3]) // some far velodyne rays on road can have normals toward ground
if(groundNormalsUp>0.0f && v[2] < -groundNormalsUp && cloud->at(i).z < viewpoint[2]) // some far velodyne rays on road can have normals toward ground
{
//reverse normal
v *= -1.0f;
Expand Down
4 changes: 2 additions & 2 deletions corelib/src/util3d_surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3530,7 +3530,7 @@ LaserScan adjustNormalsToViewPoint(

float result = v.dot(n);
if(result < 0
|| (groundNormalsUp>0.0f && ptr[nz] < -groundNormalsUp && ptr[2] < viewpoint[3])) // some far velodyne rays on road can have normals toward ground
|| (groundNormalsUp>0.0f && ptr[nz] < -groundNormalsUp && ptr[2] < viewpoint[2])) // some far velodyne rays on road can have normals toward ground
{
//reverse normal
ptr[nx] *= -1.0f;
Expand Down Expand Up @@ -3569,7 +3569,7 @@ void adjustNormalsToViewPointImpl(

float result = v.dot(n);
if(result < 0
|| (groundNormalsUp>0.0f && normal.z < -groundNormalsUp && cloud->points[i].z < viewpoint[3])) // some far velodyne rays on road can have normals toward ground
|| (groundNormalsUp>0.0f && normal.z < -groundNormalsUp && cloud->points[i].z < viewpoint[2])) // some far velodyne rays on road can have normals toward ground
{
//reverse normal
cloud->points[i].normal_x *= -1.0f;
Expand Down

0 comments on commit 02e30ff

Please sign in to comment.