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

Optimized curvature calculation #117

Closed
wants to merge 1 commit into from

Conversation

Miraclelzk
Copy link
Contributor

The original curvature calculation only rotates the coordinate system to the three directions of x, y and z to fit the quadratic curve.
It is modified to rotate the coordinate system to the local normal direction.

The curvature of a sphere

Before modification

1

modification

11

Avoids systematic errors in coordinate system fitting and provides better calculation results

@dgirardeau
Copy link
Member

dgirardeau commented Dec 30, 2024

Good catch! However, in addition to the syntax, we would also have to fix the fact that 'm_quadricEquationDirections' shouldn't be a simple set of 3 dimensions (indexes). We should probably remember the rotation matrix as well... I'll work on this and push an additional commit.

@dgirardeau
Copy link
Member

And now I realize it's not possible to store this matrix as it depends on the local normal 😅 . I'm a bit puzzled to understand how this works without changing m_quadricEquationDirections ...

@dgirardeau
Copy link
Member

Ah no sorry, it's just that you were re-calculating the rotation matrix for every point, but actually it's a constant matrix and should only be computed once! I'll keep pushing in this direction then.

@Miraclelzk
Copy link
Contributor Author

What I did was actually rotating the coordinate system of the quadratic curve.
I hope this will be of some help to this project.

@dgirardeau
Copy link
Member

See my other version here: #118

With:

  • syntax fix
  • no new method initFromParameters
  • proper management of the case where the normal is close to (0, 0, 1)
  • improved numerical accuracy
  • an unrelated bug fix (in SquareMatrix::inv)

I realized that the choice of 'Y' (named 'axis' in your PR) changes quite a lot the results... So I eventually kept your way of initializing Y/axis as it gives an (almost) consistent behavior on the whole cloud.

@dgirardeau
Copy link
Member

Ok I've merged the other PR (118). So normally your commit and my updates are already merged into master. I'll decline this PR.

Thanks for the contribution!

@dgirardeau dgirardeau closed this Jan 4, 2025
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

Successfully merging this pull request may close these issues.

2 participants