DelaunayTri output relation to inputs

Hi,
This is likely a silly question, but if I have a vector of x,y coordinates which I pass to DelaunayTri:
dt = DelaunayTri(tri_x,tri_y);
What exactly is the relation between dt and tri_x and tri_y? Trying to understand this, I looked at the vertex attachments:
t = vertexAttachments(dt);
t{1}
ans = 726 820 822 821 735
Does that mean that the x,y coordinates of the points with vertexes attached by an edge to point 1 is tri_x(726), tri_y(726), etc.?
Thank you, Michael

 채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 11월 26일

0 개 추천

Analyze this code, I think that it will help you to understand DelaunayTri:
[tri_x tri_y] = meshgrid(-1:.5:1);
tri_x = tri_x(:);
tri_y = tri_y(:);
dt = DelaunayTri(tri_x,tri_y);
vertexNumber = 13;
t = vertexAttachments(dt,vertexNumber);
fprintf('Simplices attached to vertex %i: ',vertexNumber)
disp(t{1})
% visualization
triplot(dt);
hold on
vxlabels = arrayfun(@(n) {sprintf('P%d', n)}, (1:25)');
Hpl = text(tri_x, tri_y, vxlabels, 'FontWeight', 'bold', 'HorizontalAlignment',...
'center', 'BackgroundColor', 'none');
ic = incenters(dt);
numtri = size(dt,1);
trilabels = arrayfun(@(x) {sprintf('T%d', x)}, (1:numtri)');
Htl = text(ic(:,1), ic(:,2), trilabels, 'FontWeight', 'bold', ...
'HorizontalAlignment', 'center', 'Color', 'blue');
triplot(dt(t{:},:),tri_x,tri_y,'Color','r')
hold off
axis off

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Aerospace Blockset에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by