===Tools===

Bug "fix" for #3932, and possibly for #3799.  Booleans can get into an endless loop (at least until memory runs out); through triangulation somehow a face is repeatedly added to the list of faces to triangulate.  This patch checks the face list for duplicates prior to a list add and aborts if a dup is found.

The real issue is why the triangulation is creating the face in the first place, but that will take a more thorough (and longer) examination of the code.  If I can fix that issue that prior to the 2.42 release, then this code can be removed.
This commit is contained in:
Ken Hughes 2006-06-06 17:43:57 +00:00
parent 721de110b2
commit b8c6c1fdf0

@ -393,6 +393,32 @@ void BOP_triangulateF(BOP_Mesh* mesh, BOP_Faces* faces, BOP_Face* face,
*/
void BOP_addFace(BOP_Mesh* mesh, BOP_Faces* faces, BOP_Face* face, BOP_TAG tag)
{
BOP_Index av1 = face->getVertex(0);
BOP_Index av2 = face->getVertex(1);
BOP_Index av3 = face->getVertex(2);
/*
* Before adding a new face to the face list, be sure it's not
* already there. Duplicate faces have been found to cause at
* least two instances of infinite loops.
* When someone has more time to look into this issue, it's possible
* this code may be removed again.
*/
for(unsigned int idxFace=0;idxFace<faces->size();idxFace++) {
BOP_Face *faceA = (*faces)[idxFace];
BOP_Index bv1 = faceA->getVertex(0);
BOP_Index bv2 = faceA->getVertex(1);
BOP_Index bv3 = faceA->getVertex(2);
if( ( av1==bv1 && av2==bv2 && av3==bv3 ) ||
( av1==bv1 && av2==bv3 && av3==bv2 ) ||
( av1==bv2 && av2==bv1 && av3==bv3 ) ||
( av1==bv2 && av2==bv3 && av3==bv1 ) ||
( av1==bv3 && av2==bv2 && av3==bv1 ) ||
( av1==bv3 && av2==bv1 && av3==bv3 ) )
return;
}
face->setTAG(tag);
faces->push_back(face);
mesh->addFace(face);