Finding Areas for Constrained 2D Delaunay Triangulation

4 ビュー (過去 30 日間)
Dimo Iordanov
Dimo Iordanov 2021 年 2 月 2 日
回答済み: Dimo Iordanov 2021 年 3 月 9 日
Hello,
I am having issues with finding the coordinates and the areas of a constrained 2D delaunay triangulation. I have managed to do that if the problem is not constrained, but the constrain gives strange answers for my vertixes, and that makes hard for me to find the areas.
Thanks for the help!
The code that I am uploading is an example that I took from the internet, since it is slightly simpler than my original code.
figure()
axis([-1 17 -1 6]);
axis equal
P = [0 0; 16 0; 16 2; 2 2; 2 3; 8 3; 8 5; 0 5];
C = [1 2; 2 3; 3 4; 4 5; 5 6; 6 7; 7 8; 8 1];
DT = delaunayTriangulation(P,C);
patch(P(:,1),P(:,2),'-r','LineWidth',2,'FaceColor',...
'none','EdgeColor','r');
% Compute the in/out status.
IO = isInterior(DT);
hold on;
axis([-1 17 -1 6]);
triplot(DT(IO, :),DT.Points(:,1), DT.Points(:,2),'LineWidth', 2)
hold off;
v1 = P(tri(:,2), :) - P(tri(:,1), :);
  1 件のコメント
darova
darova 2021 年 2 月 5 日
Can you calculate area of each triangle?

サインインしてコメントする。

採用された回答

Dimo Iordanov
Dimo Iordanov 2021 年 3 月 9 日
Yeah I managed to do that by using the code below.
for i=1:9
x1 = DT.Points(DT.ConnectivityList(i,:),:);
area(i) = 1/2.*abs((x1(2,1)-x1(1,1)).*(x1(3,2)-x1(1,2))-(x1(3,1)-x1(1,1)).*(x1(2,2)-x1(1,2)));
b=area.*[1; 1; 1; 1; 1; 1; 1; 1];
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDelaunay Triangulation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by