9-6 三???法?計?幾?

MATLAB 紣ѤF@tCOAiΨӸѨMTơ]Triangulation^BFI]Nearest Neighbors^AΨ䥦pX]Computational Geometry^譱DAڭ̸ Delaunay Tơ]Trangulation^Cw@ X-Y WIADelaunay OiǦ^@եѳoIҧΦTΡAӥB@I|@ӤTΪ~ꤧCi Delaunay ΪkAڭŪJ@ X-YWIAåHGϪ覡ӪܡG

Example 1: 09-k/seamount01.mload seamount.mat plot(x, y, '.');

ڭ̥iWzIi Delaunary TơAèϥ triplot OeX䵲GAAN|WhAҦpG

Example 2: 09-k/triplot01.mload seamount.mat tri = delaunay(x, y); triplot(tri, x, y); hold on, plot(x, y, '.r'); hold off

ڭ̤]iHϥ trisurf άO trimesh ӵeXϥΤTҲͪApUG

Example 3: 09-k/trisurf01.mload seamount.mat tri = delaunay(x, y); trisurf(tri, x, y, z); axis tight; colorbar

Ū̥iNWzdҤ trisurf 令 trimeshANiHͤTCYn͵uANnϥΤe쪺 griddata OApUG

Example 4: 09-k/tricontour01.mload seamount.mat xi = linspace(min(x), max(x), 50); yi = linspace(min(y), max(y), 50); [xi, yi] = meshgrid(xi, yi); zi = griddata (x, y, z, xi, yi, 'cubic'); [c, h] = contourf(xi, yi, zi, 'b-'); clabel (c, h); colorbar; % CPƭȪӪ

@ Delaunary TƤAziHiطjMG

Voronoi ϧΩM Delaunay TYD`KAVoronoi ϧΥiNIҦbeƭӦhΡAC@ӦhΥu]t@ӸIAӥBw@IɡAIM̾F񪺸I|P@ӦhΤCƹWAunN Delaunary ұoUӤTΤAC@eXuAYio Voronoi ϧΡCMATLAB voronoi OiΨӵeX Voronoi ϧΡA|ҦpUG

Example 5: 09-k/voronoi01.mload seamount.mat voronoi(x, y);

ڭ̥iN Voronoi ϧΩM Delaunay TεebP@iϡApUG

Example 6: 09-k/voronoi02.mx = rand(20,1); y = rand(20,1); voronoi(x, y, 'b:'); tri = delaunay(x, y); hold on h = trimesh(tri, x, y, 0*x); hold off set(h, 'facecolor', 'none'); axis equal square axis([0 1 0 1]);

bWϤAuO Delaunay TΡAuhO Voronoi ϧΡCƹWAC@ Voronoi ϧΪuqAOY@ӤTΪ@䪺uAҥHC@ Voronoi ϧΩҧΦhΪIAOY@ӤTΪ~ߡC~AC@ Voronoi ϧΩҧΦhΡAu]t@Ө˸IAN˸IuդOdvA]󦹦hΤIA|˸IAL˸IC

Hint
b˦ѡ]Pattern Recognition^Ǭ쪺[IӬݡAVoronoi ϧδNOg KNNC (K-Nearest-Neighbors Classifiers) kb K 1 ɩұo쪺GApGb̷ӤPOӹ Vornoi ϧζiۦANiHo KNNC Mɡ]Decision Boundary^C

~AMATLAB convhull OiΩp@ոI̤pYhΡ]Convex Hulls^CҦpAڭ̥i confhull Oӭp seamount I̤pYhΡApUG

Example 7: 09-k/convhull01.mload seamount.mat plot(x, y, '.'); k = convhull(x, y); hold on, plot(x(k), y(k), 'r'), hold off % eX̤pYh

t@OO inpolygonAiΩp@ӸIO_@ӫʳhΡCҦpAڭ̥iHͤ@ӤΡAA inpolygon X󦹤ΤIAMϥΤPCӵeXoơApUG

Example 8: 09-k/inpolygon01.mtheta = linspace(0, 2*pi, 7); xv = cos(theta); yv = sin(theta); x = randn(250,1); y = randn(250,1); in = inpolygon(x, y, xv, yv); plot(xv, yv, 'b', x(in), y(in), 'g.', x(~in), y(~in),'k.'); axis image


MATLAB{]pGig