Output of delaunay function

4 visualizaciones (últimos 30 días)
Athul
Athul el 24 de En. de 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.

Respuesta aceptada

Kenneth Eaton
Kenneth Eaton el 25 de En. de 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 comentarios
David Jenkins
David Jenkins el 13 de Feb. de 2011
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 el 14 de Feb. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Delaunay Triangulation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by