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.
This commit is contained in:
Sergey Sharybin 2012-02-14 09:43:35 +00:00
parent 6905d0d92b
commit b5f08e60be

@ -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<uint> &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;