I haven’t been posting on the development board for a while primarily because most of the ruby code I’ve been writing is tedious boring stuff.
However I’ve now have a (somewhat) interesting problem I’m working on. My goal is to generate a bunch of faces like what is shown below (wall outlines) all within the same group:
Where the walls are adjacent I will end up with internal edges that can be deleted. In fact, I want to delete all those internal edges so I just end up a single loop.
My question is does anyone have any idea for an algorithm that can detect if an edge is “internal”?
My first guess would be to examine each edge, get its two vertices and then for each vertex look at the number of edges that are connected to it. If the number of edges connected to the vertex is greater than two then the associated edge is internal.
Perhaps there is a better more efficient and more robust algorithm than what I have described?
P.S. I should add that there will the possibility that there will be internal loops within the outer loop, when the walls form a closed structure (not shown above).