static void erot_state_ex(const BMEdge *e, int v_index[2], int f_index[2]) { BLI_assert(BM_edge_is_manifold(e)); BLI_assert(BM_vert_in_edge(e, e->l->prev->v) == false); BLI_assert(BM_vert_in_edge(e, e->l->radial_next->prev->v) == false); /* verts of the edge */ v_index[0] = BM_elem_index_get(e->v1); v_index[1] = BM_elem_index_get(e->v2); EDGE_ORD(v_index[0], v_index[1]); /* verts of each of the 2 faces attached to this edge * (that are not apart of this edge) */ f_index[0] = BM_elem_index_get(e->l->prev->v); f_index[1] = BM_elem_index_get(e->l->radial_next->prev->v); EDGE_ORD(f_index[0], f_index[1]); }
/* recalc an edge in the heap (surrounding geometry has changed) */ static void bm_edge_update_beauty_cost_single( BMEdge *e, Heap *eheap, HeapNode **eheap_table, GSet **edge_state_arr, /* only for testing the edge is in the array */ const BMEdge **edge_array, const int edge_array_len, const short flag, const short method) { if (edge_in_array(e, edge_array, edge_array_len)) { const int i = BM_elem_index_get(e); GSet *e_state_set = edge_state_arr[i]; if (eheap_table[i]) { BLI_heap_remove(eheap, eheap_table[i]); eheap_table[i] = NULL; } /* check if we can add it back */ BLI_assert(BM_edge_is_manifold(e) == true); /* check we're not moving back into a state we have been in before */ if (e_state_set != NULL) { EdRotState e_state_alt; erot_state_alternate(e, &e_state_alt); if (BLI_gset_haskey(e_state_set, (void *)&e_state_alt)) { // printf(" skipping, we already have this state\n"); return; } } { /* recalculate edge */ const float cost = bm_edge_calc_rotate_beauty(e, flag, method); if (cost < 0.0f) { eheap_table[i] = BLI_heap_insert(eheap, cost, e); } else { eheap_table[i] = NULL; } } } }
static bool bmo_recalc_normal_loop_filter_cb(const BMLoop *l, void *UNUSED(user_data)) { return BM_edge_is_manifold(l->e); }