Skip to main content
GameDev.net gamedev.net
🔒 Locked

How to detect hollow openings/holes on a static mesh?

Started by lucky6969b Jan 24, 2017 at 2:06 PM 1 replies 3.4k views
Original Post
lucky6969b
lucky6969b

When I start thinking about it,
I would start with the sum of dot products around a loop is zero
when there are only 4 edges, each of them facing each other.
But this is too naive, because some openings may have more than 4 edges,
that form a hexagon for example.
How do I detect all hollow openings on my static mesh, like wells.
Thanks
Jack

JoeJ
JoeJ

Build a data structure where each edge points to it's two triangles and each vertex has a list of it's edges.

Build a list containing all edges with one triangle pointer empty (open edges) an a flag per edge.

1. Start a new hole by taking an unmarked edge from the list.

2. Add the edge to the hole and mark the edge. Pick one of its vertices and loop over all its edges: Find another open edge from it, this must be the next edge at the same hole. Continue (always using the other yet unvisited vertex) until you get back to the initial edge. The hole is done.

3. Continue with step 1 until all open edges has been marked and all holes are found.

It's really simple and fast but you need meshes without bugs (double edges or whatever).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.