Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Hughes <khughes@pacific.edu>2006-06-10 19:47:19 +0400
committerKen Hughes <khughes@pacific.edu>2006-06-10 19:47:19 +0400
commit7fcc5800aef8f6355730ef27eb70f49f0480a42a (patch)
tree72ad0a31363a69c19e6182f2ec8852f9d12c9546 /intern/boolop
parent3d47bb56fa17304d78b937b0d89dbaf93b9e947c (diff)
===Tools===
Adding back some code to booleans that got lost in the Orange merge. I've also added back the code which checked that meshes were solid ("manifolds") but have the actual check in intern/boolop/intern/BOP_Interface.cpp, since from my testing it was not causing crashes or hangs. It *can* give odd results depending on what you're trying to intersect, but seems useful. Additionally, since existing bugs in the current code can create non-solid/non-manifold meshes, seems hypocritical to create a mesh that can't later be used in another boolean operation.
Diffstat (limited to 'intern/boolop')
-rw-r--r--intern/boolop/intern/BOP_Interface.cpp6
-rw-r--r--intern/boolop/intern/BOP_Mesh.cpp17
-rw-r--r--intern/boolop/intern/BOP_Mesh.h3
3 files changed, 25 insertions, 1 deletions
diff --git a/intern/boolop/intern/BOP_Interface.cpp b/intern/boolop/intern/BOP_Interface.cpp
index 02945340d55..518ea69982c 100644
--- a/intern/boolop/intern/BOP_Interface.cpp
+++ b/intern/boolop/intern/BOP_Interface.cpp
@@ -121,6 +121,12 @@ BoolOpState BOP_performBooleanOperation(BoolOpType opType,
// Add B-mesh into C-mesh
BOP_addMesh(&meshC, &meshBFacesId, &materials, obBProps, obBFaces, obBVertices, invertMeshB);
+ // for now, allow operations on non-manifold (non-solid) meshes
+#if 0
+ if (!meshC.isClosedMesh())
+ return BOP_NO_SOLID;
+#endif
+
// Perform the intersection boolean operation.
BoolOpState result = BOP_intersectionBoolOp(&meshC, &meshAFacesId, &meshBFacesId,
invertMeshA, invertMeshB);
diff --git a/intern/boolop/intern/BOP_Mesh.cpp b/intern/boolop/intern/BOP_Mesh.cpp
index 595ccae6b93..6afd1caabaf 100644
--- a/intern/boolop/intern/BOP_Mesh.cpp
+++ b/intern/boolop/intern/BOP_Mesh.cpp
@@ -555,6 +555,23 @@ BOP_Index BOP_Mesh::replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex)
return newIndex;
}
+bool BOP_Mesh::isClosedMesh()
+{
+ for(unsigned int i=0; i<m_edges.size(); i++) {
+ BOP_Edge *edge = m_edges[i];
+ BOP_Indexs faces = edge->getFaces();
+ unsigned int count = 0;
+ const BOP_IT_Indexs facesEnd = faces.end();
+ for(BOP_IT_Indexs it = faces.begin();it!=facesEnd;it++) {
+ if (m_faces[*it]->getTAG()!=BROKEN)
+ count++;
+ }
+
+ if ((count%2)!=0) return false;
+ }
+
+ return true;
+}
/** ***************************************************************************
diff --git a/intern/boolop/intern/BOP_Mesh.h b/intern/boolop/intern/BOP_Mesh.h
index 644f9ab691c..d4403facde7 100644
--- a/intern/boolop/intern/BOP_Mesh.h
+++ b/intern/boolop/intern/BOP_Mesh.h
@@ -83,7 +83,8 @@ public:
unsigned int getNumVertexs(BOP_TAG tag);
unsigned int getNumFaces(BOP_TAG tag);
BOP_Index replaceVertexIndex(BOP_Index oldIndex, BOP_Index newIndex);
-
+ bool BOP_Mesh::isClosedMesh();
+
// Debug functions
void print();
void printFormat();