Blender V5.0
bmesh_wireframe.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#include <algorithm>
12
13#include "MEM_guardedalloc.h"
14
15#include "bmesh.hh"
16
17#include "BLI_math_geom.h"
18#include "BLI_math_vector.h"
19
20#include "BKE_customdata.hh"
21#include "BKE_deform.hh"
22
23#include "bmesh_wireframe.hh"
24
26{
27 BMLoop *l, *l_first;
28
29 l = l_first = e->l;
30 do {
32 return l;
33 }
34 } while ((l = l->radial_next) != l_first);
35
36 /* in the case this is used, we know this will never happen */
37 return nullptr;
38}
39
41 BMVert *v, float r_no[3], float r_no_face[3], BMVert **r_va_other, BMVert **r_vb_other)
42{
43 BMIter iter;
44 BMEdge *e_iter;
45
46 BMEdge *e_a = nullptr, *e_b = nullptr;
47 BMVert *v_a, *v_b;
48
49 BMLoop *l_a, *l_b;
50
51 float no_face[3], no_edge[3];
52 float tvec_a[3], tvec_b[3];
53
54 /* get 2 boundary edges, there should only _be_ 2,
55 * in case there are more - results won't be valid of course */
56 BM_ITER_ELEM (e_iter, &iter, v, BM_EDGES_OF_VERT) {
57 if (BM_elem_flag_test(e_iter, BM_ELEM_TAG)) {
58 if (e_a == nullptr) {
59 e_a = e_iter;
60 }
61 else {
62 e_b = e_iter;
63 break;
64 }
65 }
66 }
67
68 if (e_a && e_b) {
69 /* NOTE: with an incorrectly flushed selection this can crash. */
70 l_a = bm_edge_tag_faceloop(e_a);
72
73 /* average edge face normal */
74 add_v3_v3v3(no_face, l_a->f->no, l_b->f->no);
75 normalize_v3(no_face);
76
77 /* average edge direction */
78 v_a = BM_edge_other_vert(e_a, v);
79 v_b = BM_edge_other_vert(e_b, v);
80
81 sub_v3_v3v3(tvec_a, v->co, v_a->co);
82 sub_v3_v3v3(tvec_b, v_b->co, v->co);
83 normalize_v3(tvec_a);
84 normalize_v3(tvec_b);
85 add_v3_v3v3(no_edge, tvec_a, tvec_b); /* not unit length but this is ok */
86
87 /* check are we flipped the right way */
88 BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
89 BM_edge_calc_face_tangent(e_b, l_b, tvec_b);
90 add_v3_v3(tvec_a, tvec_b);
91
92 *r_va_other = v_a;
93 *r_vb_other = v_b;
94 }
95 else {
96 /* degenerate case - vertex connects a boundary edged face to other faces,
97 * so we have only one boundary face - only use it for calculations */
98 l_a = bm_edge_tag_faceloop(e_a);
99
100 copy_v3_v3(no_face, l_a->f->no);
101
102 /* edge direction */
103 v_a = BM_edge_other_vert(e_a, v);
104 v_b = nullptr;
105
106 sub_v3_v3v3(no_edge, v->co, v_a->co);
107
108 /* check are we flipped the right way */
109 BM_edge_calc_face_tangent(e_a, l_a, tvec_a);
110
111 *r_va_other = nullptr;
112 *r_vb_other = nullptr;
113 }
114
115 /* find the normal */
116 cross_v3_v3v3(r_no, no_edge, no_face);
117 normalize_v3(r_no);
118
119 if (dot_v3v3(r_no, tvec_a) > 0.0f) {
120 negate_v3(r_no);
121 }
122
123 copy_v3_v3(r_no_face, no_face);
124}
125
126/* check if we are the only tagged loop-face around this edge */
128{
129 BMLoop *l = l_first->radial_next;
130
131 if (l == l_first) {
132 return true; /* a real boundary */
133 }
134
135 do {
137 return false;
138 }
139 } while ((l = l->radial_next) != l_first);
140
141 return true;
142}
143
145 const float offset,
146 const float offset_fac,
147 const float offset_fac_vg,
148 const bool use_replace,
149 const bool use_boundary,
150 const bool use_even_offset,
151 const bool use_relative_offset,
152 const bool use_crease,
153 const float crease_weight,
154 const int defgrp_index,
155 const bool defgrp_invert,
156 const short mat_offset,
157 const int mat_max,
158 /* for operators */
159 const bool use_tag)
160{
161 const float ofs_orig = -(((-offset_fac + 1.0f) * 0.5f) * offset);
162 const float ofs_new = offset + ofs_orig;
163 const float ofs_mid = (ofs_orig + ofs_new) / 2.0f;
164 const float inset = offset / 2.0f;
165 int cd_edge_crease_offset = use_crease ? CustomData_get_offset_named(
166 &bm->edata, CD_PROP_FLOAT, "crease_edge") :
167 -1;
168 const int cd_dvert_offset = (defgrp_index != -1) ?
170 -1;
171 const float offset_fac_vg_inv = 1.0f - offset_fac_vg;
172
173 const int totvert_orig = bm->totvert;
174
175 BMIter iter;
176 BMIter itersub;
177
178 /* filled only with boundary verts */
179 BMVert **verts_src = MEM_malloc_arrayN<BMVert *>(totvert_orig, __func__);
180 BMVert **verts_neg = MEM_malloc_arrayN<BMVert *>(totvert_orig, __func__);
181 BMVert **verts_pos = MEM_malloc_arrayN<BMVert *>(totvert_orig, __func__);
182
183 /* Will over-allocate, but makes for easy lookups by index to keep aligned. */
184 BMVert **verts_boundary = static_cast<BMVert **>(
185 use_boundary ? MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__) : nullptr);
186
187 float *verts_relfac = static_cast<float *>(
188 (use_relative_offset || (cd_dvert_offset != -1)) ?
189 MEM_mallocN(sizeof(float) * totvert_orig, __func__) :
190 nullptr);
191
192 /* May over-allocate if not all faces have wire. */
193 BMVert **verts_loop;
194 int verts_loop_tot = 0;
195
196 BMVert *v_src;
197
198 BMFace *f_src;
199 BMLoop *l;
200
201 float tvec[3];
202 float fac, fac_shell;
203
204 int i;
205
206 if (use_crease && cd_edge_crease_offset == -1) {
207 BM_data_layer_add_named(bm, &bm->edata, CD_PROP_FLOAT, "crease_edge");
208 cd_edge_crease_offset = CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "crease_edge");
209 }
210
211 BM_ITER_MESH_INDEX (v_src, &iter, bm, BM_VERTS_OF_MESH, i) {
212 BM_elem_index_set(v_src, i); /* set_inline */
213
214 verts_src[i] = v_src;
216 }
217 bm->elem_index_dirty &= ~BM_VERT;
218
219 /* setup tags, all faces and verts will be tagged which will be duplicated */
220
221 BM_ITER_MESH_INDEX (f_src, &iter, bm, BM_FACES_OF_MESH, i) {
222 BM_elem_index_set(f_src, i); /* set_inline */
223
224 if (use_tag) {
225 if (!BM_elem_flag_test(f_src, BM_ELEM_TAG)) {
226 continue;
227 }
228 }
229 else {
231 }
232
233 verts_loop_tot += f_src->len;
234 BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
236
237 /* also tag boundary edges */
239 }
240 }
241 bm->elem_index_dirty &= ~BM_FACE;
242
243 /* duplicate tagged verts */
244 for (i = 0; i < totvert_orig; i++) {
245 v_src = verts_src[i];
246 if (BM_elem_flag_test(v_src, BM_ELEM_TAG)) {
247 fac = 1.0f;
248
249 if (verts_relfac) {
250 if (use_relative_offset) {
251 verts_relfac[i] = BM_vert_calc_median_tagged_edge_length(v_src);
252 }
253 else {
254 verts_relfac[i] = 1.0f;
255 }
256
257 if (cd_dvert_offset != -1) {
258 MDeformVert *dvert = static_cast<MDeformVert *>(
259 BM_ELEM_CD_GET_VOID_P(v_src, cd_dvert_offset));
260 float defgrp_fac = BKE_defvert_find_weight(dvert, defgrp_index);
261
262 if (defgrp_invert) {
263 defgrp_fac = 1.0f - defgrp_fac;
264 }
265
266 if (offset_fac_vg > 0.0f) {
267 defgrp_fac = (offset_fac_vg + (defgrp_fac * offset_fac_vg_inv));
268 }
269
270 verts_relfac[i] *= defgrp_fac;
271 }
272
273 fac *= verts_relfac[i];
274 }
275
276 verts_neg[i] = BM_vert_create(bm, nullptr, v_src, BM_CREATE_NOP);
277 verts_pos[i] = BM_vert_create(bm, nullptr, v_src, BM_CREATE_NOP);
278
279 if (offset == 0.0f) {
280 madd_v3_v3v3fl(verts_neg[i]->co, v_src->co, v_src->no, ofs_orig * fac);
281 madd_v3_v3v3fl(verts_pos[i]->co, v_src->co, v_src->no, ofs_new * fac);
282 }
283 else {
284 madd_v3_v3v3fl(tvec, v_src->co, v_src->no, ofs_mid * fac);
285
286 madd_v3_v3v3fl(verts_neg[i]->co, tvec, v_src->no, (ofs_orig - ofs_mid) * fac);
287 madd_v3_v3v3fl(verts_pos[i]->co, tvec, v_src->no, (ofs_new - ofs_mid) * fac);
288 }
289 }
290 else {
291 /* could skip this */
292 verts_neg[i] = nullptr;
293 verts_pos[i] = nullptr;
294 }
295
296 /* conflicts with BM_vert_calc_median_tagged_edge_length */
297 if (use_relative_offset == false) {
299 }
300 }
301
302 if (use_relative_offset) {
304 }
305
306 verts_loop = MEM_malloc_arrayN<BMVert *>(verts_loop_tot, __func__);
307 verts_loop_tot = 0; /* count up again */
308
309 BM_ITER_MESH (f_src, &iter, bm, BM_FACES_OF_MESH) {
310
311 if (use_tag && !BM_elem_flag_test(f_src, BM_ELEM_TAG)) {
312 continue;
313 }
314
315 BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
316 /* Because some faces might be skipped! */
317 BM_elem_index_set(l, verts_loop_tot); /* set_dirty */
318
320
321 /* create offset vert */
322 fac = 1.0f;
323
324 if (verts_relfac) {
325 fac *= verts_relfac[BM_elem_index_get(l->v)];
326 }
327
328 fac_shell = fac;
329 if (use_even_offset) {
330 fac_shell *= shell_angle_to_dist((float(M_PI) - BM_loop_calc_face_angle(l)) * 0.5f);
331 }
332
333 madd_v3_v3v3fl(tvec, l->v->co, tvec, inset * fac_shell);
334 if (offset != 0.0f) {
335 madd_v3_v3fl(tvec, l->v->no, ofs_mid * fac);
336 }
337 verts_loop[verts_loop_tot] = BM_vert_create(bm, tvec, l->v, BM_CREATE_NOP);
338
339 if (use_boundary) {
340 if (BM_elem_flag_test(l->e, BM_ELEM_TAG)) { /* is this a boundary? */
341 BMVert *v_pair[2] = {l->v, l->next->v};
342
343 for (i = 0; i < 2; i++) {
344 BMVert *v_boundary = v_pair[i];
345 if (!BM_elem_flag_test(v_boundary, BM_ELEM_TAG)) {
346 const int v_boundary_index = BM_elem_index_get(v_boundary);
347 float no_face[3];
348 BMVert *va_other;
349 BMVert *vb_other;
350
351 BM_elem_flag_enable(v_boundary, BM_ELEM_TAG);
352
353 bm_vert_boundary_tangent(v_boundary, tvec, no_face, &va_other, &vb_other);
354
355 /* create offset vert */
356 /* similar to code above but different angle calc */
357 fac = 1.0f;
358
359 if (verts_relfac) {
360 fac *= verts_relfac[v_boundary_index];
361 }
362
363 fac_shell = fac;
364 if (use_even_offset) {
365 if (va_other) { /* for verts with only one boundary edge - this will be nullptr */
366 fac_shell *= shell_angle_to_dist(
368 va_other->co, v_boundary->co, vb_other->co, no_face)) *
369 0.5f);
370 }
371 }
372
373 madd_v3_v3v3fl(tvec, v_boundary->co, tvec, inset * fac_shell);
374 if (offset != 0.0f) {
375 madd_v3_v3fl(tvec, v_boundary->no, ofs_mid * fac);
376 }
377 verts_boundary[v_boundary_index] = BM_vert_create(
378 bm, tvec, v_boundary, BM_CREATE_NOP);
379 }
380 }
381 }
382 }
383
384 verts_loop_tot++;
385 }
386 }
387 bm->elem_index_dirty |= BM_LOOP;
388
389 BM_ITER_MESH (f_src, &iter, bm, BM_FACES_OF_MESH) {
390
391 /* skip recently added faces */
392 if (BM_elem_index_get(f_src) == -1) {
393 continue;
394 }
395
396 if (use_tag && !BM_elem_flag_test(f_src, BM_ELEM_TAG)) {
397 continue;
398 }
399
401
402 BM_ITER_ELEM (l, &itersub, f_src, BM_LOOPS_OF_FACE) {
403 BMFace *f_new;
404 BMLoop *l_new;
405 BMLoop *l_next = l->next;
406 BMVert *v_l1 = verts_loop[BM_elem_index_get(l)];
407 BMVert *v_l2 = verts_loop[BM_elem_index_get(l_next)];
408
409 BMVert *v_src_l1 = l->v;
410 BMVert *v_src_l2 = l_next->v;
411
412 const int i_1 = BM_elem_index_get(v_src_l1);
413 const int i_2 = BM_elem_index_get(v_src_l2);
414
415 BMVert *v_neg1 = verts_neg[i_1];
416 BMVert *v_neg2 = verts_neg[i_2];
417
418 BMVert *v_pos1 = verts_pos[i_1];
419 BMVert *v_pos2 = verts_pos[i_2];
420
421 f_new = BM_face_create_quad_tri(bm, v_l1, v_l2, v_neg2, v_neg1, f_src, BM_CREATE_NOP);
422 if (mat_offset) {
423 f_new->mat_nr = std::clamp(f_new->mat_nr + mat_offset, 0, mat_max);
424 }
426 l_new = BM_FACE_FIRST_LOOP(f_new);
427
428 BM_elem_attrs_copy(bm, l, l_new);
429 BM_elem_attrs_copy(bm, l, l_new->prev);
430 BM_elem_attrs_copy(bm, l_next, l_new->next);
431 BM_elem_attrs_copy(bm, l_next, l_new->next->next);
432
433 f_new = BM_face_create_quad_tri(bm, v_l2, v_l1, v_pos1, v_pos2, f_src, BM_CREATE_NOP);
434
435 if (mat_offset) {
436 f_new->mat_nr = std::clamp(f_new->mat_nr + mat_offset, 0, mat_max);
437 }
439 l_new = BM_FACE_FIRST_LOOP(f_new);
440
441 BM_elem_attrs_copy(bm, l_next, l_new);
442 BM_elem_attrs_copy(bm, l_next, l_new->prev);
443 BM_elem_attrs_copy(bm, l, l_new->next);
444 BM_elem_attrs_copy(bm, l, l_new->next->next);
445
446 if (use_boundary) {
448 /* we know its a boundary and this is the only face user (which is being wire'd) */
449 /* we know we only touch this edge/face once */
450 BMVert *v_b1 = verts_boundary[i_1];
451 BMVert *v_b2 = verts_boundary[i_2];
452
453 f_new = BM_face_create_quad_tri(bm, v_b2, v_b1, v_neg1, v_neg2, f_src, BM_CREATE_NOP);
454 if (mat_offset) {
455 f_new->mat_nr = std::clamp(f_new->mat_nr + mat_offset, 0, mat_max);
456 }
458 l_new = BM_FACE_FIRST_LOOP(f_new);
459
460 BM_elem_attrs_copy(bm, l_next, l_new);
461 BM_elem_attrs_copy(bm, l_next, l_new->prev);
462 BM_elem_attrs_copy(bm, l, l_new->next);
463 BM_elem_attrs_copy(bm, l, l_new->next->next);
464
465 f_new = BM_face_create_quad_tri(bm, v_b1, v_b2, v_pos2, v_pos1, f_src, BM_CREATE_NOP);
466 if (mat_offset) {
467 f_new->mat_nr = std::clamp(f_new->mat_nr + mat_offset, 0, mat_max);
468 }
470 l_new = BM_FACE_FIRST_LOOP(f_new);
471
472 BM_elem_attrs_copy(bm, l, l_new);
473 BM_elem_attrs_copy(bm, l, l_new->prev);
474 BM_elem_attrs_copy(bm, l_next, l_new->next);
475 BM_elem_attrs_copy(bm, l_next, l_new->next->next);
476
477 if (use_crease) {
478 BMEdge *e_new;
479 e_new = BM_edge_exists(v_pos1, v_b1);
480 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
481
482 e_new = BM_edge_exists(v_pos2, v_b2);
483 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
484
485 e_new = BM_edge_exists(v_neg1, v_b1);
486 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
487
488 e_new = BM_edge_exists(v_neg2, v_b2);
489 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
490 }
491 }
492 }
493
494 if (use_crease) {
495 BMEdge *e_new;
496 e_new = BM_edge_exists(v_pos1, v_l1);
497 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
498
499 e_new = BM_edge_exists(v_pos2, v_l2);
500 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
501
502 e_new = BM_edge_exists(v_neg1, v_l1);
503 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
504
505 e_new = BM_edge_exists(v_neg2, v_l2);
506 BM_ELEM_CD_SET_FLOAT(e_new, cd_edge_crease_offset, crease_weight);
507 }
508 }
509 }
510
511 if (use_boundary) {
512 MEM_freeN(verts_boundary);
513 }
514
515 if (verts_relfac) {
516 MEM_freeN(verts_relfac);
517 }
518
519 if (use_replace) {
520
521 if (use_tag) {
522/* only remove faces which are original and used to make wire,
523 * use 'verts_pos' and 'verts_neg' to avoid a feedback loop. */
524
525/* vertex must be from 'verts_src' */
526#define VERT_DUPE_TEST_ORIG(v) (verts_neg[BM_elem_index_get(v)] != nullptr)
527#define VERT_DUPE_TEST(v) (verts_pos[BM_elem_index_get(v)] != nullptr)
528#define VERT_DUPE_CLEAR(v) \
529 { \
530 verts_pos[BM_elem_index_get(v)] = nullptr; \
531 } \
532 (void)0
533
534 /* first ensure we keep all verts which are used in faces that weren't
535 * entirely made into wire. */
536 BM_ITER_MESH (f_src, &iter, bm, BM_FACES_OF_MESH) {
537 int mix_flag = 0;
538 BMLoop *l_iter, *l_first;
539
540 /* skip new faces */
541 if (BM_elem_index_get(f_src) == -1) {
542 continue;
543 }
544
545 l_iter = l_first = BM_FACE_FIRST_LOOP(f_src);
546 do {
547 mix_flag |= (VERT_DUPE_TEST_ORIG(l_iter->v) ? 1 : 2);
548 if (mix_flag == (1 | 2)) {
549 break;
550 }
551 } while ((l_iter = l_iter->next) != l_first);
552
553 if (mix_flag == (1 | 2)) {
554 l_iter = l_first = BM_FACE_FIRST_LOOP(f_src);
555 do {
556 VERT_DUPE_CLEAR(l_iter->v);
557 } while ((l_iter = l_iter->next) != l_first);
558 }
559 }
560
561 /* now remove any verts which were made into wire by all faces */
562 for (i = 0; i < totvert_orig; i++) {
563 v_src = verts_src[i];
564 BLI_assert(i == BM_elem_index_get(v_src));
565 if (VERT_DUPE_TEST(v_src)) {
566 BM_vert_kill(bm, v_src);
567 }
568 }
569
570#undef VERT_DUPE_TEST_ORIG
571#undef VERT_DUPE_TEST
572#undef VERT_DUPE_CLEAR
573 }
574 else {
575 /* simple case, no tags - replace all */
576 for (i = 0; i < totvert_orig; i++) {
577 BM_vert_kill(bm, verts_src[i]);
578 }
579 }
580 }
581
582 MEM_freeN(verts_src);
583 MEM_freeN(verts_neg);
584 MEM_freeN(verts_pos);
585 MEM_freeN(verts_loop);
586}
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset(const CustomData *data, eCustomDataType type)
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
support for deformation groups and hooks.
float BKE_defvert_find_weight(const MDeformVert *dvert, int defgroup)
Definition deform.cc:774
#define BLI_assert(a)
Definition BLI_assert.h:46
#define M_PI
MINLINE float shell_angle_to_dist(float angle)
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v3(float r[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
@ CD_PROP_FLOAT
@ CD_MDEFORMVERT
Read Guarded memory(de)allocation.
#define BM_ELEM_CD_SET_FLOAT(ele, offset, f)
#define BM_FACE_FIRST_LOOP(p)
@ BM_ELEM_TAG
@ BM_LOOP
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
BMFace * BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, const BMFace *f_example, const eBMCreateFlag create_flag)
Make Quad/Triangle.
void BM_vert_kill(BMesh *bm, BMVert *v)
BMVert * BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, const eBMCreateFlag create_flag)
Main function for creating a new vertex.
Definition bmesh_core.cc:41
@ BM_CREATE_NOP
Definition bmesh_core.hh:28
#define BM_elem_index_get(ele)
#define BM_elem_flag_disable(ele, hflag)
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_enable(ele, hflag)
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const StringRef name)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
@ BM_VERTS_OF_MESH
@ BM_FACES_OF_MESH
@ BM_EDGES_OF_VERT
@ BM_LOOPS_OF_FACE
BMesh * bm
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
#define BM_FACE
#define BM_VERT
float BM_vert_calc_median_tagged_edge_length(const BMVert *v)
void BM_loop_calc_face_tangent(const BMLoop *l, float r_tangent[3])
BM_loop_calc_face_tangent.
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
float BM_loop_calc_face_angle(const BMLoop *l)
void BM_edge_calc_face_tangent(const BMEdge *e, const BMLoop *e_loop, float r_tangent[3])
BMESH EDGE/FACE TANGENT.
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
ATTR_WARN_UNUSED_RESULT const BMVert * v
static BMLoop * bm_edge_tag_faceloop(BMEdge *e)
void BM_mesh_wireframe(BMesh *bm, const float offset, const float offset_fac, const float offset_fac_vg, const bool use_replace, const bool use_boundary, const bool use_even_offset, const bool use_relative_offset, const bool use_crease, const float crease_weight, const int defgrp_index, const bool defgrp_invert, const short mat_offset, const int mat_max, const bool use_tag)
#define VERT_DUPE_CLEAR(v)
#define VERT_DUPE_TEST(v)
static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3], BMVert **r_va_other, BMVert **r_vb_other)
#define VERT_DUPE_TEST_ORIG(v)
static bool bm_loop_is_radial_boundary(BMLoop *l_first)
void * MEM_mallocN(size_t len, const char *str)
Definition mallocn.cc:128
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:133
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
short mat_nr
float no[3]
struct BMVert * v
struct BMLoop * radial_next
struct BMLoop * prev
struct BMFace * f
struct BMLoop * next
float co[3]
float no[3]
i
Definition text_draw.cc:230