# Non-uniform border vertex spacing (before movemesh23) and incompatibility when combining with square3-generated meshS

I have a somewhat complex 3d geometry, the boundary of most of which I can construct with meshS pieces from calling square3. However, Due to the different numbers of vertices required on opposing sides in one plane of my design, I want to use buildmesh followed by movemesh23. I can sum all the meshS elements together just fine, but when I try to use tetgen to generate the internal mesh, even after ensuring that the number of joining vertices is the same for each respective pair of meshS elements , I get an error, which is coming from the edges where a square3 meshS is joined with a movemesh23(buildmesh( )) meshS. For example:

PLC Error: A vertex lies in a segment.
Vertex:  (0.0005,-0.000431538,-2e-006).
Segment: [3658, 3660] #-1 (20)
Strange catch exception ???

After experimenting with a simple example:

int nx = 5;
int ny = 4;
int nz = 2;

func y0=0;
func x1=2;

border a1(t=0,1){x=2t; y=0;};
border a2(t=0,1){x=2; y=t;};
border a3(t=0,1){x=2
(1-t); y=1;};
border a4(t=0,1){x=0; y=1-t;};
mesh aa = buildmesh(a1(nx)+a2(ny)+a3(nx)+a4(ny));
meshS Th3aa = movemesh23(aa,transfo=[x,y,0]);
meshS Th3b1 = square3(nx,nz,[x2, y0, y1],orientation=-1);

meshS Th3 = Th3aa + Th3b1;
plot(Th3, wait=1);

I can see the vertex misalignment where the planes are joined:

Also, printing out the vertex locations for the mesh, aa,, I can see that the vertices along the y-axis are not evenly spaced at 0, 0.25, 0.5, 0.75, 1; they are spaced at 0, 0.264423, 0.5, 0.735577, 1. Similarly, they are not spaced evenly along the x-axis, as they are with the square3 meshS.

Does anyone know how to make the buildmesh command space the vertices uniformly along each section of the perimeter? Or how I can otherwise get the vertices to line up on my composite meshS before I run tetgen?

Much thanks!

UPDATE:
I have constructed the planar surface I wanted to using 5 square3’s (with unnecessary increased “border” vertices) instead of 1 movemesh23(buildmesh(…)).

However, I’m still curious about why the buildmesh(border(…)+…) vertices aren’t uniformly spaced.