MATLAB:オープニングでドロネー三角形分割を作成します。
質問
私はV
頂点と開口部のn
番号を持つ多角形を持っています。どのように私はMATLABでこのポリゴンのドロネー三角形分割を使用してメッシュを作成することができますか?
私はドロネーを使用することができます知っています機能が、私はどのように入力開放をするのか分かりません。
解決
注:MATLABのの新しいバージョンでは、<のhref = "http://www.mathworks.com/help/matlab/ref/delaunaytriangulation-class.html" のrel = "nofollowをを使用することをお勧めしますnoreferrer "> delaunayTriangulation
クラスとそれに関連する方法。以下のソリューションは、古いバージョンのために有効であり、そして新しいクラスに適応するのは簡単でなければなりません。
あなたはDelaunay三角形分割を作成するために、 DelaunayTri の機能を使用することができます多角形の境界と開口の縁を含むように制約されたエッジを有します。これは、開口部を含み、三角測量を作成しますので、あなたがして(すなわち、開口部における多角形ではなく)関数<のhref = "HTTPを使用して、有界領域「内の」あるのみの三角形を選択することができます:// www.mathworks.com/help/techdoc/ref/delaunaytri.inoutstatus.html」のrel = "nofollowをnoreferrer"> inOutStatus を。
ここでは正方形の穴を有する正方形の一例です
x = [0 1 2 3 3 3 3 2 1 0 0 0 1 2 2 1].';
y = [0 0 0 0 1 2 3 3 3 3 2 1 1 1 2 2].';
c = [(1:11).' (2:12).'; 12 1; (13:15).' (14:16).'; 16 13]; % Constrained edges
dt = DelaunayTri(x, y, c); % Create constrained triangulation
isInside = inOutStatus(dt); % Find triangles inside the constrained edges
tri = dt(isInside, :); % Get end point indices of the inner triangles
triplot(tri, x, y); % Plot the inner triangles
hold on;
plot(x(c(1:12, :)), y(c(1:12, :)), 'r', 'LineWidth', 2); % Plot the outer edges
plot(x(c(13:16, :)), y(c(13:16, :)), 'r', 'LineWidth', 2); % Plot the inner edges
axis equal;
axis([-0.5 3.5 -0.5 3.5]);
そして、ここでは、上記のコードで作成されたプロットです。
所属していません StackOverflow