Effacer les filtres
Effacer les filtres

how to find the area of the triangles formed as a result of delaunay triangulation

43 vues (au cours des 30 derniers jours)
I have applied delaunay triangulation to my image. i have got 160 triangles. i need to find area of each triangle. Kindly help me with code. only after i can proceed with my prooj.i am new to matlab.
  1 commentaire
M.S. Khan
M.S. Khan le 24 Août 2020
How you counted the number of triangles? Please tell me the methods, regards

Connectez-vous pour commenter.

Réponse acceptée

Roger Stafford
Roger Stafford le 3 Mar 2014
If a triangle is in two dimensional space with vertices at (x1,y1), (x2,y2), and (x3,y3), its area is given by:
area = 1/2*abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1));
or
area = 1/2*abs(det([x1,y1,1;x2,y2,1;x3,y3,1]));
If it is in three dimensions with vertices at P1 = [x1,y1,z1], P2 = [x2,y2,z2], P3 = [x3,y3,z3], its area is:
area = 1/2*norm(cross(P2-P1,P3-P1));
These formulas are more accurate for numerical computation than those which depend on the lengths of the three sides of the triangle.
Of course you must adapt these formulas for use with your 160 triangles, either using the necessary for-loop or possibly a vectorized expression.
  2 commentaires
Valerio Ficcadenti
Valerio Ficcadenti le 14 Août 2022
Hi
How did you manage the polygons that are not closed? Namely, those with vertexes to infinite?
Valerio

Connectez-vous pour commenter.

Plus de réponses (1)

Christopher Rock
Christopher Rock le 2 Août 2018
Vectorised code based off Roger Stafford's answer.
function A = triarea(t, p)
% A = TRIAREA(t, p) area of triangles in triangulation
Xt = reshape(p(t, 1), size(t)); % X coordinates of vertices in triangulation
Yt = reshape(p(t, 2), size(t)); % Y coordinates of vertices in triangulation
A = 0.5 * abs((Xt(:, 2) - Xt(:, 1)) .* (Yt(:, 3) - Yt(:, 1)) - ...
(Xt(:, 3) - Xt(:, 1)) .* (Yt(:, 2) - Yt(:, 1)));
  2 commentaires
SAsa
SAsa le 16 Fév 2019
What are your inputs t and p ?
Diego Andrés Alvarez Marín
T is the output of delaunay()
P = [X Y]; % array with two columns that contains the coordinates of the nodes

Connectez-vous pour commenter.

Catégories

En savoir plus sur Delaunay Triangulation dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by