I think FreeCAD doesn't provide any surface flattening algorythm right now. As we need this for OpenGlider and it could be useful for FreeCAD too I wanted to start a small topic about it. My plan is to use a triangle mesh, map it to 2d with lscm and let the deformed mesh relax with a finite element method . I think it is done similarly in commercial programs .
If anyone has an idea/input on this topic I would be very pleased to hear it.
good idea, i think it's time to have such tools.
I have to read the paper about lscm.
My idea was to analyse the curvature of a face and find the best places to cut and unroll,maybe it results into the same.
segmentation is another problem. it is covered in the lscm-paper shortly. But for sure automatic segmentation would be nice to have too.
lscm simply try to find a coresponding 2d map which minimize the angle difference of all triangles. this can be done by ls-solve one linear system.
the fem step is needed to minimize the internal work. so solution should represent the optimal unwrapped surface. in case the surface is developeable (eg cylinder, cone, oloid...) the solution should be the exact flatted surface.
Such tool would likely be useful when forming a piece of metal to get basic material without much waste involved.
P.S. But said that its nice to see on how solid can be turned into surface and now going further to flatten that surface. But its hard to get excited about it if the final destination of such tools isn't for example Reverse Engineering WB.
as I have already said we will use this in openglider too. so it will be a c++ shared library + python bindings... writing a interface to freecad shouldn't be that hard. But it makes no sense including it directly in freecad.
I only thought about the need to have this in two different libraries. And I think it is most useful if the unwrapping is provided by a own library.
The fem step is more difficult then I thought. Somehow the mesh has to be fixed. But this is very difficult as it will influence the solution. Constraining one point is ok, but then the solution will rotate about this point.
double_curvature.png (115.42 KiB) Viewed 4248 times
Typically this problem is solved by using a krylov type solver and removing the nullspace from the solution. In this case all translation and rotations. This makes the matrix regular and hence the system solvable without influencing the solution.
thanks for the hint. I will look if eigen does provide such a solver.
right now i am using sparse cg method which is quite fast on the symmetric matrix. I think there should be also the possibility to rotate the mesh so that one triangle edge align to y=0 and then fix one point of the edge and y of the other point of the edge. I will have a look what's the nicer solution.
Last edited by looo on Sun Oct 23, 2016 4:53 pm, edited 1 time in total.