please delete this question
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
please delete this question
Antworten (1)
dt.Points の1列目がx点のインデクス、2列目がy点のインデクスになります。それぞれの座標を edges 関数で求めるとxの長さ、yの長さが求まると思います。ピタゴラスの定理で斜辺を求めれば距離が計算できます。
% 変数定義
rng(0)
x = rand(10,1);
y = rand(10,1);
xy = [x y];
dt = delaunayTriangulation(x,y);
edge_idx = edges(dt);
%%TRIPLOT を使った描画
triplot(dt)

%%距離計算
xpts = x(edge_idx);
ypts = y(edge_idx);
xdist = abs(xpts(:,1) - xpts(:,2));
ydist = abs(ypts(:,1) - ypts(:,2));
xydist = sqrt(xdist.^2 + ydist.^2);
graph 関数を使うと扱いやすい&きれいなvisualizeができます。
%%GRAPH を使った描画
EdgeTable = table(edge_idx,'VariableNames',{'EndNodes'});
G = graph(EdgeTable);
G.Edges.Weight = xydist;
h = plot(G, 'EdgeLabel', G.Edges.Weight);
h.XData = x;
h.YData = y;

Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!