Azzera filtri
Azzera filtri

pair of neighboring triangles from triangulation.

5 visualizzazioni (ultimi 30 giorni)
T Abraham
T Abraham il 7 Gen 2018
Risposto: John D'Errico il 7 Gen 2018
I need to calculate the so-called discrete bending energy of a randomly triangulated sphere. The discrete bending energy is defined as shown in the attached image. Simply put, it is a sum that runs over all pairs of neighboring triangles, and n_i is the surface normal vector of triangle i. So I have used the triangulation class since it is able to output the neighbors (neighbors() function), and the normal vector (faceNormal() function). The question that I have is how do I run over all pairs of neighboring triangles without duplicates? Below I have code that runs over the pairs, but there will obviously be duplicates? How do I fix that? Do I have to keep track of the pairs that have been accounted for? Is there a way to make the neighhbors matrix only have the unique neighbors?
T = triangulation(FBtri,FBpoints);
FN = faceNormal(T); % normal vectors
N = neighbors(T) % neighbors matrix
E_b = 0; % Bending energy
for i = 1:size(N,1)
for j = 1:size(N,2)
E_b = E_b + (1-dot(FN(i,:),FN(N(i,j),:)));
end
end

Risposte (1)

John D'Errico
John D'Errico il 7 Gen 2018
I would simply start with the list of all triangles.
Sort all triangles to list the vertices in increasing order of node from the original point set. That makes the duplicated edges consistent, so you don't have flipped edges to worry about.
Next, get all edges. Each triangle has three edges. Don't worry about duplicates. In fact, the duplicated edges in that list are important.
All edges will appear once only on boundary triangles, unless the triangulation describes a closed surface. All other edges appear twice.
So for every edge that did appear twice, you can link back to the two triangles that supplied that edge. In fact, all of this can be done in vectorized form. (I know, because I did a similar computation once, essentially computing a bending energy for a triangulation.)

Categorie

Scopri di più su Delaunay Triangulation in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by