Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

please delete this question

1 Ansicht (letzte 30 Tage)
satoshi oi
satoshi oi am 21 Jun. 2018
Geschlossen: satoshi oi am 25 Jun. 2018
please delete this question

Antworten (1)

mizuki
mizuki am 22 Jun. 2018
Bearbeitet: mizuki am 23 Jun. 2018
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;

Tags

Community Treasure Hunt

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

Start Hunting!