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

EstimateNormals with fallback #20

Open
luithefirst opened this issue Feb 3, 2022 · 1 comment
Open

EstimateNormals with fallback #20

luithefirst opened this issue Feb 3, 2022 · 1 comment

Comments

@luithefirst
Copy link
Member

luithefirst commented Feb 3, 2022

I'm using EstimateNormals to calculate orientations of user-generated calculation grids. While the points typically are on a plane or a slope there are other cases where the points have a linear dependency where I simply want to fallback to a default orientation. With k=5 I get inconsistent (almost random appearing) orientations in this case (maybe not all points are perfectly linear):
EstimateNormals_Fallback

One possibility would to implement a version of EstimateNormals where a default normal can be specified in case the calculation is degenerated (count < 3 or any group of neighboring points have a linear dependency) and some kind of threshold: V3f[] EstimateNormals(this V3d[] points, int k, V3f fallback, double epsilon)

An alternative would be to only add an epsilon parameter and return V3f.Zero (like in one case already), so degenerated normals can be identified on the user side: V3f[] EstimateNormals(this V3d[] points, int k, double epsilon)
The additional pass should not be that expensive compared to the method and the API change would be minimal. It would actually be even more useful than with a directly specified fallback because it can be distinguished between the degenerated case and a point where the normal is calculated as the fallback.

I could start with a local copy of EstimateNormals, but it would be great to have it in this library.

The one thing I'm not sure yet is how the epsilon parameter should be interpreted. I guess since the smallest eigenvalue is the normal, in case there is a second very small value the points are degenerated? Do you have a suggestion on how this check should actually look like?

@krauthaufen
Copy link
Member

krauthaufen commented Feb 3, 2022

We could also return the "quality" of the normal encoded into its length which would allow to filter these things and offload the task of finding a proper epsilon to the user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants