[Bf-blender-cvs] [62dc64bdee1] newboolean: Better estimate of number of output faces.
Howard Trickey
noreply at git.blender.org
Mon Jul 20 11:29:38 CEST 2020
Commit: 62dc64bdee17bd6946707ba418b47f41bbfec794
Author: Howard Trickey
Date: Sun Jul 19 16:00:48 2020 -0400
Branches: newboolean
https://developer.blender.org/rB62dc64bdee17bd6946707ba418b47f41bbfec794
Better estimate of number of output faces.
Avoids need to resize some arena vectors in many cases.
===================================================================
M source/blender/bmesh/tools/bmesh_boolean.cc
===================================================================
diff --git a/source/blender/bmesh/tools/bmesh_boolean.cc b/source/blender/bmesh/tools/bmesh_boolean.cc
index 64dc20ef99e..655afc00f75 100644
--- a/source/blender/bmesh/tools/bmesh_boolean.cc
+++ b/source/blender/bmesh/tools/bmesh_boolean.cc
@@ -41,8 +41,9 @@ static Mesh mesh_from_bm(BMesh *bm,
BLI_assert(r_triangulated != nullptr);
BM_mesh_elem_index_ensure(bm, BM_VERT | BM_EDGE | BM_FACE);
BM_mesh_elem_table_ensure(bm, BM_VERT | BM_EDGE | BM_FACE);
+ /* Account for triangulation and intersects. */
const int estimate_num_outv = (3 * bm->totvert) / 2;
- const int estimate_num_outf = (3 * bm->totface) / 2;
+ const int estimate_num_outf = 4 * bm->totface;
arena->reserve(estimate_num_outv, estimate_num_outf);
Array<Vertp> vert(bm->totvert);
for (int v = 0; v < bm->totvert; ++v) {
More information about the Bf-blender-cvs
mailing list