how i can calculate the surface(2D) of delaunay triangulation ??????????????????
4 ビュー (過去 30 日間)
古いコメントを表示
I want to calculate the area(the surface) of a zone(2D) using the delaunay triangulation or convex hull, how can i do ?plzzzzzzzz i need help net = [1:n;rand([1,n])*x;rand([1,n])*y]; net1 = net; xx=net(2,:); yy=net(3,:); dt = DelaunayTri(xx',yy'); P = [xx',yy']; K = convexHull(dt); triplot(dt,'cyan');
0 件のコメント
回答 (1 件)
Gautam
2025 年 2 月 11 日 8:51
Hello @ali hadjer
Delaunay triangulation divides the 2D area into triangles without any overlapping. Once you have the triangulation, you can calculate the area of each triangle and sum them up to get the total area using the "polyarea" function.
% Sample data points
points = [0, 0; 1, 0; 1, 1; 0, 1; 0.5, 0.5];
% Perform Delaunay triangulation
tri = delaunay(points(:, 1), points(:, 2));
% Plot the triangulation
figure;
triplot(tri, points(:, 1), points(:, 2));
hold on;
plot(points(:, 1), points(:, 2), 'r*');
title('Delaunay Triangulation');
xlabel('X');
ylabel('Y');
grid on;
% Calculate the area of each triangle
area = 0;
for i = 1:size(tri, 1)
x = points(tri(i, :), 1);
y = points(tri(i, :), 2);
area = area + polyarea(x, y);
end
% Display the total area
fprintf('Total Area using Delaunay Triangulation: %.2f\n', area);
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Delaunay Triangulation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!