Tools:
------ Bugfix #6847: Previous fix for "spikes" when using booleans caused creation of faces with only two unique vertices ("eekadoodles"). This patch cleans up the test for triangles with near-colinear vertices so PHANTOM faces can be used again, and also adds a hack for now which removes any eekadoodle faces. I haven't figured out yet exactly how the faces are being created; if I can do so and fix it the hack will be removed.
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
/**
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -23,7 +26,7 @@
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
* Contributor(s): Marc Freixas, Ken Hughes
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
@@ -427,17 +430,11 @@ void BOP_mergeVertexs(BOP_Mesh *mesh, unsigned int firstFace)
|
||||
// v2 ~= v3
|
||||
mesh->replaceVertexIndex(v2,v3);
|
||||
} else {
|
||||
#if 0
|
||||
/*
|
||||
* for now, don't just remove "co-linear" faces; some of these faces
|
||||
* being removed are real and cause other things to break
|
||||
*/
|
||||
// all differents
|
||||
if (BOP_collinear(vertex1,vertex2,vertex3)) {
|
||||
// collinear triangle
|
||||
face->setTAG(PHANTOM);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/**
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -23,7 +26,7 @@
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
* Contributor(s): Marc Freixas, Ken Hughes
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
@@ -115,7 +118,12 @@ bool BOP_collinear(const MT_Point3& p1, const MT_Point3& p2, const MT_Point3& p3
|
||||
{
|
||||
MT_Vector3 v1 = p2 - p1;
|
||||
MT_Vector3 v2 = p3 - p2;
|
||||
|
||||
|
||||
/* normalize vectors before taking their cross product, so its length
|
||||
* has some actual meaning */
|
||||
v1.normalize();
|
||||
v2.normalize();
|
||||
|
||||
MT_Vector3 w = v1.cross(v2);
|
||||
|
||||
return (BOP_comp(w.x(),0.0) == 0) && (BOP_comp(w.y(),0.0) == 0) && (BOP_comp(w.z(),0.0) == 0);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
/**
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -23,7 +26,7 @@
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
* Contributor(s): Marc Freixas, Ken Hughes
|
||||
*
|
||||
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
||||
*/
|
||||
@@ -57,6 +60,32 @@ void BOP_Merge::mergeFaces(BOP_Mesh *m, BOP_Index v)
|
||||
// Merge faces
|
||||
mergeFaces();
|
||||
|
||||
/*
|
||||
* HACK: somehow triangular faces are being created with two vertices the
|
||||
* same. If it's happening in BOP_Mesh::replaceVertexIndex() we should
|
||||
* be catching it, so either it's not happening there or we aren't
|
||||
* catching it (duh). Until we figure this out, this hack cleans things.
|
||||
*
|
||||
* Test for any invalid faces: if any two vertices are the same of a
|
||||
* triangle, the face is broken. Further, I don't believe it's possible
|
||||
* to have any quads at this point, so if we find one send a message
|
||||
* to stdout.
|
||||
*/
|
||||
|
||||
BOP_Faces faces = m_mesh->getFaces();
|
||||
const BOP_IT_Faces ifacesIEnd = (faces.end());
|
||||
for(BOP_IT_Faces faceI=faces.begin();faceI!=ifacesIEnd;faceI++) {
|
||||
if ((*faceI)->getTAG() != BROKEN ) {
|
||||
BOP_Index i1 = (*faceI)->getVertex(0);
|
||||
BOP_Index i2 = (*faceI)->getVertex(1);
|
||||
BOP_Index i3 = (*faceI)->getVertex(2);
|
||||
if ( (*faceI)->size() == 4)
|
||||
cout << "BOP_Merge::mergeFaces found a quad: this is an error" << endl;
|
||||
if (i1 == i2 || i2 == i3 || i3 == i1 )
|
||||
(*faceI)->setTAG(BROKEN);
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
// Add quads ...
|
||||
cont = createQuads();
|
||||
@@ -592,6 +621,7 @@ bool BOP_Merge::createQuads()
|
||||
|
||||
// Get mesh faces
|
||||
BOP_Faces faces = m_mesh->getFaces();
|
||||
|
||||
|
||||
// Merge mesh triangles
|
||||
const BOP_IT_Faces facesIEnd = (faces.end()-1);
|
||||
|
||||
Reference in New Issue
Block a user