Fit deformed mesh to its original Brep shape

Hi everyone,

I’ve already had some luck getting very helpful responses from members of this forum so here I’m sollicitating you guys again :slight_smile:

Here is the situation:
Starting from a very basic Brep shape (comprised of only planar surfaces), I have made a mesh and deformed it, remeshed it, etc.
Now, I would like to establish a correspondance between my original shape and the deformed shape: I want to re-transform my deformed mesh so that it would perfectly fit my original brep shape. That way, I would get 2 meshes that only differ by the position of their vertices and I could thus morph any other thing I want from the starting to the deformed shape (in my case, a set of curves, and I already have the script for the morphing ready).

To sum up: I need my deformed mesh to be fitted onto my original brep, without remeshing operations, only vertex manipulations.

The problem is that I have some trouble doing so without damaging my mesh: getting vertices in very close positions, getting 0-area faces, generating non-manifold edges, and so on.
I have a result that is promising, but has some problems at the edges of the brep I want it to fit.

Would you guys have seen anything similar, or read an article, paper, … that would relate to the subject ?
I am fairly good at Python scripting and I have learnt to manipulate Rhino objects rather well these past weeks, so I’m not afrait to get my hands dirty in some code :wink:

Thanks a lot in advance!

Here are some files and illustrations:

  • on the left: the deformed mesh I want to morph to its original shape
  • on the right: my best result so far: the mesh and the edges of the shape I want to fit

Clean ShrinkWrap_V3_forForum.gh (146.0 KB)
WorkingFileR6_ForForum.3dm (10.2 MB)