   Determining whether a triangle is interior or exterior
  Suppose, we have a triangluated mesh, how will you determine, whether a given  triangle is exterior or interior one. Generally speaking,  An interior triangle, will have all the vertices shared by the vertices of neigbouring triangles and in the case of exterior triangles, not all vertices have neighbour. 
Quote:Original post by serious_learner07Suppose, we have a triangluated mesh, how will you determine, whether a given  triangle is exterior or interior one. Generally speaking,  An interior triangle, will have all the vertices shared by the vertices of neigbouring triangles and in the case of exterior triangles, not all vertices have neighbour.How about exploiting the thing you mention? Does it have to be real-time?   ;  Do you mean shared edges, not vertices?In that case the only way I know of is to look. Create 3 edges for all triangles and count all their "duplicates". All edges with no duplicates are exterior.A duplicate edge would be an edge using the same vertices as the one you're examining.Kind of like this:if((e0.p0 == e1.p1) && (e0.p1 == e1.p0))If winding order doesn't matter, you've got to check both directionsif(((e0.p0 == e1.p1) && (e0.p1 == e1.p0)) || ((e0.p0 == e1.p0) && (e0.p1 == e1.p1)))-Morten-   ;  Thanks morten for your suggestion. But the approach is brute force one.Suppose the mesh  has 200k,triangles, then searching for duplication, will kill the performance.Are there any optimization possible within this search, so that I can get good performance. Can, Spatial data structures such as quadtree,octree, be of any use?   ;Quote:Original post by serious_learner07Thanks morten for your suggestion. But the approach is brute force one.Suppose the mesh  has 200k,triangles, then searching for duplication, will kill the performance.Are there any optimization possible within this search, so that I can get good performance. Can, Spatial data structures such as quadtree,octree, be of any use?Why does it have to be realtime?Cannot you mark the triangles somehow at initialization? And/or simply detach the interior triangles to a separate mesh.   ;  So assuming you have an indexed mesh, which is recommended anyways, you can calculate neighbourship information (handy if you want to use geometry shaders). Just use the pair of the two vertex indices of an edge as key into a hash table and store as value the triangle that owns this edge. When you encounter a second triangle with that edge (look up in the hash table beforehand), you know the two triangles sharing this edge. This should be done once in a preprocessing step. If you delete the entry in the hash table when the second triangle was found, what remains when all triangles are done are the edges of the outer triangles.;Yeah I have similar requirement. My mesh is a not just triangles. Rather it is tetrahedral (i.e tetrahedrons inside the mesh).  I need to extract the surface triangles. But in this case, instead of edges, I need to check whether triangles of tetrahedrons are duplicated. It is not straightforward to do. I am not able to  visualize properly.So I am not getting logic correct. Can anyone suggest a method or some logic.