Skip to content

EstimateNormals with fallback #20

@luithefirst

Description

@luithefirst

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions