Blender V5.3
bmo_hull.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#ifdef WITH_BULLET
12
13# include "MEM_guardedalloc.h"
14
15# include "BLI_listbase.hh"
16# include "BLI_math_geom_c.hh"
17# include "BLI_vector.hh"
18
19# include "RBI_hull_api.h"
20
21/* XXX: using 128 for totelem and `pchunk` of `mempool`, no idea what good
22 * values would be though */
23
24# include "bmesh.hh"
25
26# include "intern/bmesh_operators_private.hh" /* own include */
27
28namespace blender {
29
30/* Internal operator flags */
31enum {
32 HULL_FLAG_INPUT = (1 << 0),
33
34 HULL_FLAG_INTERIOR_ELE = (1 << 1),
35 HULL_FLAG_OUTPUT_GEOM = (1 << 2),
36
37 HULL_FLAG_DEL = (1 << 3),
38 HULL_FLAG_HOLE = (1 << 4),
39};
40
41/* Store hull triangles separate from BMesh faces until the end; this
42 * way we don't have to worry about cleaning up extraneous edges or
43 * incorrectly deleting existing geometry. */
44struct HullTriangle {
45 BMVert *v[3];
46 float no[3];
47 int skip;
48};
49
50/*************************** Hull Triangles ***************************/
51
52static void hull_add_triangle(
53 BMesh *bm, BLI_mempool *hull_triangles, BMVert *v1, BMVert *v2, BMVert *v3)
54{
55 HullTriangle *t;
56 int i;
57
58 t = static_cast<HullTriangle *>(BLI_mempool_calloc(hull_triangles));
59 t->v[0] = v1;
60 t->v[1] = v2;
61 t->v[2] = v3;
62
63 /* Mark triangles vertices as not interior */
64 for (i = 0; i < 3; i++) {
65 BMO_vert_flag_disable(bm, t->v[i], HULL_FLAG_INTERIOR_ELE);
66 }
67
68 normal_tri_v3(t->no, v1->co, v2->co, v3->co);
69}
70
71static BMFace *hull_find_example_face(BMesh *bm, BMEdge *e)
72{
73 BMIter iter;
74 BMFace *f;
75
76 BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
77 if (BMO_face_flag_test(bm, f, HULL_FLAG_INPUT) ||
78 BMO_face_flag_test(bm, f, HULL_FLAG_OUTPUT_GEOM) == false)
79 {
80 return f;
81 }
82 }
83
84 return nullptr;
85}
86
87static void hull_output_triangles(BMesh *bm, BLI_mempool *hull_triangles)
88{
90 BLI_mempool_iternew(hull_triangles, &iter);
91 HullTriangle *t;
92
93 while ((t = static_cast<HullTriangle *>(BLI_mempool_iterstep(&iter)))) {
94 int i;
95
96 if (!t->skip) {
97 BMEdge *edges[3] = {
98 BM_edge_create(bm, t->v[0], t->v[1], nullptr, BM_CREATE_NO_DOUBLE),
99 BM_edge_create(bm, t->v[1], t->v[2], nullptr, BM_CREATE_NO_DOUBLE),
100 BM_edge_create(bm, t->v[2], t->v[0], nullptr, BM_CREATE_NO_DOUBLE),
101 };
102 BMFace *f, *example = nullptr;
103
104 f = BM_face_exists(t->v, 3);
105 if (f != nullptr) {
106 /* If the operator is run with "use_existing_faces"
107 * disabled, but an output face in the hull is the
108 * same as a face in the existing mesh, it should not
109 * be marked as unused or interior. */
110 BMO_face_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM);
111 BMO_face_flag_disable(bm, f, HULL_FLAG_HOLE);
112 BMO_face_flag_disable(bm, f, HULL_FLAG_INTERIOR_ELE);
113 }
114 else {
115 /* Look for an adjacent face that existed before the hull */
116 for (i = 0; i < 3; i++) {
117 if (!example) {
118 example = hull_find_example_face(bm, edges[i]);
119 }
120 }
121
122 /* Create new hull face */
123 f = BM_face_create_verts(bm, t->v, 3, example, BM_CREATE_NO_DOUBLE, true);
124 BM_face_copy_shared(bm, f, nullptr, nullptr);
125 }
126 /* Mark face for 'geom.out' slot and select */
127 BMO_face_flag_enable(bm, f, HULL_FLAG_OUTPUT_GEOM);
128 BM_face_select_set(bm, f, true);
129
130 /* Mark edges for 'geom.out' slot */
131 for (i = 0; i < 3; i++) {
132 BMO_edge_flag_enable(bm, edges[i], HULL_FLAG_OUTPUT_GEOM);
133 }
134 }
135 else {
136 /* Mark input edges for 'geom.out' slot */
137 for (i = 0; i < 3; i++) {
138 const int next = (i == 2 ? 0 : i + 1);
139 BMEdge *e = BM_edge_exists(t->v[i], t->v[next]);
140 if (e && BMO_edge_flag_test(bm, e, HULL_FLAG_INPUT) &&
141 !BMO_edge_flag_test(bm, e, HULL_FLAG_HOLE))
142 {
143 BMO_edge_flag_enable(bm, e, HULL_FLAG_OUTPUT_GEOM);
144 }
145 }
146 }
147
148 /* Mark verts for 'geom.out' slot */
149 for (i = 0; i < 3; i++) {
150 BMO_vert_flag_enable(bm, t->v[i], HULL_FLAG_OUTPUT_GEOM);
151 }
152 }
153}
154
155/***************************** Final Edges ****************************/
156
157struct HullFinalEdges {
158 Map<BMVert *, ListBaseT<LinkData> *> *edges;
159 BLI_mempool *base_pool, *link_pool;
160};
161
162static LinkData *final_edges_find_link(ListBaseT<LinkData> *adj, BMVert *v)
163{
164 for (LinkData &link : *adj) {
165 if (link.data == v) {
166 return &link;
167 }
168 }
169
170 return nullptr;
171}
172
173static int hull_final_edges_lookup(HullFinalEdges *final_edges, BMVert *v1, BMVert *v2)
174{
175 ListBaseT<LinkData> *adj;
176
177 /* Use lower vertex pointer for hash key */
178 if (v1 > v2) {
179 std::swap(v1, v2);
180 }
181
182 adj = final_edges->edges->lookup_default(v1, nullptr);
183 if (!adj) {
184 return false;
185 }
186
187 return !!final_edges_find_link(adj, v2);
188}
189
190/* Used for checking whether a pre-existing edge lies on the hull */
191static HullFinalEdges *hull_final_edges(BLI_mempool *hull_triangles)
192{
193 HullFinalEdges *final_edges;
194
195 final_edges = MEM_new_zeroed<HullFinalEdges>("HullFinalEdges");
196 final_edges->edges = MEM_new<Map<BMVert *, ListBaseT<LinkData> *>>("final edges map");
197 final_edges->base_pool = BLI_mempool_create(
198 sizeof(ListBaseT<LinkData>), 0, 128, BLI_MEMPOOL_NOP);
199 final_edges->link_pool = BLI_mempool_create(sizeof(LinkData), 0, 128, BLI_MEMPOOL_NOP);
200
201 BLI_mempool_iter iter;
202 BLI_mempool_iternew(hull_triangles, &iter);
203 HullTriangle *t;
204
205 while ((t = static_cast<HullTriangle *>(BLI_mempool_iterstep(&iter)))) {
206 LinkData *link;
207 int i;
208
209 for (i = 0; i < 3; i++) {
210 BMVert *v1 = t->v[i];
211 BMVert *v2 = t->v[(i + 1) % 3];
212
213 /* Use lower vertex pointer for hash key */
214 if (v1 > v2) {
215 std::swap(v1, v2);
216 }
217
218 ListBaseT<LinkData> *adj = final_edges->edges->lookup_or_add_cb(v1, [&]() {
219 return static_cast<ListBaseT<LinkData> *>(BLI_mempool_calloc(final_edges->base_pool));
220 });
221
222 if (!final_edges_find_link(adj, v2)) {
223 link = static_cast<LinkData *>(BLI_mempool_calloc(final_edges->link_pool));
224 link->data = v2;
225 BLI_addtail(adj, link);
226 }
227 }
228 }
229
230 return final_edges;
231}
232
233static void hull_final_edges_free(HullFinalEdges *final_edges)
234{
235 MEM_delete(final_edges->edges);
236 BLI_mempool_destroy(final_edges->base_pool);
237 BLI_mempool_destroy(final_edges->link_pool);
238 MEM_delete(final_edges);
239}
240
241/**************************** Final Output ****************************/
242
243static void hull_remove_overlapping(BMesh *bm,
244 BLI_mempool *hull_triangles,
245 HullFinalEdges *final_edges)
246{
247 BLI_mempool_iter iter;
248 BLI_mempool_iternew(hull_triangles, &iter);
249 HullTriangle *t;
250
251 while ((t = static_cast<HullTriangle *>(BLI_mempool_iterstep(&iter)))) {
252 BMIter bm_iter1, bm_iter2;
253 BMFace *f;
254 bool f_on_hull;
255
256 BM_ITER_ELEM (f, &bm_iter1, t->v[0], BM_FACES_OF_VERT) {
257 BMEdge *e;
258
259 /* Check that all the face's edges are on the hull,
260 * otherwise can't reuse it */
261 f_on_hull = true;
262 BM_ITER_ELEM (e, &bm_iter2, f, BM_EDGES_OF_FACE) {
263 if (!hull_final_edges_lookup(final_edges, e->v1, e->v2)) {
264 f_on_hull = false;
265 break;
266 }
267 }
268
269 /* NOTE: can't change ghash while iterating, so mark
270 * with 'skip' flag rather than deleting triangles */
271 if (BM_vert_in_face(t->v[1], f) && BM_vert_in_face(t->v[2], f) && f_on_hull) {
272 t->skip = true;
273 BMO_face_flag_disable(bm, f, HULL_FLAG_INTERIOR_ELE);
274 BMO_face_flag_enable(bm, f, HULL_FLAG_HOLE);
275 }
276 }
277 }
278}
279
280static void hull_mark_interior_elements(BMesh *bm, BMOperator *op, HullFinalEdges *final_edges)
281{
282 BMEdge *e;
283 BMFace *f;
284 BMOIter oiter;
285
286 /* Check for interior edges too */
287 BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
288 if (!hull_final_edges_lookup(final_edges, e->v1, e->v2)) {
289 BMO_edge_flag_enable(bm, e, HULL_FLAG_INTERIOR_ELE);
290 }
291 }
292
293 /* Mark all input faces as interior, some may be unmarked in
294 * hull_remove_overlapping() */
295 BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
296 BMO_face_flag_enable(bm, f, HULL_FLAG_INTERIOR_ELE);
297 }
298}
299
300static void hull_tag_unused(BMesh *bm, BMOperator *op)
301{
302 BMIter iter;
303 BMOIter oiter;
304 BMVert *v;
305 BMEdge *e;
306 BMFace *f;
307
308 /* Mark vertices, edges, and faces that are already marked
309 * interior (i.e. were already part of the input, but not part of
310 * the hull), but that aren't also used by elements outside the
311 * input set */
312 BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
313 if (BMO_vert_flag_test(bm, v, HULL_FLAG_INTERIOR_ELE)) {
314 bool del = true;
315
316 BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
317 if (!BMO_edge_flag_test(bm, e, HULL_FLAG_INPUT)) {
318 del = false;
319 break;
320 }
321 }
322
323 BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
324 if (!BMO_face_flag_test(bm, f, HULL_FLAG_INPUT)) {
325 del = false;
326 break;
327 }
328 }
329
330 if (del) {
331 BMO_vert_flag_enable(bm, v, HULL_FLAG_DEL);
332 }
333 }
334 }
335
336 BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
337 if (BMO_edge_flag_test(bm, e, HULL_FLAG_INTERIOR_ELE)) {
338 bool del = true;
339
340 BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
341 if (!BMO_face_flag_test(bm, f, HULL_FLAG_INPUT)) {
342 del = false;
343 break;
344 }
345 }
346
347 if (del) {
348 BMO_edge_flag_enable(bm, e, HULL_FLAG_DEL);
349 }
350 }
351 }
352
353 BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
354 if (BMO_face_flag_test(bm, f, HULL_FLAG_INTERIOR_ELE)) {
355 BMO_face_flag_enable(bm, f, HULL_FLAG_DEL);
356 }
357 }
358}
359
360static void hull_tag_holes(BMesh *bm, BMOperator *op)
361{
362 BMIter iter;
363 BMOIter oiter;
364 BMFace *f;
365 BMEdge *e;
366
367 /* Unmark any hole faces if they are isolated or part of a
368 * border */
369 BMO_ITER (f, &oiter, op->slots_in, "input", BM_FACE) {
370 if (BMO_face_flag_test(bm, f, HULL_FLAG_HOLE)) {
371 BM_ITER_ELEM (e, &iter, f, BM_EDGES_OF_FACE) {
372 if (BM_edge_is_boundary(e)) {
373 BMO_face_flag_disable(bm, f, HULL_FLAG_HOLE);
374 break;
375 }
376 }
377 }
378 }
379
380 /* Mark edges too if all adjacent faces are holes and the edge is
381 * not already isolated */
382 BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) {
383 bool hole = true;
384 bool any_faces = false;
385
386 BM_ITER_ELEM (f, &iter, e, BM_FACES_OF_EDGE) {
387 any_faces = true;
388 if (!BMO_face_flag_test(bm, f, HULL_FLAG_HOLE)) {
389 hole = false;
390 break;
391 }
392 }
393
394 if (hole && any_faces) {
395 BMO_edge_flag_enable(bm, e, HULL_FLAG_HOLE);
396 }
397 }
398}
399
400static int hull_input_vert_count(BMOperator *op)
401{
402 BMOIter oiter;
403 BMVert *v;
404 int count = 0;
405
406 BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
407 count++;
408 }
409
410 return count;
411}
412
413static BMVert **hull_input_verts_copy(BMOperator *op, const int num_input_verts)
414{
415 BMOIter oiter;
416 BMVert *v;
417 BMVert **input_verts = MEM_new_array_zeroed<BMVert *>(num_input_verts, AT);
418 int i = 0;
419
420 BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
421 input_verts[i++] = v;
422 }
423
424 return input_verts;
425}
426
427static float (*hull_verts_for_bullet(BMVert **input_verts, const int num_input_verts))[3]
428{
429 float (*coords)[3] = MEM_new_array_zeroed<float[3]>(num_input_verts, __func__);
430 int i;
431
432 for (i = 0; i < num_input_verts; i++) {
433 copy_v3_v3(coords[i], input_verts[i]->co);
434 }
435
436 return coords;
437}
438
439static BMVert **hull_verts_from_bullet(plConvexHull hull,
440 BMVert **input_verts,
441 const int num_input_verts)
442{
443 const int num_verts = plConvexHullNumVertices(hull);
444 BMVert **hull_verts = MEM_new_array_uninitialized<BMVert *>(num_verts, AT);
445 int i;
446
447 for (i = 0; i < num_verts; i++) {
448 float co[3];
449 int original_index;
450 plConvexHullGetVertex(hull, i, co, &original_index);
451
452 if (original_index >= 0 && original_index < num_input_verts) {
453 hull_verts[i] = input_verts[original_index];
454 }
455 else {
456 BLI_assert_msg(0, "Unexpected new vertex in hull output");
457 }
458 }
459
460 return hull_verts;
461}
462
463static void hull_from_bullet(BMesh *bm, BMOperator *op, BLI_mempool *hull_triangles)
464{
465 BMVert **input_verts;
466 float (*coords)[3];
467 BMVert **hull_verts;
468
469 plConvexHull hull;
470 int i, count = 0;
471
472 const int num_input_verts = hull_input_vert_count(op);
473
474 input_verts = hull_input_verts_copy(op, num_input_verts);
475 coords = hull_verts_for_bullet(input_verts, num_input_verts);
476
477 hull = plConvexHullCompute(coords, num_input_verts);
478 hull_verts = hull_verts_from_bullet(hull, input_verts, num_input_verts);
479
480 count = plConvexHullNumFaces(hull);
481 Vector<int> fvi;
482 for (i = 0; i < count; i++) {
483 const int len = plConvexHullGetFaceSize(hull, i);
484
485 if (len > 2) {
486 BMVert *fv[3];
487 int j;
488
489 /* Get face vertex indices */
490 fvi.reinitialize(len);
491 plConvexHullGetFaceVertices(hull, i, fvi.data());
492
493 /* NOTE: here we throw away any NGons from Bullet and turn
494 * them into triangle fans. Would be nice to use these
495 * directly, but will have to wait until HullTriangle goes
496 * away (TODO) */
497 fv[0] = hull_verts[fvi[0]];
498 for (j = 2; j < len; j++) {
499 fv[1] = hull_verts[fvi[j - 1]];
500 fv[2] = hull_verts[fvi[j]];
501
502 hull_add_triangle(bm, hull_triangles, fv[0], fv[1], fv[2]);
503 }
504 }
505 }
506
507 plConvexHullDelete(hull);
508
509 MEM_delete(hull_verts);
510 MEM_delete(coords);
511 MEM_delete(input_verts);
512}
513
514/* Check that there are at least three vertices in the input */
515static bool hull_num_input_verts_is_ok(BMOperator *op)
516{
517 BMOIter oiter;
518 BMVert *v;
519 int partial_num_verts = 0;
520
521 BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) {
522 partial_num_verts++;
523 if (partial_num_verts >= 3) {
524 break;
525 }
526 }
527
528 return (partial_num_verts >= 3);
529}
530
532{
533 HullFinalEdges *final_edges;
534 BLI_mempool *hull_triangles;
535 BMElemF *ele;
536 BMOIter oiter;
537
538 /* Verify that at least three verts in the input */
539 if (!hull_num_input_verts_is_ok(op)) {
540 BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "Requires at least three vertices");
541 return;
542 }
543
544 /* Tag input elements */
545 BMO_ITER (ele, &oiter, op->slots_in, "input", BM_ALL) {
546
547 /* Mark all vertices as interior to begin with */
548 if (ele->head.htype == BM_VERT) {
549 BMO_vert_flag_enable(bm, (BMVert *)ele, HULL_FLAG_INPUT | HULL_FLAG_INTERIOR_ELE);
550 }
551 else if (ele->head.htype == BM_EDGE) {
552 BMO_edge_flag_enable(bm, (BMEdge *)ele, HULL_FLAG_INPUT);
553 }
554 else {
555 BMO_face_flag_enable(bm, (BMFace *)ele, HULL_FLAG_INPUT);
556 }
557 }
558
559 hull_triangles = BLI_mempool_create(sizeof(HullTriangle), 0, 128, BLI_MEMPOOL_ALLOW_ITER);
560
561 hull_from_bullet(bm, op, hull_triangles);
562
563 final_edges = hull_final_edges(hull_triangles);
564
565 hull_mark_interior_elements(bm, op, final_edges);
566
567 /* Remove hull triangles covered by an existing face */
568 if (BMO_slot_bool_get(op->slots_in, "use_existing_faces")) {
569 hull_remove_overlapping(bm, hull_triangles, final_edges);
570
571 hull_tag_holes(bm, op);
572 }
573
574 /* Done with edges */
575 hull_final_edges_free(final_edges);
576
577 /* Convert hull triangles to BMesh faces */
578 hull_output_triangles(bm, hull_triangles);
579 BLI_mempool_destroy(hull_triangles);
580
581 hull_tag_unused(bm, op);
582
583 /* Output slot of input elements that ended up inside the hull
584 * rather than part of it */
586 bm, op, op->slots_out, "geom_interior.out", BM_ALL_NOLOOP, HULL_FLAG_INTERIOR_ELE);
587
588 /* Output slot of input elements that ended up inside the hull and
589 * are unused by other geometry. */
591 bm, op, op->slots_out, "geom_unused.out", BM_ALL_NOLOOP, HULL_FLAG_DEL);
592
593 /* Output slot of faces and edges that were in the input and on
594 * the hull (useful for cases like bridging where you want to
595 * delete some input geometry) */
597 bm, op, op->slots_out, "geom_holes.out", BM_ALL_NOLOOP, HULL_FLAG_HOLE);
598
599 /* Output slot of all hull vertices, faces, and edges */
601 bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, HULL_FLAG_OUTPUT_GEOM);
602}
603
604} // namespace blender
605
606#endif /* WITH_BULLET */
Read Blender memory allocation and freeing.
struct plConvexHull__ * plConvexHull
#define AT
#define BLI_assert_msg(a, msg)
#define BM_ALL_NOLOOP
#define BM_ALL
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BMO_vert_flag_disable(bm, e, oflag)
#define BMO_edge_flag_test(bm, e, oflag)
#define BMO_edge_flag_enable(bm, e, oflag)
#define BMO_vert_flag_enable(bm, e, oflag)
#define BMO_face_flag_enable(bm, e, oflag)
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
#define BMO_vert_flag_test(bm, e, oflag)
#define BMO_face_flag_disable(bm, e, oflag)
#define BMO_face_flag_test(bm, e, oflag)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263
BMesh Iterators.
BMFace * BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
void bmo_convex_hull_exec(BMesh *bm, BMOperator *op)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
ATTR_WARN_UNUSED_RESULT const BMVert * v
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
Definition math_geom.cc:45
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
@ BM_CREATE_NO_DOUBLE
Definition bmesh_core.hh:36
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, short oflag)
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int elem_num, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
void BM_face_copy_shared(BMesh *bm, BMFace *f, BMLoopFilterFunc filter_fn, void *user_data)
copies face loop data from shared adjacent faces.
void BM_face_select_set(BMesh *bm, BMFace *f, const bool select)
Select Face.
bool BM_vert_in_face(BMVert *v, BMFace *f)
void BLI_mempool_iternew(BLI_mempool *pool, BLI_mempool_iter *iter) ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void * BLI_mempool_iterstep(BLI_mempool_iter *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BMFace * BM_face_exists(BMVert *const *varr, int len)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:118
ATTR_WARN_UNUSED_RESULT const BMVert * v2
@ BLI_MEMPOOL_NOP
@ BLI_MEMPOOL_ALLOW_ITER
void * BLI_mempool_calloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg) ATTR_NONNULL(1
@ BMO_ERROR_CANCEL
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
int plConvexHullGetFaceSize(plConvexHull hull, int n)
void plConvexHullGetVertex(plConvexHull hull, int n, float coords[3], int *original_index)
int plConvexHullNumVertices(plConvexHull hull)
plConvexHull plConvexHullCompute(float(*coords)[3], int count)
void plConvexHullDelete(plConvexHull hull)
int plConvexHullNumFaces(plConvexHull hull)
void plConvexHullGetFaceVertices(plConvexHull hull, int n, int *vertices)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float