39 const float merge_factor)
54 }
while ((
void)(el_b = el_b->
next), (el_a = el_a->
next));
95 }
while ((
void)(el_b = el_b->
next ? el_b->
next : el_b_first),
96 (el_a = el_a->
next) && (
len < len_max));
110 float len_best = FLT_MAX;
112 for (; el_b; el_b = el_b->
next) {
114 if (
len < len_best) {
131 }
while ((l_iter = l_iter->
next) != l_first);
142 const bool use_merge,
143 const float merge_factor,
144 const int twist_offset)
146 const float eps = 0.00001f;
149 int el_store_a_len, el_store_b_len;
150 bool el_store_b_free =
false;
153 const bool use_edgeout =
true;
158 if (el_store_a_len < el_store_b_len) {
159 SWAP(
int, el_store_a_len, el_store_b_len);
164 BLI_assert((el_store_a_len == el_store_b_len));
167 if (el_store_a_len != el_store_b_len) {
184 float dir_a_orig[3], dir_b_orig[3];
185 float dir_a[3], dir_b[3];
186 const float *test_a, *test_b;
224 if (
dot_v3v3(test_a, test_b) < 0.0f) {
244 else if ((dot_a < 0.0f) != (dot_b < 0.0f)) {
249 if (use_merge ==
false) {
263 int winding_votes[2] = {0, 0};
265 for (i = 0; i < 2; i++, winding_dir = -winding_dir) {
272 winding_votes[i] += ((
e->l->v == el->
data) ? winding_dir : -winding_dir);
278 if (winding_votes[0] || winding_votes[1]) {
279 bool flip[2] = {
false,
false};
284 if (winding_votes[0] < 0) {
286 winding_votes[0] *= -1;
290 if (winding_votes[1] < 0) {
292 winding_votes[1] *= -1;
297 if ((winding_votes[0] + winding_votes[1]) < 0) {
303 winding_votes[0] *= -1;
304 winding_votes[1] *= -1;
318 if (el_store_a_len > el_store_b_len) {
321 el_store_b_free =
true;
328 if (twist_offset != 0) {
353 BMVert *v_a, *v_b, *v_a_next, *v_b_next;
365 el_a_next = el_a->
next;
366 el_b_next = el_b->
next;
367 if (
ELEM(
NULL, el_a_next, el_b_next)) {
374 v_a_next = el_a_next->
data;
375 v_b_next = el_b_next->
data;
378 if (v_b != v_b_next) {
388 if (l_a && l_a_next ==
NULL) {
391 if (l_a_next && l_a ==
NULL) {
402 if (v_b != v_b_next) {
403 BMVert *v_arr[4] = {v_b, v_b_next, v_a_next, v_a};
413 l_iter = l_iter->
next;
417 l_iter = l_iter->
next;
421 l_iter = l_iter->
next;
428 BMVert *v_arr[3] = {v_b, v_a_next, v_a};
438 l_iter = l_iter->
next;
442 l_iter = l_iter->
next;
449 if (f_example && (f_example != f)) {
460 if (el_a_next == el_a_first) {
469 if (el_store_a_len != el_store_b_len) {
493 for (i = 0; i < 2; i++) {
503 "beautify_fill faces=%hf edges=ae use_restrict_tag=%b method=%i",
535 if (use_edgeout && use_merge ==
false) {
539 for (i = 0; i < 2; i++) {
553 if (el_store_b_free) {
570 bool changed =
false;
583 if (use_pairs && (
count % 2)) {
592 for (el_store = eloops.
first; el_store; el_store = el_store->
next) {
612 for (el_store = eloops.
first; el_store; el_store = el_store->
next) {
615 if (el_store_next ==
NULL) {
616 if (use_cyclic && (
count > 2)) {
617 el_store_next = eloops.
first;
631 el_store = el_store->
next;
640 if (use_merge ==
false) {
void BLI_listbase_rotate_first(struct ListBase *lb, void *vlink) ATTR_NONNULL(1
void void * BLI_rfindlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int mod_i(int i, int n)
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
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])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
#define BM_FACE_FIRST_LOOP(p)
void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src, void *ele_dst)
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)
BMEdgeLoopStore * BM_edgeloop_copy(BMEdgeLoopStore *el_store)
const float * BM_edgeloop_center_get(struct BMEdgeLoopStore *el_store)
void BM_edgeloop_expand(BMesh *bm, BMEdgeLoopStore *el_store, int el_store_len, bool split, GSet *split_edges)
void BM_mesh_edgeloops_free(ListBase *eloops)
void BM_edgeloop_free(BMEdgeLoopStore *el_store)
int BM_mesh_edgeloops_find(BMesh *bm, ListBase *r_eloops, bool(*test_fn)(BMEdge *, void *user_data), void *user_data)
int BM_edgeloop_length_get(BMEdgeLoopStore *el_store)
void BM_mesh_edgeloops_calc_order(BMesh *UNUSED(bm), ListBase *eloops, const bool use_normals)
bool BM_edgeloop_is_closed(BMEdgeLoopStore *el_store)
ListBase * BM_edgeloop_verts_get(BMEdgeLoopStore *el_store)
bool BM_edgeloop_calc_normal(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
bool BM_edgeloop_calc_normal_aligned(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store, const float no_align[3])
const float * BM_edgeloop_normal_get(struct BMEdgeLoopStore *el_store)
void BM_edgeloop_flip(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
void BM_mesh_edgeloops_calc_normal(BMesh *bm, ListBase *eloops)
void BM_mesh_edgeloops_calc_center(BMesh *bm, ListBase *eloops)
#define BM_EDGELINK_NEXT(el_store, elink)
@ BMERR_INVALID_SELECTION
void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg)
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_flag_enable(ele, hflag)
void BM_data_interp_from_verts(BMesh *bm, const BMVert *v_src_1, const BMVert *v_src_2, BMVert *v_dst, const float fac)
Data, Interp From Verts.
void * BM_iter_at_index(BMesh *bm, const char itype, void *data, int index)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char htype, const char hflag, const bool do_flush)
BMO_FLAG_BUFFER.
void BMO_slot_buffer_flag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char htype, const short oflag)
BMO_FLAG_BUFFER.
#define BMO_edge_flag_test(bm, e, oflag)
#define BMO_edge_flag_enable(bm, e, oflag)
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void BMO_op_exec(BMesh *bm, BMOperator *op)
BMESH OPSTACK EXEC OP.
bool BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt,...)
#define BMO_face_flag_enable(bm, e, oflag)
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void BMO_op_finish(BMesh *bm, BMOperator *op)
BMESH OPSTACK FINISH OP.
BMOpSlot * BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
BMESH OPSTACK GET SLOT.
#define BMO_edge_flag_disable(bm, e, oflag)
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char htype, const short oflag)
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname)
BMESH OPSTACK INIT OP.
BLI_INLINE void BMO_slot_map_elem_insert(BMOperator *op, BMOpSlot *slot, const void *element, void *val)
void BM_face_normal_update(BMFace *f)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
BMFace * BM_face_exists(BMVert **varr, int len)
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
static void bm_bridge_splice_loops(BMesh *bm, LinkData *el_a, LinkData *el_b, const float merge_factor)
void bmo_bridge_loops_exec(BMesh *bm, BMOperator *op)
static void bm_bridge_best_rotation(struct BMEdgeLoopStore *el_store_a, struct BMEdgeLoopStore *el_store_b)
static void bridge_loop_pair(BMesh *bm, struct BMEdgeLoopStore *el_store_a, struct BMEdgeLoopStore *el_store_b, const bool use_merge, const float merge_factor, const int twist_offset)
static void bm_vert_loop_pair(BMesh *bm, BMVert *v1, BMVert *v2, BMLoop **l1, BMLoop **l2)
static float bm_edgeloop_offset_length(LinkData *el_a, LinkData *el_b, LinkData *el_b_first, const float len_max)
static bool bm_edge_test_cb(BMEdge *e, void *bm_v)
static void bm_face_edges_tag_out(BMesh *bm, BMFace *f)
static double op_sub(double a, double b)
struct BMEdgeLoopStore * next
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]