Guest User

Untitled

a guest
Apr 23rd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. (* Number of data points *)
  2. numpts = 5;
  3. (* Test data set *)
  4. pts = {{0, 0}, {1, 0}, {0, 1}, {1, 1}, {0.3, 0.4}};
  5. dmesh = DelaunayMesh[pts];
  6. (* Extract the triangle list from the Delaunay triangulation *)
  7. tris = MeshCells[dmesh, 2];
  8. numtris = Length[tris];
  9. (* This demonstrates how to access the pts from the tris list *)
  10. Print["Number of triangles numtris = ", numtris];
  11. Do[
  12. Print["Tri ", i,
  13. " v1=", pts[[tris[[i, 1, 1]]]],
  14. " v2=", pts[[tris[[i, 1, 2]]]],
  15. " v3 = ", pts[[tris[[i, 1, 3]]]]],
  16. {i, 1, numtris}
  17. ];
  18. (* Data structure to hold neighbor data *)
  19. nghbrs = Table[{0, 0, 0}, {i, 1, numtris}];
Add Comment
Please, Sign In to add comment