I have the triangulation dt(or possibly tetrahedrization) of a three-dimensional point cloud, and I would like to find a good way to extract triangles from it. Notice, I know how to get tetrahedra, just dt.ConnectivityList, is there an effective way to get triangles from tetrahedra? Each triangle should appear only once in the list.
I am currently doing the following - however, it is very slow:
dt = delaunayTriangulation([X Y Z]);
tetrahedra = dt.ConnectivityList;
tris = cell(1, size(tetrahedra, 1)); % contains indices of tris in a tetra
for tt=1:size(tetrahedra, 1)
vertIds = tetrahedra(tt, :); % vertex indices
vmask = logical([0 1 1 1]);
tris{tt} = [vertIds(circshift(vmask, [0 0 0 0]));
vertIds(circshift(vmask, [1 1 1 1]));
vertIds(circshift(vmask, [2 2 2 2]));
vertIds(circshift(vmask, [3 3 3 3]))];
end
tris = unique(sort(cell2mat(tris'), 2), 'rows');
source
share