例子 help convexHull
x = rand(10,1) y = rand(10,1) dt = delaunayTriangulation(x,y) k = convexHull(dt) plot(dt.Points(:,1),dt.Points(:,2), '.', 'markersize',10); hold on; plot(dt.Points(k,1),dt.Points(k,2), 'r'); hold off;
x = [STA(:,1);STA(:,3)]; y =[STA(:,2);STA(:,4)]; dt = delaunayTriangulation(x,y); k = convexHull(dt) plot(dt.Points(:,1),dt.Points(:,2), '.', 'markersize',10); hold on; plot(dt.Points(k,1),dt.Points(k,2), 'r'); hold off;
dt.Points(k,1),dt.Points(k,2) 即多边形边界
%% 多边形边界外的不画图,掩膜处理
isin=inpolygon(point_p_lon,point_p_lat,dt.Points(k,1),dt.Points(k,2)); result1(~isin)=NaN; % pcolor(point_p_lon,point_p_lat,result1); % load MyColormaps;colormap(mymap);colorbar;shading interp; contourf(point_p_lon,point_p_lat,result1,10);shading flat colorbar; % colormap(flipud(jet));%色标反转 hold on; load('shengjielat.mat') load('shengjielon.mat') plot(shengjielat,shengjielon) set(gcf, 'PaperPositionMode', 'auto')
|
请发表评论