From b5f08e60be669b1d5974ff1153855915e0d74593 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 14 Feb 2012 09:43:35 +0000 Subject: Carve: improved handling of meshes with interesting manifolds Unioning of intersecting manifold tried to perform as little union operations as possible, but there were some not totally correct assumption which lead to cases when unioning of manifolds of some mesh might be happened when one of mesh sets already had got intersecting manifolds. This commit corrects this incorrect behavior. Discovered this when was looking into #30175: Boolean Difference causes 2.62 RC1 crash. --- intern/boolop/intern/BOP_CarveInterface.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'intern/boolop') diff --git a/intern/boolop/intern/BOP_CarveInterface.cpp b/intern/boolop/intern/BOP_CarveInterface.cpp index 4f566edfe08..3e0daf83ef6 100644 --- a/intern/boolop/intern/BOP_CarveInterface.cpp +++ b/intern/boolop/intern/BOP_CarveInterface.cpp @@ -43,6 +43,9 @@ using namespace carve::mesh; using namespace carve::geom; typedef unsigned int uint; +static void Carve_unionIntersections(MeshSet<3> **left_r, MeshSet<3> **right_r, + carve::interpolate::FaceAttr &oface_num); + #define MAX(x,y) ((x)>(y)?(x):(y)) #define MIN(x,y) ((x)<(y)?(x):(y)) @@ -276,6 +279,10 @@ static MeshSet<3> *Carve_unionIntersectingMeshes(MeshSet<3> *poly, left = right; } else { + /* there might be intersections between manifolds of one operand and another mesh which isn't + * taking into accound in Carve_getIntersectedOperand because of optimization purposes */ + Carve_unionIntersections(&left, &right, oface_num); + MeshSet<3> *result = csg.compute(left, right, carve::csg::CSG::UNION, NULL, carve::csg::CSG::CLASSIFY_EDGE); delete left; -- cgit v1.2.3