Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * ***** BEGIN GPL LICENSE BLOCK ***** | 2 * ***** BEGIN GPL LICENSE BLOCK ***** |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or | 4 * This program is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU General Public License | 5 * modify it under the terms of the GNU General Public License |
6 * as published by the Free Software Foundation; either version 2 | 6 * as published by the Free Software Foundation; either version 2 |
7 * of the License, or (at your option) any later version. | 7 * of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 /*************************** Boundary Edges ***************************/ | 69 /*************************** Boundary Edges ***************************/ |
70 | 70 |
71 static int edge_match(BMVert *e1_0, BMVert *e1_1, BMVert *e2[2]) | 71 static int edge_match(BMVert *e1_0, BMVert *e1_1, BMVert *e2[2]) |
72 { | 72 { |
73 return (e1_0 == e2[0] && e1_1 == e2[1]) || | 73 return (e1_0 == e2[0] && e1_1 == e2[1]) || |
74 (e1_0 == e2[1] && e1_1 == e2[0]); | 74 (e1_0 == e2[1] && e1_1 == e2[0]); |
75 } | 75 } |
76 | 76 |
77 /* Returns true if the edge (e1, e2) is already in edges; that edge is | 77 /* Returns true if the edge (e1, e2) is already in edges; that edge is |
78 deleted here as well. if not found just returns 0 */ | 78 deleted here as well. if not found just returns 0 */ |
79 static int check_for_dup(ListBase *edges, BMVert *e1, BMVert *e2) | 79 static int check_for_dup(ListBase *edges, BLI_mempool *pool, |
80 » » » » » » BMVert *e1, BMVert *e2) | |
80 { | 81 { |
81 HullBoundaryEdge *e, *next; | 82 HullBoundaryEdge *e, *next; |
82 | 83 |
83 for (e = edges->first; e; e = next) { | 84 for (e = edges->first; e; e = next) { |
84 next = e->next; | 85 next = e->next; |
85 | 86 |
86 if (edge_match(e1, e2, e->v)) { | 87 if (edge_match(e1, e2, e->v)) { |
87 /* remove the interior edge */ | 88 /* remove the interior edge */ |
88 » » » BLI_freelinkN(edges, e); | 89 » » » BLI_remlink(edges, e); |
90 » » » BLI_mempool_free(pool, e); | |
89 return 1; | 91 return 1; |
90 } | 92 } |
91 } | 93 } |
92 | 94 |
93 return 0; | 95 return 0; |
94 } | 96 } |
95 | 97 |
96 static void expand_boundary_edges(ListBase *edges, const HullTriangle *t) | 98 static void expand_boundary_edges(ListBase *edges, BLI_mempool *edge_pool, |
99 » » » » » » » » const HullTria ngle *t) | |
97 { | 100 { |
98 HullBoundaryEdge *new; | 101 HullBoundaryEdge *new; |
99 int i; | 102 int i; |
100 | 103 |
101 /* Insert each triangle edge into the boundary list; if any of | 104 /* Insert each triangle edge into the boundary list; if any of |
102 its edges are already in there, remove the edge entirely */ | 105 its edges are already in there, remove the edge entirely */ |
103 for (i = 0; i < 3; i++) { | 106 for (i = 0; i < 3; i++) { |
104 » » if (!check_for_dup(edges, t->v[i], t->v[(i + 1) % 3])) { | 107 » » if (!check_for_dup(edges, edge_pool, t->v[i], t->v[(i + 1) % 3]) ) { |
105 » » » new = MEM_callocN(sizeof(HullBoundaryEdge), "HullBoundar yEdge"); | 108 » » » new = BLI_mempool_calloc(edge_pool); |
ideasman42
2012/04/28 10:59:34
another use for mempool? didnt check how often thi
| |
106 new->v[0] = t->v[i]; | 109 new->v[0] = t->v[i]; |
107 new->v[1] = t->v[(i + 1) % 3]; | 110 new->v[1] = t->v[(i + 1) % 3]; |
108 BLI_addtail(edges, new); | 111 BLI_addtail(edges, new); |
109 } | 112 } |
110 } | 113 } |
111 } | 114 } |
112 | 115 |
113 | 116 |
114 | 117 |
115 /*************************** Hull Triangles ***************************/ | 118 /*************************** Hull Triangles ***************************/ |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 } | 174 } |
172 | 175 |
173 return FALSE; | 176 return FALSE; |
174 } | 177 } |
175 | 178 |
176 | 179 |
177 /* For vertex 'v', find which triangles must be deleted to extend the | 180 /* For vertex 'v', find which triangles must be deleted to extend the |
178 hull; find the boundary edges of that hole so that it can be filled | 181 hull; find the boundary edges of that hole so that it can be filled |
179 with connections to the new vertex, and update the hull_triangles | 182 with connections to the new vertex, and update the hull_triangles |
180 to delete the marked triangles */ | 183 to delete the marked triangles */ |
181 static void add_point(GHash *hull_triangles, BLI_mempool *pool, | 184 static void add_point(GHash *hull_triangles, BLI_mempool *hull_pool, |
182 » » » » » GHash *outside, BMVert *v) | 185 » » » » » BLI_mempool *edge_pool, GHash *outside , BMVert *v) |
183 { | 186 { |
184 ListBase edges = {NULL, NULL}; | 187 ListBase edges = {NULL, NULL}; |
185 » HullBoundaryEdge *e; | 188 » HullBoundaryEdge *e, *next; |
186 GHashIterator iter; | 189 GHashIterator iter; |
187 | 190 |
188 GHASH_ITER (iter, outside) { | 191 GHASH_ITER (iter, outside) { |
189 HullTriangle *t = BLI_ghashIterator_getKey(&iter); | 192 HullTriangle *t = BLI_ghashIterator_getKey(&iter); |
190 » » expand_boundary_edges(&edges, t); | 193 » » expand_boundary_edges(&edges, edge_pool, t); |
191 ················ | 194 ················ |
192 /* Delete the triangle */ | 195 /* Delete the triangle */ |
193 BLI_ghash_remove(hull_triangles, t, NULL, NULL); | 196 BLI_ghash_remove(hull_triangles, t, NULL, NULL); |
194 » » BLI_mempool_free(pool, t); | 197 » » BLI_mempool_free(hull_pool, t); |
195 } | 198 } |
196 | 199 |
197 /* Fill hole boundary with triangles to new point */ | 200 /* Fill hole boundary with triangles to new point */ |
198 » for (e = edges.first; e; e = e->next) | 201 » for (e = edges.first; e; e = next) { |
199 » » hull_add_triangle(hull_triangles, pool, e->v[0], e->v[1], v); | 202 » » next = e->next; |
200 » BLI_freelistN(&edges); | 203 » » hull_add_triangle(hull_triangles, hull_pool, e->v[0], e->v[1], v ); |
204 » » BLI_mempool_free(edge_pool, e); | |
205 » } | |
201 } | 206 } |
202 | 207 |
203 static BMFace *hull_find_example_face(BMesh *bm, BMEdge *e) | 208 static BMFace *hull_find_example_face(BMesh *bm, BMEdge *e) |
204 { | 209 { |
205 BMIter iter; | 210 BMIter iter; |
206 BMFace *f; | 211 BMFace *f; |
207 | 212 |
208 BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { | 213 BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) { |
209 if (BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT) || | 214 if (BMO_elem_flag_test(bm, f, HULL_FLAG_INPUT) || |
210 !BMO_elem_flag_test(bm, f, HULL_FLAG_OUTPUT_GEOM)) | 215 !BMO_elem_flag_test(bm, f, HULL_FLAG_OUTPUT_GEOM)) |
(...skipping 19 matching lines...) Expand all Loading... | |
230 BMFace *f, *example = NULL; | 235 BMFace *f, *example = NULL; |
231 int i; | 236 int i; |
232 | 237 |
233 /* Look for an adjacent face that existed before the hul l */ | 238 /* Look for an adjacent face that existed before the hul l */ |
234 for (i = 0; i < 3; i++) { | 239 for (i = 0; i < 3; i++) { |
235 if (!example) | 240 if (!example) |
236 example = hull_find_example_face(bm, edg es[i]); | 241 example = hull_find_example_face(bm, edg es[i]); |
237 } | 242 } |
238 | 243 |
239 f = BM_face_create_quad_tri_v(bm, t->v, 3, example, FALS E); | 244 f = BM_face_create_quad_tri_v(bm, t->v, 3, example, FALS E); |
245 BM_face_copy_shared(bm, f); | |
240 | 246 |
241 /* Mark face/verts/edges for 'geomout' slot and select * / | 247 /* Mark face/verts/edges for 'geomout' slot and select * / |
242 BMO_elem_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM); | 248 BMO_elem_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM); |
243 BM_face_select_set(bm, f, TRUE); | 249 BM_face_select_set(bm, f, TRUE); |
244 for (i = 0; i < 3; i++) { | 250 for (i = 0; i < 3; i++) { |
245 BMO_elem_flag_enable(bm, t->v[i], HULL_FLAG_OUTP UT_GEOM); | 251 BMO_elem_flag_enable(bm, t->v[i], HULL_FLAG_OUTP UT_GEOM); |
246 BMO_elem_flag_enable(bm, edges[i], HULL_FLAG_OUT PUT_GEOM); | 252 BMO_elem_flag_enable(bm, edges[i], HULL_FLAG_OUT PUT_GEOM); |
247 } | 253 } |
248 } | 254 } |
249 } | 255 } |
(...skipping 18 matching lines...) Expand all Loading... | |
268 } | 274 } |
269 | 275 |
270 return NULL; | 276 return NULL; |
271 } | 277 } |
272 | 278 |
273 static int hull_final_edges_lookup(HullFinalEdges *final_edges, | 279 static int hull_final_edges_lookup(HullFinalEdges *final_edges, |
274 BMVert *v1, B MVert *v2) | 280 BMVert *v1, B MVert *v2) |
275 { | 281 { |
276 ListBase *adj; | 282 ListBase *adj; |
277 | 283 |
284 /* Use lower vertex pointer for hash key */ | |
278 if (v1 > v2) | 285 if (v1 > v2) |
ideasman42
2012/04/28 10:59:34
expect you intend this - but could add comment...
| |
279 SWAP(BMVert*, v1, v2); | 286 SWAP(BMVert*, v1, v2); |
280 | 287 |
281 adj = BLI_ghash_lookup(final_edges->edges, v1); | 288 adj = BLI_ghash_lookup(final_edges->edges, v1); |
282 if (!adj) | 289 if (!adj) |
283 return FALSE; | 290 return FALSE; |
284 | 291 |
285 return !!final_edges_find_link(adj, v2); | 292 return !!final_edges_find_link(adj, v2); |
286 } | 293 } |
287 | 294 |
288 /* Used for checking whether a pre-existing edge lies on the hull */ | 295 /* Used for checking whether a pre-existing edge lies on the hull */ |
(...skipping 12 matching lines...) Expand all Loading... | |
301 GHASH_ITER (iter, hull_triangles) { | 308 GHASH_ITER (iter, hull_triangles) { |
302 LinkData *link; | 309 LinkData *link; |
303 int i; | 310 int i; |
304 ················ | 311 ················ |
305 for (i = 0; i < 3; i++) { | 312 for (i = 0; i < 3; i++) { |
306 HullTriangle *t = BLI_ghashIterator_getKey(&iter); | 313 HullTriangle *t = BLI_ghashIterator_getKey(&iter); |
307 BMVert *v1 = t->v[i]; | 314 BMVert *v1 = t->v[i]; |
308 BMVert *v2 = t->v[(i + 1) % 3]; | 315 BMVert *v2 = t->v[(i + 1) % 3]; |
309 ListBase *adj; | 316 ListBase *adj; |
310 | 317 |
318 /* Use lower vertex pointer for hash key */ | |
311 if (v1 > v2) | 319 if (v1 > v2) |
312 SWAP(BMVert*, v1, v2); | 320 SWAP(BMVert*, v1, v2); |
313 | 321 |
314 adj = BLI_ghash_lookup(final_edges->edges, v1); | 322 adj = BLI_ghash_lookup(final_edges->edges, v1); |
315 if (!adj) { | 323 if (!adj) { |
316 adj = BLI_mempool_calloc(final_edges->base_pool) ; | 324 adj = BLI_mempool_calloc(final_edges->base_pool) ; |
317 BLI_ghash_insert(final_edges->edges, v1, adj); | 325 BLI_ghash_insert(final_edges->edges, v1, adj); |
318 } | 326 } |
319 | 327 |
320 if (!final_edges_find_link(adj, v2)) { | 328 if (!final_edges_find_link(adj, v2)) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 BMVert *min[3], BMVert *max[3]) | 384 BMVert *min[3], BMVert *max[3]) |
377 { | 385 { |
378 BMOIter oiter; | 386 BMOIter oiter; |
379 BMVert *v; | 387 BMVert *v; |
380 | 388 |
381 min[0] = min[1] = min[2] = NULL; | 389 min[0] = min[1] = min[2] = NULL; |
382 max[0] = max[1] = max[2] = NULL; | 390 max[0] = max[1] = max[2] = NULL; |
383 | 391 |
384 BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) { | 392 BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) { |
385 int i; | 393 int i; |
386 ················ | 394 ················ |
ideasman42
2012/04/28 10:59:34
could use INIT_MINMAX & DO_MINMAX here? - think it
| |
387 for (i = 0; i < 3; i++) { | 395 for (i = 0; i < 3; i++) { |
388 if (!min[i] || v->co[i] < min[i]->co[i]) | 396 if (!min[i] || v->co[i] < min[i]->co[i]) |
389 min[i] = v; | 397 min[i] = v; |
390 if (!max[i] || v->co[i] > max[i]->co[i]) | 398 if (!max[i] || v->co[i] > max[i]->co[i]) |
391 max[i] = v; | 399 max[i] = v; |
392 } | 400 } |
393 } | 401 } |
394 } | 402 } |
395 | 403 |
396 /* Returns true if input is coplanar */ | 404 /* Returns true if input is coplanar */ |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 if (largest_dist < 0.0001) | 478 if (largest_dist < 0.0001) |
471 return TRUE; | 479 return TRUE; |
472 | 480 |
473 return FALSE; | 481 return FALSE; |
474 } | 482 } |
475 | 483 |
476 | 484 |
477 | 485 |
478 /**************************** Final Output ****************************/ | 486 /**************************** Final Output ****************************/ |
479 | 487 |
480 static void hull_remove_overlapping(BMesh *bm, BMOperator *op, | 488 static void hull_remove_overlapping(BMesh *bm, GHash *hull_triangles, |
481 » » » » » » » » » GHash *h ull_triangles, | 489 » » » » » » » » » HullFina lEdges *final_edges, |
482 » » » » » » » » » HullFina lEdges *final_edges) | 490 » » » » » » » » » int make _holes) |
483 { | 491 { |
484 GHashIterator hull_iter; | 492 GHashIterator hull_iter; |
485 | 493 |
486 GHASH_ITER (hull_iter, hull_triangles) { | 494 GHASH_ITER (hull_iter, hull_triangles) { |
487 HullTriangle *t = BLI_ghashIterator_getKey(&hull_iter); | 495 HullTriangle *t = BLI_ghashIterator_getKey(&hull_iter); |
488 BMIter bm_iter1, bm_iter2; | 496 BMIter bm_iter1, bm_iter2; |
489 BMFace *f; | 497 BMFace *f; |
490 int f_on_hull; | 498 int f_on_hull; |
491 | 499 |
492 BM_ITER_ELEM (f, &bm_iter1, t->v[0], BM_FACES_OF_VERT) { | 500 BM_ITER_ELEM (f, &bm_iter1, t->v[0], BM_FACES_OF_VERT) { |
493 BMEdge *e; | 501 BMEdge *e; |
494 | 502 |
495 /* Check that all the face's edges are on the hull, | 503 /* Check that all the face's edges are on the hull, |
496 otherwise can't reuse it */ | 504 otherwise can't reuse it */ |
497 f_on_hull = TRUE; | 505 f_on_hull = TRUE; |
498 BM_ITER_ELEM (e, &bm_iter2, f, BM_EDGES_OF_FACE) { | 506 BM_ITER_ELEM (e, &bm_iter2, f, BM_EDGES_OF_FACE) { |
499 if (!hull_final_edges_lookup(final_edges, e->v1, e->v2)) { | 507 if (!hull_final_edges_lookup(final_edges, e->v1, e->v2)) { |
500 f_on_hull = FALSE; | 508 f_on_hull = FALSE; |
501 break; | 509 break; |
502 } | 510 } |
503 } | 511 } |
504 ························ | 512 ························ |
505 /* Note: can't change ghash while iterating, so mark | 513 /* Note: can't change ghash while iterating, so mark |
506 with 'skip' flag rather than deleting triangles */ | 514 with 'skip' flag rather than deleting triangles */ |
507 if (BM_vert_in_face(f, t->v[1]) && | 515 if (BM_vert_in_face(f, t->v[1]) && |
508 BM_vert_in_face(f, t->v[2]) && f_on_hull) { | 516 BM_vert_in_face(f, t->v[2]) && f_on_hull) { |
509 t->skip = TRUE; | 517 t->skip = TRUE; |
510 BMO_elem_flag_disable(bm, f, HULL_FLAG_INTERIOR_ ELE); | 518 BMO_elem_flag_disable(bm, f, HULL_FLAG_INTERIOR_ ELE); |
511 | 519 |
512 » » » » if (BMO_slot_bool_get(op, "make_holes")) | 520 » » » » if (make_holes) |
ideasman42
2012/04/28 10:59:34
better not do string lookups in a loop, this can b
| |
513 BMO_elem_flag_enable(bm, f, HULL_FLAG_HO LE); | 521 BMO_elem_flag_enable(bm, f, HULL_FLAG_HO LE); |
514 } | 522 } |
515 } | 523 } |
516 } | 524 } |
517 } | 525 } |
518 | 526 |
519 static void hull_mark_interior_elements(BMesh *bm, BMOperator *op, | 527 static void hull_mark_interior_elements(BMesh *bm, BMOperator *op, |
520 GHash *hull_triangles, | 528 GHash *hull_triangles, |
521 HullFinalEdges *final_edges) | 529 HullFinalEdges *final_edges) |
522 { | 530 { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
642 BMO_elem_flag_enable(bm, e, HULL_FLAG_HOLE); | 650 BMO_elem_flag_enable(bm, e, HULL_FLAG_HOLE); |
643 } | 651 } |
644 ········ | 652 ········ |
645 BMO_op_callf(bm, "del geom=%fef context=%i", | 653 BMO_op_callf(bm, "del geom=%fef context=%i", |
646 HULL_FLAG_HOLE, DEL_ONLYTAGGED); | 654 HULL_FLAG_HOLE, DEL_ONLYTAGGED); |
647 } | 655 } |
648 | 656 |
649 void bmo_convex_hull_exec(BMesh *bm, BMOperator *op) | 657 void bmo_convex_hull_exec(BMesh *bm, BMOperator *op) |
650 { | 658 { |
651 HullFinalEdges *final_edges; | 659 HullFinalEdges *final_edges; |
652 » BLI_mempool *pool; | 660 » BLI_mempool *hull_pool, *edge_pool; |
653 BMVert *v, *tetra[4]; | 661 BMVert *v, *tetra[4]; |
654 BMElemF *ele; | 662 BMElemF *ele; |
655 BMOIter oiter; | 663 BMOIter oiter; |
656 GHash *hull_triangles; | 664 GHash *hull_triangles; |
657 | 665 |
658 /* Verify that at least four verts in the input */ | 666 /* Verify that at least four verts in the input */ |
659 if (BMO_slot_get(op, "input")->len < 4) { | 667 if (BMO_slot_get(op, "input")->len < 4) { |
660 BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED, | 668 BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED, |
661 "Requires at least four vertices "); | 669 "Requires at least four vertices "); |
662 return; | 670 return; |
663 } | 671 } |
664 | 672 |
665 /* Initialize the convex hull by building a tetrahedron. A | 673 /* Initialize the convex hull by building a tetrahedron. A |
666 degenerate tetrahedron can cause problems, so report error and | 674 degenerate tetrahedron can cause problems, so report error and |
667 fail if the result is coplanar */ | 675 fail if the result is coplanar */ |
668 if (hull_find_large_tetrahedron(bm, op, tetra)) { | 676 if (hull_find_large_tetrahedron(bm, op, tetra)) { |
669 BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED, | 677 BMO_error_raise(bm, op, BMERR_CONVEX_HULL_FAILED, |
670 "Input vertices are coplanar"); | 678 "Input vertices are coplanar"); |
671 return; | 679 return; |
672 } | 680 } |
673 | 681 |
674 /* Tag input elements */ | 682 /* Tag input elements */ |
675 BMO_ITER (ele, &oiter, bm, op, "input", BM_ALL) | 683 BMO_ITER (ele, &oiter, bm, op, "input", BM_ALL) |
676 BMO_elem_flag_enable(bm, ele, HULL_FLAG_INPUT); | 684 BMO_elem_flag_enable(bm, ele, HULL_FLAG_INPUT); |
677 | 685 |
678 » pool = BLI_mempool_create(sizeof(HullTriangle), 128, 128, 0); | 686 » edge_pool = BLI_mempool_create(sizeof(HullBoundaryEdge), 128, 128, 0); |
687 » hull_pool = BLI_mempool_create(sizeof(HullTriangle), 128, 128, 0); | |
679 hull_triangles = BLI_ghash_new(BLI_ghashutil_ptrhash, | 688 hull_triangles = BLI_ghash_new(BLI_ghashutil_ptrhash, |
680 BLI_ghashutil _ptrcmp, | 689 BLI_ghashutil _ptrcmp, |
681 "hull_triangl es"); | 690 "hull_triangl es"); |
682 | 691 |
683 /* Add tetrahedron triangles */ | 692 /* Add tetrahedron triangles */ |
684 » hull_add_tetrahedron(hull_triangles, pool, tetra); | 693 » hull_add_tetrahedron(hull_triangles, hull_pool, tetra); |
685 | 694 |
686 /* Expand hull to cover new vertices outside the existing hull */ | 695 /* Expand hull to cover new vertices outside the existing hull */ |
687 BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) { | 696 BMO_ITER (v, &oiter, bm, op, "input", BM_VERT) { |
688 if (!BMO_elem_flag_test(bm, v, HULL_FLAG_TETRA_VERT)) { | 697 if (!BMO_elem_flag_test(bm, v, HULL_FLAG_TETRA_VERT)) { |
689 GHash *outside = hull_triangles_v_outside(hull_triangles , v); | 698 GHash *outside = hull_triangles_v_outside(hull_triangles , v); |
690 if (BLI_ghash_size(outside)) { | 699 if (BLI_ghash_size(outside)) { |
691 /* Expand hull and delete interior triangles */ | 700 /* Expand hull and delete interior triangles */ |
692 » » » » add_point(hull_triangles, pool, outside, v); | 701 » » » » add_point(hull_triangles, hull_pool, edge_pool, outside, v); |
693 } | 702 } |
694 BLI_ghash_free(outside, NULL, NULL); | 703 BLI_ghash_free(outside, NULL, NULL); |
695 } | 704 } |
696 } | 705 } |
697 | 706 |
707 BLI_mempool_destroy(edge_pool); | |
698 final_edges = hull_final_edges(hull_triangles); | 708 final_edges = hull_final_edges(hull_triangles); |
699 ········ | 709 ········ |
700 hull_mark_interior_elements(bm, op, hull_triangles, final_edges); | 710 hull_mark_interior_elements(bm, op, hull_triangles, final_edges); |
701 | 711 |
702 /* Remove hull triangles covered by an existing face */ | 712 /* Remove hull triangles covered by an existing face */ |
703 if (BMO_slot_bool_get(op, "use_existing_faces")) { | 713 if (BMO_slot_bool_get(op, "use_existing_faces")) { |
704 » » hull_remove_overlapping(bm, op, hull_triangles, final_edges); | 714 » » hull_remove_overlapping(bm, hull_triangles, final_edges, |
715 » » » » » » » » BMO_slot_bool_ge t(op, "make_holes")); | |
705 | 716 |
706 /* If 'make_holes' is enabled, delete the existing face too */ | 717 /* If 'make_holes' is enabled, delete the existing face too */ |
707 hull_make_holes(bm, op); | 718 hull_make_holes(bm, op); |
708 } | 719 } |
709 | 720 |
710 /* Done with edges */ | 721 /* Done with edges */ |
711 hull_final_edges_free(final_edges); | 722 hull_final_edges_free(final_edges); |
712 | 723 |
713 /* Convert hull triangles to BMesh faces */ | 724 /* Convert hull triangles to BMesh faces */ |
714 hull_output_triangles(bm, hull_triangles); | 725 hull_output_triangles(bm, hull_triangles); |
715 » BLI_mempool_destroy(pool); | 726 » BLI_mempool_destroy(hull_pool); |
716 | 727 |
717 BLI_ghash_free(hull_triangles, NULL, NULL); | 728 BLI_ghash_free(hull_triangles, NULL, NULL); |
718 | 729 |
719 if (BMO_slot_bool_get(op, "delete_unused")) | 730 if (BMO_slot_bool_get(op, "delete_unused")) |
720 hull_delete_unused(bm, op); | 731 hull_delete_unused(bm, op); |
721 | 732 |
722 /* Output slot of input elements that ended up inside the hull | 733 /* Output slot of input elements that ended up inside the hull |
723 rather than part of it */ | 734 rather than part of it */ |
724 BMO_slot_buffer_from_enabled_flag(bm, op, "interior_geom", BM_ALL, | 735 BMO_slot_buffer_from_enabled_flag(bm, op, "interior_geom", BM_ALL, |
725 HULL_F LAG_INTERIOR_ELE); | 736 HULL_F LAG_INTERIOR_ELE); |
726 | 737 |
727 /* Output slot of all hull vertices, faces, and edges */ | 738 /* Output slot of all hull vertices, faces, and edges */ |
728 BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, | 739 BMO_slot_buffer_from_enabled_flag(bm, op, "geomout", BM_ALL, |
729 HULL_F LAG_OUTPUT_GEOM); | 740 HULL_F LAG_OUTPUT_GEOM); |
730 } | 741 } |
LEFT | RIGHT |