Building a 2D mesh with 3D borders and getting "Error points border points to close"


I am trying to learn about getting a 3D volume mesh by assembling several surface meshes built with meshS.

First I am building 3D borders to describe the contours of a surface to be meshed with mesh and then meshS. For simplifying my learning process, I am trying to build a cube with 6 surfaces.

While I have successfully build the first surface mesh with the code:

border E01(t=0, 1.){x=t; y=0; z=0;}
border E02(t=0, 1.){x=1; y=t; z=0; }
border E03(t=0, 1.){x=1.-t; y=1; z=0;}
border E04(t=0, 1.){x=0; y=1.-t; z=0;}
mesh Th0=buildmesh(E01(10)+ E02(10)+E03(10)+E04(10));
meshS F0 = movemesh23(Th0,transfo=[x,y,z]);

I get the following error message:

Exec error : Error points border points to close < diameter*1e-7

when I tried to build a second surface mesh (to be assembled with the first one later):

border E11(t=0, 1.){x=0; y=0; z=t;}
border E12(t=0, 1.){x=t; y=0; z=1; }
border E13(t=0, 1.){x=1.; y=0; z=1-t;}
border E14(t=0, 1.){x=1-t; y=0; z=0;}
mesh Th1=buildmesh(E11(10)+ E12(10)+E13(10)+E14(10));

I plotted the boundary with:


and it seems that the orientation is correct.

So, what did I do wrong?

By the way, many thanks to the Freefem developpers and other contributors. This app is great!.



Actually, continuing my investigation I remarked that my first surface was not a success even if did not meet any error message and observed the mesh I wanted. Indeed, I noticed that the first meshing flatens the surface. If I change the z evolution such that the surface is curved, the resulting mesh with the command “mesh” returns a flat surface while a plot of the boundary shows the expected curved effect. Does anybody know how to build arbitrary surfaces in 3D to be assembled later on to enclose a volume to be meshed?