# Determine Inner triangles given its Boundary triangle information

This topic is 2542 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have a mesh with triangle and vertex information. Now I need to extract a region (patch) of the mesh.
Using some algorithm I can find boundary triangles of the region.

Now How can I determine the inner triangles of the patch with boundary triangle information.

##### Share on other sites
Hi!

You need either one attribute that all triangles in the patch share or you need at least one vertex that is in the patch. On a closed mesh your boundary information divides your mesh into two patches (one inside, one outside). The question is: which one is the one you are looking for? You can resolve this ambiguity by specifying one vertex that is inside the patch (or perhaps find another measure like choosing the patch with the smaller area, but this won’t necessarily identify the correct patch…). If you have one vertex in the patch, you can do some sort of flood fill starting at that vertex until you hit the boundary. So, push all neighbors of that vertex on a stack (unless they are boundary vertices or have already been visited), then pop one vertex from the stack and start over again (pushing all its neighbors on the stack, etc) until your stack is empty. All vertices you visit are inside the patch. This will have a complexity linear in the number of vertices in the patch (in other words: pretty fast).

1. 1
2. 2
Rutin
21
3. 3
4. 4
A4L
15
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633737
• Total Posts
3013612
×