66static uint erot_gsetutil_hash(
const void *ptr)
68 const EdRotState *e_state = (
const EdRotState *)ptr;
73static int erot_gsetutil_cmp(
const void *a,
const void *
b)
77 if (e_state_a->v_pair[0] < e_state_b->v_pair[0]) {
80 if (e_state_a->v_pair[0] > e_state_b->v_pair[0]) {
83 if (e_state_a->v_pair[1] < e_state_b->v_pair[1]) {
86 if (e_state_a->v_pair[1] > e_state_b->v_pair[1]) {
89 if (e_state_a->f_pair[0] < e_state_b->f_pair[0]) {
92 if (e_state_a->f_pair[0] > e_state_b->f_pair[0]) {
95 if (e_state_a->f_pair[1] < e_state_b->f_pair[1]) {
98 if (e_state_a->f_pair[1] > e_state_b->f_pair[1]) {
106#define EDGE_ORD(v0, v1) \
150 float no_a[3], no_b[3];
151 float angle_24, angle_13;
165 return angle_13 - angle_24;
181 const BMVert *v_a = v1, *v_b = v3;
187 if (v1 == v3) [[unlikely]] {
209 v3 =
e->l->radial_next->prev->v;
221 return ((
index >= 0) && (
index < edge_array_len) && (
e == edge_array[
index]));
230 const BMEdge **edge_array,
231 const int edge_array_len,
240 if (eheap_table[i]) {
242 eheap_table[i] =
nullptr;
251 if (e_state_set.
contains(e_state_alt)) {
263 eheap_table[i] =
nullptr;
274 const BMEdge **edge_array,
275 const int edge_array_len,
285 e->l->radial_next->next->
e,
286 e->l->radial_next->prev->
e,
289 BLI_assert(
e->l->f->len == 3 &&
e->l->radial_next->f->len == 3);
293 for (i = 0; i < 4; i++) {
295 e_arr[i], eheap, eheap_table, edge_state_arr, edge_array, edge_array_len, flag, method);
304 const int edge_array_len,
307 const short oflag_edge,
308 const short oflag_face)
325 for (i = 0; i < edge_array_len; i++) {
332 eheap_table[i] =
nullptr;
342 eheap_table[i] =
nullptr;
359 e_state_set.
add(*e_state);
372 (
const BMEdge **)edge_array,
390 MEM_delete(eheap_table);
#define BLI_ghashutil_inthash_v4(key)
A min-heap / priority queue ADT.
Platform independent time functions.
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
Read Blender memory allocation and freeing.
#define BM_elem_index_get(ele)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BMO_edge_flag_enable(bm, e, oflag)
#define BMO_face_flag_enable(bm, e, oflag)
#define BM_edge_face_count_is_equal(e, n)
bool contains(const Key &key) const
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void void bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1)
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
unsigned __int64 uint64_t
Heap * BLI_heap_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT
static void erot_state_ex(const BMEdge *e, int v_index[2], int f_index[2])
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void void BLI_heap_remove(Heap *heap, HeapNode *node) ATTR_NONNULL(1
static void bm_edge_update_beauty_cost(BMEdge *e, Heap *eheap, HeapNode **eheap_table, const Span< Set< EdRotState > > edge_state_arr, const BMEdge **edge_array, const int edge_array_len, const short flag, const short method)
float BM_verts_calc_rotate_beauty(const BMVert *v1, const BMVert *v2, const BMVert *v3, const BMVert *v4, const short flag, const short method)
void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
@ BM_EDGEROT_CHECK_EXISTS
BLI_INLINE bool edge_in_array(const BMEdge *e, const BMEdge **edge_array, const int edge_array_len)
BLI_INLINE bool BM_vert_in_edge(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void * BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1)
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
VecBase< int32_t, 2 > int2
BMEdge * BM_edge_rotate(BMesh *bm, BMEdge *e, const bool ccw, const short check_flag)
Rotate Edge.
static void bm_edge_update_beauty_cost_single(BMEdge *e, Heap *eheap, HeapNode **eheap_table, const Span< Set< EdRotState > > edge_state_arr, const BMEdge **edge_array, const int edge_array_len, const short flag, const short method)
float BLI_polyfill_edge_calc_rotate_beauty__area(const float v1[3], const float v2[3], const float v3[3], const float v4[3], bool lock_degenerate)
static float bm_edge_calc_rotate_beauty(const BMEdge *e, const short flag, const short method)
static void erot_state_alternate(const BMEdge *e, EdRotState *e_state)
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
HeapNode * BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1)
static float bm_edge_calc_rotate_beauty__angle(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
@ EDGE_RESTRICT_DEGENERATE
static void erot_state_current(const BMEdge *e, EdRotState *e_state)
void BM_mesh_beautify_fill(BMesh *bm, BMEdge **edge_array, const int edge_array_len, const short flag, const short method, const short oflag_edge, const short oflag_face)
constexpr uint64_t get_default_hash(const T &v, const Args &...args)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
friend bool operator==(const EdRotState &a, const EdRotState &b)=default