メインコンテンツ

多角形領域の近似の中心軸の計算

制約付き Delaunay 三角形分割を使って多角形領域の近似の中心軸を作成します。多角形の "中心軸" は、多角形内部の最大の円盤形の中心の位置で定義されます。

領域の境界線上の点のサンプルの制約付き Delaunay 三角形分割を作成します。

load trimesh2d
dt = delaunayTriangulation(x,y,Constraints);
inside = isInterior(dt);

領域の三角形を表す三角形分割を作成します。

tr = triangulation(dt(inside,:),dt.Points);

近傍三角形の外心を結ぶ一連のエッジを作成します。追加のロジックにより、そのような一意の一連のエッジが作成されます。

numt = size(tr,1);
T = (1:numt)';
neigh = neighbors(tr);
cc = circumcenter(tr);
xcc = cc(:,1);
ycc = cc(:,2);
idx1 = T < neigh(:,1);
idx2 = T < neigh(:,2);
idx3 = T < neigh(:,3);
neigh = [T(idx1) neigh(idx1,1); T(idx2) neigh(idx2,2); T(idx3) neigh(idx3,3)]';

領域の三角形を緑色で、領域の境界線を青色で、中心軸を赤色でプロットします。

clf
triplot(tr,"g")
hold on
plot(xcc(neigh),ycc(neigh),"-r",LineWidth=1.5)
axis([-10 310 -10 310])
axis equal
plot(x(Constraints'),y(Constraints'),"-b",LineWidth=1.5)
xlabel("Medial Axis of Polygonal Domain",FontWeight="b")
hold off

Figure contains an axes object. The axes object with xlabel Medial Axis of Polygonal Domain contains 364 objects of type line.