TriangleGetNeighbors[expr]
gets the neighbors in a Triangle expression.
Details and Options
Examples
Basic Examples
See Also
Tech Notes
Related Guides
TriangleLink`
TriangleLink`
TriangleGetNeighbors
TriangleGetNeighbors[expr]
gets the neighbors in a Triangle expression.
Details and Options
- To use TriangleGetNeigbors, you first need to load it using Needs["TriangleLink`"].
- TriangleGetNeigbors returns a list of a list of integers that specify which tetrahedra are next to each other. An entry of
indicates that the respective triangle is on the boundary. - TriangleGetNeigbors needs the "n" switch to be set during the call to TriangleTriangulate.
Examples
Basic Examples (1)
Needs["TriangleLink`"]This creates an instance of a Triangle expression:
inst = TriangleCreate[]This sets up points and segments to use:
pts = {{0., 0.}, {2., 0.}, {2., 2.}, {0., 2.}};
segments = {{1, 2}, {2, 3}, {3, 4}, {4, 1}};This sets the points and facets in the Triangle instance:
TriangleSetPoints[inst, pts];
TriangleSetSegments[inst, segments];This carries out the triangulation, returning a new Triangle instance. The switch "n" requests Triangle to compute the neighbors:
outInst = TriangleTriangulate[ inst, "pqa0.5n"]This extracts the points and elements from the triangulation:
coords = TriangleGetPoints[outInst];
meshElements = TriangleGetElements[outInst];This is a list of the neighboring elements, with
indicating a boundary:
TriangleGetNeighbors[outInst]You can visualize the triangles:
Graphics[ {EdgeForm[LightDarkSwitched[Black, White]], FaceForm[], GraphicsComplex[coords, Polygon[meshElements]]}]