How to associate edges of a triangles in a triangulation with numerical values?
5 views (last 30 days)
Show older comments
I am trying to associate numerical values with the edges of each triangle of a triangulated mesh (Delaunay Triangulation) and I want to ensure that the sum of the associated values is equal to a fixed number. For Ex- Each triangle in the mesh is composed of two different types of materials (material 1 and material 2) such that there are 2 edges made of material 1 and the other made of material 2. I want to give a numerical value of 1 to material 1 and 0 to material 2, and thus constraint the sum of the edges of each triangle to be = 0+1+1=2.
2 Comments
Fifteen12
on 20 Sep 2023
Can you provide information about how your data is encoded? Are you working with coordinate points?
Answers (1)
Karan Singh
on 31 Jan 2025
Edited: Karan Singh
on 31 Jan 2025
Hi Sabyasachi,
The points would be required to check if, after the triangulation, the constant sum is possible or not. So, more data would help. I have tried it with a random dataset; however, I was not able to find an example that satisfies the condition. Can you specify if you wish to have a condition to check or something else? Here is one of my attempts:
I have assigned the values at random, but there should also be a condition that checks if this assignment is correct or not.
% Define points (example polygon and inner points)
points = [0 0; 1 0; 2 0; 0 1; 1 1; 2 1; 0 2; 1 2; 2 2];
% Compute Delaunay triangulation
DT = delaunayTriangulation(points);
% Get triangle connectivity list
triangles = DT.ConnectivityList;
% Get edges of the triangulation
edges = edges(DT);
% Initialize edge values (0 for material 2, 1 for material 1)
edgeValues = zeros(size(edges, 1), 1);
% Define a function to check material type (for illustration)
% Assume material 1 for first two edges of each triangle and material 2 for the third
for i = 1:size(triangles, 1)
tri_edges = [triangles(i, [1,2]); triangles(i, [2,3]); triangles(i, [3,1])]; % Triangle edges
% Find index of edges in the edge list
for j = 1:3
edgeIndex = find(ismember(edges, tri_edges(j, :), 'rows') | ismember(edges, flip(tri_edges(j, :)), 'rows'));
if j <= 2
edgeValues(edgeIndex) = 1; % Material 1
else
edgeValues(edgeIndex) = 0; % Material 2
end
end
end
% Display results
disp('Edges and assigned values:');
disp([edges, edgeValues]);
0 Comments
See Also
Categories
Find more on Delaunay Triangulation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!