I want to obtain triangles which are from triangle set obtained from Delaunay Triangulation. I wrote the following code. How can I obtain triangles which have a shred edge with each other (please see the image)? According to this image, I want to obtain triangle1 and 2 from triangle set obtained from Delaunay Triangulation.
rng default;
P = rand([32 2]);
DT = delaunayTriangulation(P);
triplot(DT)
Short answer: neighbors(DT)
.
Example:
rng default
P = rand([12 2]);
DT = delaunayTriangulation(P);
IC = incenter(DT);
% visualize incl. ID in the center
figure
triplot(DT)
hold on
text(IC(:,1), IC(:,2), num2str([1:size(IC,1)]'))
% find all neighboring triangles
neighbors(DT)
% for the first triangle
neighbors(DT, 1)