How to flatten accurately?

Shooting from the hip:

I guess the command has a postprocess where each mesh 3Dedge is checkt against it’s flattened counter part.

If you iterate in parallel through the Mesh.TopologyEdges get the Length of the 2D and 3D Edge.EdgeLine

The topology of both meshes is equal so you can compare edges for both meshes at the same index.

Does this help?
_willem

Thanks @Willem, I will give it a try.
It seems to me that Rhino is calculating a value for compression/stretch on points (not edges) but it should already give a good idea.
I was thinking the compression/stretch may be calculated as the difference in area of all adjacent quads/triangles, or maybe using sampling points on the mesh.
By any chance, would the code for the post-processing step be public?

I have no idea,
@dale might be able to give some insight in how the Squish commands calculates the report with compression/stretch values.

-Willem

To anybody coming to this question:
We’re using a variation of this solution in our production environment.
Fine mesh then Quad remesh then Squish.
It would probably work for most scenarios. You can stop reading here if this works for you.

However in our case, we still get very different results for very similar input shapes, or by changing the targetedgelength property of QuadRemesh.
So we try about a hundred of these parameters and calculate a score to select the best.
The main component of the score is the deformation (max(max_squish, max compress)) where squish/compress is evaluated using another answer: iterate in parallel through the Mesh.TopologyEdges get the Length of the 2D and 3D Edge.EdgeLine.
After finding an acceptable deformation (below 4%), we add a malus to the other scores when their targetedgelength is higher (because it will result in a coarser mesh).
Using this score system, we get one of the smallest deformations, and a rather smooth mesh. This expresses our priorities (first= accuracy of flattening, second = tradeoff between accuracy and smoothness once we’re good enough).

Thanks a lot for the help in this forum, this solution is now used for our production and it’s all thanks to your help!!!

1 Like