# Output of delaunay function

8 views (last 30 days)
Athul on 24 Jan 2011
My question is two part:
tri=delaunay(M(:,1),M(:,2));
trisurf(tri,M(:,1),M(:,2),M(:,3))
Q.1 How do I interpret the matrix tri?( i want to know how the numbering of the vertices are done.)
Q.2 How do I delete certain triangles after the applying the function delaunay? ( I am not concerned about losing the property of delaunay triangulation. )
Thank You
P.S: I am new to MATLAB and excuse me if the questions I asked are silly.

Kenneth Eaton on 25 Jan 2011
As per the function documentation, the matrix tri returned from DELAUNAY will be an N-by-3 matrix where N is the number of triangles created. Therefore, each row of tri represents one triangle. The three values for each row represent indices into the set of x and y vertices, which are M(:,1) and M(:,2), respectively, in your example.
For example, consider the case where the first row of tri is [1 2 4]. This defines a triangle whose 3 vertices are at coordinates ( M(1,1), M(1,2)), ( M(2,1), M(2,2)), and ( M(4,1), M(4,2)).
If you want to remove a triangle from tri, all you have to do is remove the given row. For example, if you want to remove the second triangle, you could do this:
tri(2,:) = [];
##### 2 CommentsShowHide 1 older comment
Kenneth Eaton on 14 Feb 2011
@David: What happens is that the 15-by-15 arrays in x and y are reshaped into 225-by-1 column vectors within DELAUNAY, so the indices in tri represent linear indices into the original matrices.