diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-23 21:43:41 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-01-23 21:43:41 +0400 |
commit | 690c77dd7de19783adb228be51b099ed19c22d5a (patch) | |
tree | 748a4b5b585552193c3e58d1a1123b25afca61fa /source/blender/modifiers/intern | |
parent | 74b4fd26d2d1dde537a46f9237839c057cd03aaf (diff) |
Fix #29934: New Carve library can't execute boolean operations in some cases
Issue was caused by left boolean operand consist of several intersecting manifolds
which make Carve triangulator confused and which can't be resolved in general case.
Added mesh pre-processing before actual applying boolean operator on it. This
preprocessing applies union operation on intersecting manifolds of the same object
so intersection edge loop with second object wouldn't confuse tesselator and correct
result would be returned.
Detecting of intersecting manifolds is based on AABB intersection check which leads
to some extra union operation called, but it's possible to speed things up from
Carve side so union operation of two not intersecting meshes would work faster.
Additional condition for running union for manifold is this manifolds intersects
AABB of second operand, so mesh topology wouldn't be changed at all in areas
where there's definitely no intersection between operands. It might be improved
so only manifolds which actually intersects second operand would be joined
together, but it'll slow things down a bit and prefer to do it only if it'll
be really a problem.
Additional change is fixed memory leak when boolean operation fails to run -
it was missed "delete" call if exception happens in Carve library.
From side effects of this change might be named boolean operation between
suzanne and another object: suzanne is consist of three intersecting open
manifolds, so this new meshes preprocessing leads to missed eyes in result
because of failure of merging two open manifolds. Don't think making suzanne
work for all setups should really be a goal, it's a bit crappy mesh for CSG
algorithms.
Diffstat (limited to 'source/blender/modifiers/intern')
-rw-r--r-- | source/blender/modifiers/intern/MOD_boolean_util.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c index afd16b41131..fa829bcd44b 100644 --- a/source/blender/modifiers/intern/MOD_boolean_util.c +++ b/source/blender/modifiers/intern/MOD_boolean_util.c @@ -522,7 +522,7 @@ static DerivedMesh *NewBooleanDerivedMesh_intern( CSG_FreeFaceDescriptor(&fd_o); } else - printf("Unknown internal error in boolean"); + printf("Unknown internal error in boolean\n"); CSG_FreeBooleanOperation(bool_op); |