Batch create grid with Z values from matlab matrix, then triangulate and export raw t

Hello,

For a research project i need to triangulate some xyz surfaces in the form of matlab matrices (each in the form of a xy matrix). for each xyz surface, xy is simply the domain and z the height. This thing is, i need a conformal triangulation, meaning that the angles of a triangle in R3 must be the same for that same triangle mapped to the plane. The usual delaunay triangulations does not guarantee that property since what happens is that the triangulation is done relative to the xy domain then the vertices are elevated to their z value which breaks the conformality of the original surface. I can’t seem to find any direct code for conformal triangulation however testing with blender i discovered that if i create a grid (say 1010 vertices) then translate the z values of each vertex to the desired value (so that it is basically the quad mesh of my matlab surface) and then triangulate this quad mesh, it seems i can get a conformal triangulation.

So my workflow would be like this (in a python script):
1/ Create a variable size_xy that would be of the size as my matlab matrix (e.g: 1010)
2/ Create a variable z that would store the z values of my matlab matrix (so 10
10 values)
3/ Create a grid quad mesh of size_xy
4/ Translate each vertex in the Z direction to the z(x,y) value so that the grid now represent my original matlab data
5/ Triangulate the quad mesh (beauty algorithm)
6/ Export only the connectivity list (the indices of triangles of each face, shifting them by +1 because in blender the first vertex is 0 which causes problems for post processing in matlab)

Batch do that for all surfaces because i may have thousands of surfaces!
I’m sure it can be done with a python script. I’ve searched for the 3 first points hoping that i would find a quick way to create a quad mesh from a matlab file but the scripts i have tested didn’t give quad meshs but rather curves. While i’m familiar with some programming languages i’m not with python.

Could you give me some help on how the skeleton of a python script that would that would look like?

Thank you very much!