Created
April 10, 2015 12:22
-
-
Save knedlsepp/5a62e16d22d01ab38f56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear; | |
data = [ 475. , 605.75, 1.; | |
571. , 586.5 , 2.; | |
233. , 558.5 , 3.; | |
669.5 , 562.75, 4.; | |
291.25, 546.25, 5.; | |
759. , 536.25, 6.; | |
362.5 , 531.5 , 7.; | |
448. , 513.5 , 8.; | |
834.5 , 510. , 9.; | |
897.25, 486. , 10.; | |
545.5 , 491.25, 11.; | |
214.5 , 481.25, 12.; | |
271.25, 463. , 13.; | |
646.5 , 466.75, 14.; | |
739. , 442.75, 15.; | |
340.5 , 441.5 , 16.; | |
817.75, 421.5 , 17.; | |
423.75, 417.75, 18.; | |
202.5 , 406. , 19.; | |
519.25, 392.25, 20.; | |
257.5 , 382. , 21.; | |
619.25, 368.5 , 22.; | |
148. , 359.75, 23.; | |
324.5 , 356. , 24.; | |
713. , 347.75, 25.; | |
195. , 335. , 26.; | |
793.5 , 332.5 , 27.; | |
403.75, 328. , 28.; | |
249.25, 308. , 29.; | |
495.5 , 300.75, 30.; | |
314. , 279. , 31.; | |
764.25, 249.5 , 32.; | |
389.5 , 249.5 , 33.; | |
475. , 221.5 , 34.; | |
565.75, 199. , 35.; | |
802.75, 173.75, 36.; | |
733. , 176.25, 37.]; | |
X = data(:,1:2);X(:,2) = -X(:,2); | |
dt = delaunayTriangulation(X); | |
bd = dt.freeBoundary; | |
bdNodes = unique(bd); | |
bdconnectivity = knnsearch(X,X(bdNodes,:),'K',3); | |
interiorconnectivity = knnsearch(X,X(setdiff(1:size(X,1),bdNodes),:),'K',5); | |
clf; | |
plot(X(:,1),X(:,2),'xr'); | |
hold on; | |
for i = 1:size(interiorconnectivity,1) | |
for j = 2:5 | |
plot(X(interiorconnectivity(i,[1,j]),1),... | |
X(interiorconnectivity(i,[1,j]),2)); | |
end | |
end | |
for i = 1:size(bdconnectivity,1) | |
for j = 2:3 | |
plot(X(bdconnectivity(i,[1,j]),1),... | |
X(bdconnectivity(i,[1,j]),2)); | |
end | |
end | |
axis equal | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment