Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (* Number of data points *)
- numpts = 5;
- (* Test data set *)
- pts = {{0, 0}, {1, 0}, {0, 1}, {1, 1}, {0.3, 0.4}};
- dmesh = DelaunayMesh[pts];
- (* Extract the triangle list from the Delaunay triangulation *)
- tris = MeshCells[dmesh, 2];
- numtris = Length[tris];
- (* This demonstrates how to access the pts from the tris list *)
- Print["Number of triangles numtris = ", numtris];
- Do[
- Print["Tri ", i,
- " v1=", pts[[tris[[i, 1, 1]]]],
- " v2=", pts[[tris[[i, 1, 2]]]],
- " v3 = ", pts[[tris[[i, 1, 3]]]]],
- {i, 1, numtris}
- ];
- (* Data structure to hold neighbor data *)
- nghbrs = Table[{0, 0, 0}, {i, 1, numtris}];
Add Comment
Please, Sign In to add comment