Hello @ymoon,

Thank you for reaching out to us. Your question is unfortunately out of scope of support due to being a general algorithmic question. I have moved your posting into *General Talk* due to that.

The question you are asking is much less trivial than you seem to realize. First of all, you cannot determine with a polygon and its direct neighbors alone if an edge *e* is an outside or inside edge. Just pick one of your inside edges in the picture and imagine all other edges except its direct neighbors being gone; the information that *e* is an inside edge is lost.

Computing if a point *p* lies inside a Polygon *P* is trivial when we talk about polygons in the mathematical sense, i.e., a list of points in a plane with an order. Common algorithms are then computing the crossing or winding number. Your mesh happens to be perfectly coplanar, so it would work there too with some extra steps, as you would have first to construct the polygons from the border edge loops.

For everything else, i.e., 99.9% of all meshes, this will get hairy. You can project the border edge loops into their mean plane, but that can yield incorrect results when then computing the winding number. You can also do things like compute convex hulls or start summing up vertex normals of such edge loop to see if they point on average towards the mean point of that edge loop, but that all gets finicky quite fast.

This is not a trivial problem.

Cheers,

Ferdinand