function [R,uh,vh] = tri2surf(face,vertex,z,M,N)
uv = [real(z),imag(z)];
maxuv = max(uv);
minuv = min(uv);
uh = (maxuv(1)-minuv(1))/(N-1);
vh = (maxuv(2)-minuv(2))/(M-1);
u = linspace(minuv(1),maxuv(1),N);
v = linspace(minuv(2),maxuv(2),M)';
[X,Y] = meshgrid(u,v);

F1 = TriScatteredInterp(uv(:,1),uv(:,2),vertex(:,1));
F2 = TriScatteredInterp(uv(:,1),uv(:,2),vertex(:,2));
F3 = TriScatteredInterp(uv(:,1),uv(:,2),vertex(:,3));
zq1 = F1(X,Y);
zq2 = F2(X,Y);
zq3 = F3(X,Y);
R = reshape([zq1(:),zq2(:),zq3(:)],M,N,3);