Hello,

there is only one recently added example of how to set a tensorial metric in MMG2D, for anisotropic meshing but it relies on a mesh/sol file. I thought it would be great to have an example that demonstrates:

- how to first compute a mesh from boundary using MMG2D_mmg2dmesh
- and then how to remesh it using MMG2D_mmg2dlib using an anisotropic metric.

so that the example is self-contained and does not rely on a mesh/sol file, so that one learns from the example how to compute the metric. Since I did not find such an example, I wrote one. The most fundamental example is meshing the coordinate space of a sphere in terms of longitude/latitude, with the objective that the metric makes sure that the distortion disappears when mapped to 3d:

https://gist.github.com/Mathias-Fuchs/b8e9db7a40e304f85f9a481f0a3178fb

and basically, it works, the resulting 3d mesh looks like this:

https://pasteboard.co/J9uM8Kz.png

and the resulting 2d mesh looks like this:

https://pasteboard.co/J9uS1RB.png

which are both fine.

HOWEVER, and this is where I need your help, *I don’t know how to scale the metric*. In line 52 I have to define a factor of 1000 to pre-multiply the metric with, and this number was just found by trial and error. It did not work just with a factor of one. Empirically, I found that this factor somehow seems to govern the edge size of the resulting mesh (which can’t be set by hsiz), *but what exactly is the relationship between that scaling factor of the metric and the resulting edge lengths*? How to find that factor in general from the mesh of departure?

I will be happy to submit this example for inclusion in the mmg libexamples folder if it is of interest.

Also, is there another way to achieve an undistorted spherical mesh directly in MMGS instead of MMG2D?

Thanks for any help.