diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-06-06 21:43:57 +0400 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-06-06 21:43:57 +0400 |
commit | b8c6c1fdf0cf466354b3b7a92380b06307c991e8 (patch) | |
tree | 5721984a37d71b780741f869a5f7af06789ad38f /intern | |
parent | 721de110b260dc2a41881d49a18751139c5a1469 (diff) |
===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.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/boolop/intern/BOP_Triangulator.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/intern/boolop/intern/BOP_Triangulator.cpp b/intern/boolop/intern/BOP_Triangulator.cpp index fa604d44f2d..0ac637ee28d 100644 --- a/intern/boolop/intern/BOP_Triangulator.cpp +++ b/intern/boolop/intern/BOP_Triangulator.cpp @@ -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); |