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

Problem creating the skeleton #8

Open
mobereng opened this issue Jan 23, 2021 · 3 comments
Open

Problem creating the skeleton #8

mobereng opened this issue Jan 23, 2021 · 3 comments

Comments

@mobereng
Copy link

Hi !

I'm currently implementing the exact same solution, but on C++ using LibIGL, and there's a couple of questions I have, if you can help me it would mean a lot

  1. Is there any restriction on the size of the initial mesh ? When I scale up and down the mesh, I get different results, but I'm not sure about what would be the recommended mesh initial size.
  2. How do you manage the "Degenerated Faces" I see in the algorithm, that after getting the results for the new vertices positions there's no evaluation for possible failures on the following iterations. On C++ what I'm currently doing is validating if a triangle area is less than a treshold (approximate 0 area) and then mark the 3 vertices as "fixed" so they won't be touched on following iterations. Even with this clause, my linear algebra solver gives me NaN at some point and I have to stop the algorithm (otherwise it just put all vertices in NaN if I continue iterating). So my question here is that, how can I manage that situation.

Thanks !

@schlegelp
Copy link
Collaborator

Are you referring to the mesh contraction or the edge collapse?

@mesabg
Copy link

mesabg commented Jan 24, 2021

To the mesh contraction

@schlegelp
Copy link
Collaborator

In general, the algorithm presented in the paper leaves a lot of details out which in turn left me to go with my best guess and "whatever works". Hence the disclaimer: my implementation might contain errors. That being said, the authors provide code with their paper (download link on this website) if you want to have a look.

  1. Is there any restriction on the size of the initial mesh ? When I scale up and down the mesh, I get different results, but I'm not sure about what would be the recommended mesh initial size.

I'm guessing this refers to the dimensions of the mesh not the number of vertices/faces? Yes, I found parameterisation of the algorithm to be finicky at times. In theory, WL0 is adjusted depending on the average face area and I would think that compensates for differences in size. Your comment gives me an idea though: perhaps it would be better to normalise the mesh dimensions before contraction and simply scale it back after we're done - this should help with finding parameters that work for most situations.

  1. How do you manage the "Degenerated Faces" I see in the algorithm, that after getting the results for the new vertices positions there's no evaluation for possible failures on the following iterations. On C++ what I'm currently doing is validating if a triangle area is less than a treshold (approximate 0 area) and then mark the 3 vertices as "fixed" so they won't be touched on following iterations. Even with this clause, my linear algebra solver gives me NaN at some point and I have to stop the algorithm (otherwise it just put all vertices in NaN if I continue iterating). So my question here is that, how can I manage that situation.

Not having seen any of your code (even if: I'm not very familiar with C++), I can't possibly tell you how to fix it. Off the top of my head, the only thing I can think of is that depending on how you produce the Laplacian operator, a degenerate face might give you infinite values. My solution to this has been to simply clamp those to very high values instead: https://github.com/schlegelp/skeletor/blob/09d55e1f63f44bc3f99ebbd968850b0a5c356d46/skeletor/utilities.py#L167

Other than that, I can only recommend stepping through the algorithm and do a side-by-side comparison between the results from the Python and your implementation. It's entirely possible that there is some under-the-hood Python magic that makes my code work but doesn't fly with C++.

Anywho: keep me posted - if you find errors/improvements during your work, I'd be happy to hear them!

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

3 participants