I’m not sure how those mappings are implemented, but assuming they use the Mesh.PointAt methods, these use barycentric coordinates, so I’d assume they operate on triangle faces, so yes… but also, assume

Edit: I think my assumption is wrong.
Edit II: Or not, MeshPoint only has a face triangle property.

What you’re looking for are generalised barycentric coordinates, of which probably the most popular form is mean value coordinates.

There’s also a generalisation of this to map points in 3d within closed meshes, which is what I implemented for the Mesh Cage Morph (Skeleton fattener + mesh cage morph)

I realised I posted the wrong version above - the points it was using were shifted by 1 around the polygon. Here’s a fixed version: meanvaluecoordinates2d2.gh (17.8 KB)

As for the error - this happens when an input point lies exactly on one of the vertices of the reference polygon. In this case the weighting of that vertex should be set to 1, and all other weights set to zero. I included this check in the 3d cage morph component, but not in this little test definition.

It seems perfect for polygonal mapping.
As for the quad mapping I think the linear interpolation of NurbsSurface results in linear distortions which for now fits me even building the nurbs surface. But for polygonal it works perfect.

Great.
One other thing I forgot to mention to watch out for - that definition is assuming the points to be mapped and the reference polygon are in the XY plane. If not, you’d need to fit a plane to them and measure the angles in that plane to avoid distortion:

I would like to apply conformal mapping to a quad mesh by projecting it on another mesh.

What kind of qualities this mesh must contain? Would it be good to use kangaroo inscribed circle goal in order to preserve quad angles, while deforming it?

To illustrate the problem I point to ABF++ method, which is for sure too complex especially for these closed meshes. But is there any method in Kangaroo or Rhino in general that can help me to unflatten simple 3D mesh using conformal mapping? And then I want to map tiles back from 2D to 3D.

Or maybe the question is more simple with simpler meshes, for instance how can I distort a mesh in Kangaroo that the result is always con-formally distorted?

Yes, if you make a circle packing mesh on your surface, and another circle packing mesh with same combinatorics (on a plane, or on another surface), the mapping between them is conformal.

If your mesh is topologically a disc or a sphere, things are much easier. Also, it depends on how much area distortion is acceptable. Conformal mappings preserve angles, but for doubly curved surfaces this always comes at the cost of some area distortion. This can be reduced by including seams and cone singularities, as shown in your image. Choosing where to put these, and doing the splitting complicates things though.

Anyway, assuming you can treat it as a disc without excessive area distortion, you can flatten it with a Tutte embedding (just using zero length springs guarantees it will be crossing free in the plane). Then if you optimise both the planar one and the one on the surface (while keeping them on these) for tangent incircles, you have a conformal mapping.

There are other ways of doing this with Kangaroo though -
I’ll post some examples tonight. I also have somewhere a goal for the cross ratio energy given in ‘conformal equivalence of triangle meshes’, that might be a way to do this with fewer steps.

While mapping on squished surface produces better results, which I believe it is some sort of conformal mapping, but I do not believe it is good of doing that. Thus I am search for a mesh unflattenning method.

The Tutte embedding will generally be far from conformal - I was saying you can use that to get an initial planar mapping, and then optimise it to be conformal.

Probably the simplest way, that would work for something like the example you showed, is to triangulate your curved mesh, apply Angle goals to each triangle (and no Length goal), and an OnPlane goal.
If there aren’t too many undercuts this is sometimes all you need. For more complex shapes though, you might need to also temporarily apply other goals such as smoothing to help guide it into the plane without folding over itself

Here’s a simple example (needs Kangaroo 2.5). The flattening probably works best if you remesh to a good triangulation first. For more complex shapes you probably need other ways of preventing foldovers (such as constraining the boundary and using zero length springs for the interior, then gradually applying the angle goal).

It’s a big topic and there are also lots of other ways of going about this.

Also, it’s not in Rhino*, but there’s a very nice standalone software for mesh flattening recently released:

(see also the referenced papers there for more reading on approaches conformal mapping of meshes)
*though in theory I think the libraries could be called from a plugin, which could be neat…

I tried the definition with current food4rhino version, which 2.42. By 2.5 do you mean there would be a future release soon?

And one more bit, in my case I have to reduce angle strength goal to 0.01, if leave it 1 it explodes, 0.1 value have artifacts. Is it because I do not have 2.5 version?

It’s there on food4rhino, just scroll to the bottom of the list.
Also yes, in 2.5 I fixed an old issue with the angle goal where it behaved differently dependent on model scale.

Thanks, it is nice to see how close it is to the surface squish command. All I do not if needed but adding mesh spring preserves the scaling of the mesh. Also for the projection, the mesh is not overlapping if the plane projection strength is very slowly increased, I am wondering if there could be a custom goal which strength increase within iterations:)

With mesh springs, right side surface squish command from rhino: