Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add vertex normal estimation to PolygonMesh #3591

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RLThomaz
Copy link
Contributor

This updates #1262.

Instead of overloading the original computeApproximateNormals I decided to add two functions. The difference is, the original function did not normalize the face normal before adding it to the vertex and the author flipped the normals towards the viewpoint. I do not know the reason behind these choices, but I disagree with them due to the following rationale.

  • The unnormalized face normal will skew the vertex normal towards big faces.
  • Flipping the normal towards the viewpoint disregards the idea of polygon winding, thus results in wrong normals for full, closed meshes.

@RLThomaz RLThomaz requested a review from kunaltyagi January 23, 2020 02:33
@kunaltyagi
Copy link
Member

The code is mostly similar, except:

  • normalization
  • flipping normals

Would it make sense to split this function in multiple parts to reduce code duplication? The interface would not change

Will it make sense to provide 1 more overload for the existing functionality with PolygonMesh?

@RLThomaz
Copy link
Contributor Author

The code is mostly similar, except:

  • normalization
  • flipping normals

Would it make sense to split this function in multiple parts to reduce code duplication? The interface would not change

Yes, you are right. I'll refactor this to avoid code duplication.

Will it make sense to provide 1 more overload for the existing functionality with PolygonMesh?

I can add it with ease, so why not? Will do this soon!

@kunaltyagi
Copy link
Member

Also, please add tests so we can prevent regressions/breaking builds in future. Reorder so we can have the tests and then iterate on the interface (leaving the test commit alone)

@kunaltyagi kunaltyagi added module: features needs: more work Specify why not closed/merged yet labels Jan 23, 2020
@@ -2,6 +2,10 @@

#include "pcl/features/normal_3d.h"
#include "pcl/Vertices.h"
#include "pcl/point_types.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using '<' over '"' for header includes

pcl::fromPCLPointCloud2(mesh.cloud, cloud);

// For each point intialize the normal as zeros.
for (auto &point : cloud.points)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Utilize the other function to avoid repeating code

@RLThomaz
Copy link
Contributor Author

Just to update on this - I've been busy for the past couple of months, but I will provide the changes requested by the reviewers when suitable. However, to whomever this may be useful, the implementation works as it is.

@stale
Copy link

stale bot commented May 19, 2020

Marking this as stale due to 30 days of inactivity. Commenting or adding a new commit to the pull request will revert this.

@stale stale bot added the status: stale label May 19, 2020
@kunaltyagi kunaltyagi added the changelog: enhancement Meta-information for changelog generation label May 19, 2020
@stale stale bot removed the status: stale label May 19, 2020
@stale
Copy link

stale bot commented Jun 20, 2020

Marking this as stale due to 30 days of inactivity. Commenting or adding a new commit to the pull request will revert this.

@stale stale bot added the status: stale label Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: enhancement Meta-information for changelog generation module: features needs: more work Specify why not closed/merged yet status: stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants