Advertisement

Checking a Closed Polyhedra!

Started by October 10, 2001 08:46 AM
11 comments, last by Jankey 23 years, 3 months ago
If i have a 3D Object And i want to know how i can check this object if it is "closed"? Does anyone hava an Idea how this could work?
J.A.N.K.E.Y.: Journeying Artificial Nocturnal Killing and Exploration Youth
There was another thread recently talking about this. One quick way to do this is to check and see if every triangle edge is shared by exactly two (no more, no less) triangles. This works as long as you have no "T" intersections in your mesh.

If any edge is shared by only one triangle, then you have an open edge. If any edge is shared by more than two triangles, then you have a "non-manifold" surface which complicates the question. (Simple closed surfaces are "manifold.")

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Advertisement
Could it work if i check if every Polygon has an neightbour Polygon! If one side of a triangle doens not have a neightbour Triangle Side ... then "return false;"

does this idea work?

J@nkey
J.A.N.K.E.Y.: Journeying Artificial Nocturnal Killing and Exploration Youth
quote:
Original post by Jankey
Could it work if i check if every Polygon has an neightbour Polygon! If one side of a triangle doens not have a neightbour Triangle Side ... then "return false;"



That''s another way of describing the same thing. A "neighbor" triangle must share an edge with the "current" triangle, making Graham''s test as complete as you''ll need.
I believe that's pretty much what grhodes_at_work told you to do.

Let's just pretend you're dealing with a manifold surface. If you don't know what that means, basically, it means that for some "closed" polyhedron, every edge has EXACTLY two faces sharing it (or, every vertex has a ring of polygons around it -- it is homoemorphic to a disk). A manifold with BOUNDARY means you have can have an edge that has only one face attached to it. Basically, the surface is then "open". So, the method you suggested will probably work if it is a manifold (or manifold with boundary).

If it's not a manifold, then it gets really tricky, and I'm not going to get into it. Just search for "non-manifold." I'm sure you'll find some stuff, but you're not going to like it.

Edited by - davidko on October 11, 2001 3:35:40 AM
quote:
Original post by davidko
If it''s not a manifold, then it gets really tricky, and I''m not going to get into it. Just search for "non-manifold." I''m sure you''ll find some stuff, but you''re not going to like it.


Well put. I''ll give a concrete example of how bad you''re not going to like non-manifold. Spatial Technology (www.spatial.com) spent something like US$15 million investment developing the initial version of their ACIS geometry engine back in the early 90''s. That $15 million software did NOT work on non-manifold geometry, . (Although folks such as Solid Modeling Solutions, www.smlib.com, and XOX, www.xox.com, have developed VERY nice non-manifold geometry engines since then.)

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Advertisement
You may want to read some related discussions in the thread "Tetrahedralization and a major bummer" started by member "no way". The method I mentioned for checking a closed polyhedra was mentioned there also.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
one neat trick i found from the document that i dug out -> when building a list of edges, its very easy to verify whether vertex order of each face is consistent, and flip them if necessary.
The idea is, in such a mesh where every edge belongs to exactly two triangles, the edge directions defined by those two triangles must be opposite.

lets say we have triangles t1 and t2 sharing one edge. now if for t1 this common edge is for example t1.b->t1.c then for t2 it can be either t2.c->t2.b, t2.b->t2.a or t2.a->t2.c, but NOT t2.a->t2.b

makes sense ?
It took a while ... but it works

_________________________________________________________________
bool commonIndex( int index , int tri[])
{

if (index == tri[0] ||
index == tri[1] ||
index == tri[2] )
return true;

return false;
}

bool CheckClosedPolygon( Object &object )
{

int i = 0; // Auserste For Schleife!!
int j = 0; // Innere For Schleife

int side = 0;
int point = 0;
int tri[3]; // Normales DreiEck

for( i = 0 ; i < object.nfaces ; i ++ )
{
tri[0] = object.pfaces.vertexIndex[0];
tri[1] = object.pfaces.vertexIndex[1];<br> tri[2] = object.pfaces.vertexIndex[2];<br> <br> for( j = 0 ; j < object.nfaces ; j ++ )<br> {<br> if (i == j)<br> continue;<br><br> // Mal schaun ob überhaupt ein Punkt an dem ganzen 3-Eck anliegt<br> if ( commonIndex( tri[0] , object.pfaces[j].vertexIndex) ||<br> commonIndex( tri[1] , object.pfaces[j].vertexIndex) ||<br> commonIndex( tri[2] , object.pfaces[j].vertexIndex) ) {<br> <br> if ( commonIndex( tri[0] , object.pfaces[j].vertexIndex ))<br> point++;<br> <br> if ( commonIndex( tri[1] , object.pfaces[j].vertexIndex ))<br> point++;<br><br> if ( commonIndex( tri[2] , object.pfaces[j].vertexIndex ))<br> point++;<br><br> if ( point == 2 )<br> side++;<br><br> point = 0; <br><br> }<br> <br> }<br>if (side != 3)<br>return false;<br><br>side = 0;<br><br>}<br><br><br>return true;<br><br>}<br><br>_________________________________________________________________ </i>
J.A.N.K.E.Y.: Journeying Artificial Nocturnal Killing and Exploration Youth
Cool!

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement