diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2021-06-27 00:49:52 +0300 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2021-06-27 00:49:52 +0300 |
commit | 7223a0348f53df7e19677f05aaef89852c0f0187 (patch) | |
tree | 907a2d1ebe02411d269964779760b6ab2d6a9a6c /source/blender/blenlib/intern/mesh_intersect.cc | |
parent | abc62003314af2b39136bf43031590d4fbfb72df (diff) |
Fix T89330 Exact Boolean fails on a simple model.
The problem was an optimization I put in to triangulate quads.
It was wrong if the quad, after projecting onto a 2d plane, was
not convex. Handling quads the same as other faces fixes the bug.
Unfortunately, this will slow down Exact Boolean when the input has
many quads (the usual case, of course).
Will attempt to fix that with a later change, but for now, this
at least restores correctness.
Diffstat (limited to 'source/blender/blenlib/intern/mesh_intersect.cc')
-rw-r--r-- | source/blender/blenlib/intern/mesh_intersect.cc | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index 32f0216951a..a9c725d4adf 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -1998,6 +1998,10 @@ static Array<Face *> polyfill_triangulate_poly(Face *f, IMeshArena *arena) * If this happens, we use the polyfill triangulator instead. We don't * use the polyfill triangulator by default because it can create degenerate * triangles (which we can handle but they'll create non-manifold meshes). + * + * While it is tempting to handle quadrilaterals specially, since that + * is by far the usual case, we need to know if the quad is convex when + * projected before doing so, and that takes a fair amount of computation by itself. */ static Array<Face *> triangulate_poly(Face *f, IMeshArena *arena) { @@ -2099,20 +2103,6 @@ IMesh triangulate_polymesh(IMesh &imesh, IMeshArena *arena) if (flen == 3) { face_tris.append(f); } - else if (flen == 4) { - const Vert *v0 = (*f)[0]; - const Vert *v1 = (*f)[1]; - const Vert *v2 = (*f)[2]; - const Vert *v3 = (*f)[3]; - int eo_01 = f->edge_orig[0]; - int eo_12 = f->edge_orig[1]; - int eo_23 = f->edge_orig[2]; - int eo_30 = f->edge_orig[3]; - Face *f0 = arena->add_face({v0, v1, v2}, f->orig, {eo_01, eo_12, -1}, {false, false, false}); - Face *f1 = arena->add_face({v0, v2, v3}, f->orig, {-1, eo_23, eo_30}, {false, false, false}); - face_tris.append(f0); - face_tris.append(f1); - } else { Array<Face *> tris = triangulate_poly(f, arena); for (Face *tri : tris) { |