skeletor
skeletor copied to clipboard
Problem creating the skeleton
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
- 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.
- 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 !
Are you referring to the mesh contraction or the edge collapse?
To the mesh contraction
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.
- 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.
- 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!