20 #define FACE_FLAG (1 << 0)
21 #define FACE_FLIP (1 << 1)
22 #define FACE_TEMP (1 << 2)
65 const float eps = FLT_EPSILON;
66 float cent_area_accum = 0.0f;
68 const float cent_fac = 1.0f / (
float)faces_len;
99 for (i = 0; i < faces_len; i++) {
104 cent_area_accum += f_area;
110 if (cent_area_accum != 0.0f) {
117 best.edge_dot = best.loop_dot = -FLT_MAX;
130 for (i = 0; i < faces_len; i++) {
135 bool is_best_dist_sq;
139 is_best_dist_sq = (test.dist_sq > best.dist_sq);
140 if (is_best_dist_sq || (test.dist_sq == best.dist_sq)) {
141 float edge_dir_pair[2][3];
148 bool is_best_edge_dot;
150 is_best_edge_dot = (test.edge_dot > best.edge_dot);
151 if (is_best_dist_sq || is_best_edge_dot || (test.edge_dot == best.edge_dot)) {
161 loop_dir_dot =
dot_v3v3(dir, loop_dir);
162 test.loop_dot =
fabsf(loop_dir_dot);
163 if (is_best_dist_sq || is_best_edge_dot || (test.loop_dot > best.loop_dot)) {
166 is_flip = (loop_dir_dot < 0.0f);
172 }
while ((l_iter = l_iter->
next) != l_first);
175 *r_is_flip = is_flip;
176 return f_start_index;
193 int i, f_start_index;
231 }
while ((l_iter = l_iter->
next) != l_first);
237 for (i = 0; i < faces_len; i++) {
259 int(*group_index)[2];
268 for (i = 0; i < group_tot; i++) {
269 const int fg_sta = group_index[i][0];
270 const int fg_len = group_index[i][1];
272 bool is_calc =
false;
274 for (j = 0; j < fg_len; j++) {
277 if (is_calc ==
false) {
typedef float(TangentPoint)[2]
BLI_LINKSTACK_*** wrapper macros for using a LinkNode to store a stack of pointers,...
#define BLI_LINKSTACK_PUSH(var, ptr)
#define BLI_LINKSTACK_DECLARE(var, type)
#define BLI_LINKSTACK_FREE(var)
#define BLI_LINKSTACK_INIT(var)
#define BLI_LINKSTACK_POP(var)
MINLINE float max_ff(float a, float b)
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3(float r[3])
MINLINE void zero_v3(float r[3])
#define UNUSED_VARS_NDEBUG(...)
Read Guarded memory(de)allocation.
#define BM_FACE_FIRST_LOOP(p)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
BLI_INLINE BMFace * BM_face_at_index(BMesh *bm, const int index)
void BMO_slot_buffer_flag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, short oflag)
BMO_FLAG_BUFFER.
#define BMO_face_flag_test_bool(bm, e, oflag)
#define BMO_face_flag_enable(bm, e, oflag)
#define BMO_face_flag_set(bm, e, oflag, val)
#define BMO_face_flag_disable(bm, e, oflag)
#define BMO_face_flag_test(bm, e, oflag)
ATTR_WARN_UNUSED_RESULT const BMFlagLayer const short oflag
void BM_face_normal_flip(BMesh *bm, BMFace *f)
float BM_face_calc_area(const BMFace *f)
void BM_face_calc_center_median_weighted(const BMFace *f, float r_cent[3])
int BM_mesh_calc_face_groups(BMesh *bm, int *r_groups_array, int(**r_group_index)[2], BMLoopFilterFunc filter_fn, BMLoopPairFilterFunc filter_pair_fn, void *user_data, const char hflag_test, const char htype_step)
bool BM_face_is_normal_valid(const BMFace *f)
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
static bool bmo_recalc_normal_loop_filter_cb(const BMLoop *l, void *UNUSED(user_data))
static int recalc_face_normals_find_index(BMesh *bm, BMFace **faces, const int faces_len, bool *r_is_flip)
static void bmo_recalc_face_normals_array(BMesh *bm, BMFace **faces, const int faces_len, const short oflag)
void bmo_recalc_face_normals_exec(BMesh *bm, BMOperator *op)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
struct BMLoop * radial_next
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]