A diamond shape is bijective mapped from/to a rectangular shape, thus meshgrid/ndgrid combined with surf are still applicable.
n = 100;
s=linspace(0,1,n);
t=linspace(0,1,n);
[s,t] = meshgrid(s,t);
[sc,tc] = meshgrid([0 1],[0 1]);
x = interp2(sc,tc,[0 4; -4 0], s, t);
y = interp2(sc,tc,[-2 0; 0 5], s, t);
z = peaks(n);
surf(x,y,z,'EdgeColor','none');
view(2)
axis equal
colormap(jet)
The advantage compared to trisurf proposed by Bjorn is you can make sure the boundary of the shape are straight.
0 Comments
Sign in to comment.