57static uint erot_gsetutil_hash(
const void *
ptr)
64static int erot_gsetutil_cmp(
const void *a,
const void *
b)
101#define EDGE_ORD(v0, v1) \
142 const bool lock_degenerate)
146 float v1_xy[2], v2_xy[2], v3_xy[2], v4_xy[2];
150 const float eps = 1
e-5;
151 float no_a[3], no_b[3];
153 float axis_mat[3][3];
160 (
ELEM(v3, v1,
v2, v4) ==
false) && (
ELEM(v4, v1,
v2, v3) ==
false));
202 v1_xy, v2_xy, v3_xy, v4_xy, lock_degenerate,
nullptr);
215 float no_a[3], no_b[3];
216 float angle_24, angle_13;
230 return angle_13 - angle_24;
246 const BMVert *v_a = v1, *v_b = v3;
274 v3 =
e->l->radial_next->prev->v;
286 return ((index >= 0) && (index < edge_array_len) && (
e == edge_array[index]));
293 GSet **edge_state_arr,
295 const BMEdge **edge_array,
296 const int edge_array_len,
303 GSet *e_state_set = edge_state_arr[i];
305 if (eheap_table[i]) {
307 eheap_table[i] =
nullptr;
314 if (e_state_set !=
nullptr) {
330 eheap_table[i] =
nullptr;
340 GSet **edge_state_arr,
341 const BMEdge **edge_array,
342 const int edge_array_len,
352 e->l->radial_next->next->
e,
353 e->l->radial_next->prev->
e,
356 BLI_assert(
e->l->f->len == 3 &&
e->l->radial_next->f->len == 3);
360 for (i = 0; i < 4; i++) {
362 e_arr[i], eheap, eheap_table, edge_state_arr, edge_array, edge_array_len,
flag, method);
371 const int edge_array_len,
374 const short oflag_edge,
375 const short oflag_face)
380 GSet **edge_state_arr =
static_cast<GSet **
>(
390 eheap_table =
static_cast<HeapNode **
>(
394 for (i = 0; i < edge_array_len; i++) {
401 eheap_table[i] =
nullptr;
411 eheap_table[i] =
nullptr;
420 GSet *e_state_set = edge_state_arr[i];
427 if (
UNLIKELY(e_state_set ==
nullptr)) {
444 (
const BMEdge **)edge_array,
464 for (i = 0; i < edge_array_len; i++) {
465 if (edge_state_arr[i]) {
bool BLI_gset_haskey(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT
#define BLI_ghashutil_inthash_v4_cmp
#define BLI_ghashutil_inthash_v4(key)
void BLI_gset_insert(GSet *gs, void *key)
GSet * BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
#define BLI_ghashutil_inthash_v4_p
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
A min-heap / priority queue ADT.
void BLI_heap_free(Heap *heap, HeapFreeFP ptrfreefp) ATTR_NONNULL(1)
Heap * BLI_heap_new_ex(unsigned int reserve_num) ATTR_WARN_UNUSED_RESULT
void void bool BLI_heap_is_empty(const Heap *heap) ATTR_NONNULL(1)
void * BLI_heap_pop_min(Heap *heap) ATTR_NONNULL(1)
HeapNode * BLI_heap_insert(Heap *heap, float value, void *ptr) ATTR_NONNULL(1)
void void BLI_heap_remove(Heap *heap, HeapNode *node) ATTR_NONNULL(1
MINLINE int signum_i_ex(float a, float eps)
MINLINE float cross_tri_v2(const float v1[2], const float v2[2], const float v3[2])
void cross_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.
float normal_tri_v3(float n[3], const float v1[3], const float v2[3], const float v3[3])
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3(float n[3])
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
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 BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
float BLI_polyfill_beautify_quad_rotate_calc_ex(const float v1[2], const float v2[2], const float v3[2], const float v4[2], bool lock_degenerate, float *r_area)
Platform independent time functions.
Utility defines for timing/benchmarks.
#define TIMEIT_START(var)
Read Guarded memory(de)allocation.
static void erot_state_alternate(const BMEdge *e, EdRotState *e_state)
BLI_INLINE bool edge_in_array(const BMEdge *e, const BMEdge **edge_array, const int edge_array_len)
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)
float BM_verts_calc_rotate_beauty(const BMVert *v1, const BMVert *v2, const BMVert *v3, const BMVert *v4, const short flag, const short method)
static void erot_state_current(const BMEdge *e, EdRotState *e_state)
static void bm_edge_update_beauty_cost_single(BMEdge *e, Heap *eheap, HeapNode **eheap_table, GSet **edge_state_arr, const BMEdge **edge_array, const int edge_array_len, const short flag, const short method)
static float bm_edge_calc_rotate_beauty__angle(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
static void erot_state_ex(const BMEdge *e, int v_index[2], int f_index[2])
static GSet * erot_gset_new()
static void bm_edge_update_beauty_cost(BMEdge *e, Heap *eheap, HeapNode **eheap_table, GSet **edge_state_arr, const BMEdge **edge_array, const int edge_array_len, const short flag, const short method)
static float bm_edge_calc_rotate_beauty__area(const float v1[3], const float v2[3], const float v3[3], const float v4[3], const bool lock_degenerate)
static float bm_edge_calc_rotate_beauty(const BMEdge *e, const short flag, const short method)
@ EDGE_RESTRICT_DEGENERATE
#define BM_elem_index_get(ele)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
ATTR_WARN_UNUSED_RESULT BMesh * bm
BMEdge * BM_edge_rotate(BMesh *bm, BMEdge *e, const bool ccw, const short check_flag)
Rotate Edge.
@ BM_EDGEROT_CHECK_EXISTS
#define BMO_edge_flag_enable(bm, e, oflag)
#define BMO_face_flag_enable(bm, e, oflag)
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define BM_edge_face_count_is_equal(e, n)
BLI_INLINE bool BM_vert_in_edge(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
local_group_size(16, 16) .push_constant(Type b
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)