% Interpolazione su una griglia triangolare

close all
clear all
clc

load seamount
tri = delaunay(x,y);

figure;
triplot(tri,x,y);

figure;
voronoi(x,y);
grid on

% Convex hull
figure;
plot(x,y,'.','markersize',10)
k = convhull(x,y);
hold on, plot(x(k),y(k)), hold off
grid on


xstep = 0.01;
ystep = 0.01;
[xi,yi] = meshgrid(min(x):xstep:max(x),min(y):ystep:max(y));
zi = griddata(x,y,z,xi,yi,'cubic');
figure;
[c,h] = contour(xi,yi,zi,10,'k-'); 
clabel(c,h);

figure;
trisurf(tri,x,y,z);

figure;
surf(xi,yi,zi);
