Output of delaunay function

15 次查看(过去 30 天)
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
Kenneth Eaton 2011-1-25
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 个评论
David Jenkins
David Jenkins 2011-2-13
I'm having a similar problem.
Your explanation seems logical however when I enter the example given on the MATLAB help page:
[x,y]=meshgrid(1:15,1:15);
tri = delaunay(x,y);
z = peaks(15);
trimesh(tri,x,y,z)
My values of tri however don't seem to correspond to indices of x and y. x and y are 15x15 arrays however the first few lines of tri are:
[40 25 24; 18 4 3; 9 24 25]
How can I be getting values >15 if they are supposed to reference indices of a 15x15 array
Kenneth Eaton
Kenneth Eaton 2011-2-14
@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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Delaunay Triangulation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by