Cleanup: naming (mean -> median) see T47811

This commit is contained in:
Campbell Barton 2018-12-14 10:54:11 +11:00
parent e961c1244c
commit 6e2d9ef2db
Notes: blender-bot 2023-02-14 05:51:15 +01:00
Referenced by issue #57773, New 2.79 builds from Master freezes when opening a 2.79b file and then Creating a New File
24 changed files with 59 additions and 59 deletions

View File

@ -154,12 +154,12 @@ static void emDM_ensurePolyCenters(EditDerivedBMesh *bmdm)
BM_mesh_elem_index_ensure(bm, BM_VERT);
BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) {
BM_face_calc_center_mean_vcos(bm, efa, polyCos[i], vertexCos);
BM_face_calc_center_median_vcos(bm, efa, polyCos[i], vertexCos);
}
}
else {
BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) {
BM_face_calc_center_mean(efa, polyCos[i]);
BM_face_calc_center_median(efa, polyCos[i]);
}
}

View File

@ -1332,9 +1332,9 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
float f_center[3];
float (*faces_center)[3] = BLI_array_alloca(faces_center, totface);
BM_face_calc_center_mean(f_new, f_center);
BM_face_calc_center_median(f_new, f_center);
for (i = 0; i < totface; i++) {
BM_face_calc_center_mean(faces[i], faces_center[i]);
BM_face_calc_center_median(faces[i], faces_center[i]);
}
l_iter = l_first = BM_FACE_FIRST_LOOP(f_new);

View File

@ -253,7 +253,7 @@ static int compute_mdisp_quad(
{
float cent[3];
/* computer center */
BM_face_calc_center_mean(l->f, cent);
BM_face_calc_center_median(l->f, cent);
BLI_assert(equals_v3v3(cent, l_f_center));
}
#endif
@ -527,8 +527,8 @@ void BM_loop_interp_multires(BMesh *bm, BMLoop *l_dst, const BMFace *f_src)
float f_dst_center[3];
float f_src_center[3];
BM_face_calc_center_mean(l_dst->f, f_dst_center);
BM_face_calc_center_mean(f_src, f_src_center);
BM_face_calc_center_median(l_dst->f, f_dst_center);
BM_face_calc_center_median(f_src, f_src_center);
BM_loop_interp_multires_ex(bm, l_dst, f_src, f_dst_center, f_src_center, cd_loop_mdisp_offset);
}
@ -555,8 +555,8 @@ void BM_face_interp_multires(BMesh *bm, BMFace *f_dst, const BMFace *f_src)
float f_dst_center[3];
float f_src_center[3];
BM_face_calc_center_mean(f_dst, f_dst_center);
BM_face_calc_center_mean(f_src, f_src_center);
BM_face_calc_center_median(f_dst, f_dst_center);
BM_face_calc_center_median(f_src, f_src_center);
BM_face_interp_multires_ex(bm, f_dst, f_src, f_dst_center, f_src_center, cd_loop_mdisp_offset);
}

View File

@ -828,7 +828,7 @@ void BM_editselection_center(BMEditSelection *ese, float r_center[3])
}
else if (ese->htype == BM_FACE) {
BMFace *efa = (BMFace *)ese->ele;
BM_face_calc_center_mean(efa, r_center);
BM_face_calc_center_median(efa, r_center);
}
}

View File

@ -299,12 +299,12 @@ BMFace *BM_face_split(
float f_dst_center[3];
float f_src_center[3];
BM_face_calc_center_mean(f_tmp, f_src_center);
BM_face_calc_center_median(f_tmp, f_src_center);
BM_face_calc_center_mean(f, f_dst_center);
BM_face_calc_center_median(f, f_dst_center);
BM_face_interp_multires_ex(bm, f, f_tmp, f_dst_center, f_src_center, cd_loop_mdisp_offset);
BM_face_calc_center_mean(f_new, f_dst_center);
BM_face_calc_center_median(f_new, f_dst_center);
BM_face_interp_multires_ex(bm, f_new, f_tmp, f_dst_center, f_src_center, cd_loop_mdisp_offset);
#if 0
@ -642,7 +642,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
for (i = 0; i < BLI_array_len(oldfaces); i++) {
float f_center_old[3];
BM_face_calc_center_mean(oldfaces[i], f_center_old);
BM_face_calc_center_median(oldfaces[i], f_center_old);
for (j = 0; j < 2; j++) {
BMEdge *e1 = j ? e_new : e;
@ -660,7 +660,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float fac)
if (BM_ELEM_API_FLAG_TEST(l->f, _FLAG_OVERLAP)) {
float f_center[3];
BM_face_calc_center_mean(l->f, f_center);
BM_face_calc_center_median(l->f, f_center);
BM_face_interp_multires_ex(
bm, l->f, oldfaces[i],
f_center, f_center_old, cd_loop_mdisp_offset);

View File

@ -108,7 +108,7 @@ static float bm_face_calc_poly_normal_vertex_cos(
/**
* \brief COMPUTE POLY CENTER (BMFace)
*/
static void bm_face_calc_poly_center_mean_vertex_cos(
static void bm_face_calc_poly_center_median_vertex_cos(
const BMFace *f, float r_cent[3],
float const (*vertexCos)[3])
{
@ -585,7 +585,7 @@ void BM_face_calc_center_bounds(const BMFace *f, float r_cent[3])
/**
* computes the center of a face, using the mean average
*/
void BM_face_calc_center_mean(const BMFace *f, float r_cent[3])
void BM_face_calc_center_median(const BMFace *f, float r_cent[3])
{
const BMLoop *l_iter, *l_first;
@ -602,7 +602,7 @@ void BM_face_calc_center_mean(const BMFace *f, float r_cent[3])
* computes the center of a face, using the mean average
* weighted by edge length
*/
void BM_face_calc_center_mean_weighted(const BMFace *f, float r_cent[3])
void BM_face_calc_center_median_weighted(const BMFace *f, float r_cent[3])
{
const BMLoop *l_iter;
const BMLoop *l_first;
@ -880,7 +880,7 @@ float BM_face_calc_normal_subset(const BMLoop *l_first, const BMLoop *l_last, fl
}
/* exact same as 'BM_face_calc_normal' but accepts vertex coords */
void BM_face_calc_center_mean_vcos(
void BM_face_calc_center_median_vcos(
const BMesh *bm, const BMFace *f, float r_cent[3],
float const (*vertexCos)[3])
{
@ -888,7 +888,7 @@ void BM_face_calc_center_mean_vcos(
BLI_assert((bm->elem_index_dirty & BM_VERT) == 0);
(void)bm;
bm_face_calc_poly_center_mean_vertex_cos(f, r_cent, vertexCos);
bm_face_calc_poly_center_median_vertex_cos(f, r_cent, vertexCos);
}
/**
@ -1103,7 +1103,7 @@ void BM_face_triangulate(
}
if (cd_loop_mdisp_offset != -1) {
BM_face_calc_center_mean(f, f_center);
BM_face_calc_center_median(f, f_center);
}
/* loop over calculated triangles and create new geometry */
@ -1175,7 +1175,7 @@ void BM_face_triangulate(
if (cd_loop_mdisp_offset != -1) {
float f_new_center[3];
BM_face_calc_center_mean(f_new, f_new_center);
BM_face_calc_center_median(f_new, f_new_center);
BM_face_interp_multires_ex(bm, f_new, f, f_new_center, f_center, cd_loop_mdisp_offset);
}
}

View File

@ -53,11 +53,11 @@ void BM_face_calc_tangent_edge_diagonal(const BMFace *f, float r_plane[3]) ATTR
void BM_face_calc_tangent_vert_diagonal(const BMFace *f, float r_plane[3]) ATTR_NONNULL();
void BM_face_calc_tangent_auto(const BMFace *f, float r_plane[3]) ATTR_NONNULL();
void BM_face_calc_center_bounds(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_mean(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_mean_vcos(
void BM_face_calc_center_median(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_median_vcos(
const BMesh *bm, const BMFace *f, float r_cent[3],
float const (*vertexCos)[3]) ATTR_NONNULL();
void BM_face_calc_center_mean_weighted(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_center_median_weighted(const BMFace *f, float center[3]) ATTR_NONNULL();
void BM_face_calc_bounds_expand(const BMFace *f, float min[3], float max[3]);

View File

@ -1860,7 +1860,7 @@ float BM_vert_calc_shell_factor_ex(const BMVert *v, const float no[3], const cha
* \note quite an obscure function.
* used in bmesh operators that have a relative scale options,
*/
float BM_vert_calc_mean_tagged_edge_length(const BMVert *v)
float BM_vert_calc_median_tagged_edge_length(const BMVert *v)
{
BMIter iter;
BMEdge *e;

View File

@ -132,7 +132,7 @@ float BM_vert_calc_edge_angle(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NO
float BM_vert_calc_edge_angle_ex(const BMVert *v, const float fallback) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_vert_calc_shell_factor(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_vert_calc_shell_factor_ex(const BMVert *v, const float no[3], const char hflag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_vert_calc_mean_tagged_edge_length(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
float BM_vert_calc_median_tagged_edge_length(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMLoop *BM_face_find_shortest_loop(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
BMLoop *BM_face_find_longest_loop(BMFace *f) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();

View File

@ -107,7 +107,7 @@ static int recalc_face_normals_find_index(BMesh *bm, BMFace **faces, const int f
for (i = 0; i < faces_len; i++) {
float f_cent[3];
const float f_area = BM_face_calc_area(faces[i]);
BM_face_calc_center_mean_weighted(faces[i], f_cent);
BM_face_calc_center_median_weighted(faces[i], f_cent);
madd_v3_v3fl(cent, f_cent, cent_fac * f_area);
cent_area_accum += f_area;

View File

@ -67,7 +67,7 @@ void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
continue;
}
BM_face_calc_center_mean_weighted(f, faces_center[i]);
BM_face_calc_center_median_weighted(f, faces_center[i]);
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
@ -101,7 +101,7 @@ void bmo_planar_faces_exec(BMesh *bm, BMOperator *op)
/* keep original face data (else we 'move' the face) */
#if 0
BM_face_normal_update(f);
BM_face_calc_center_mean_weighted(f, f_center);
BM_face_calc_center_median_weighted(f, f_center);
#endif
plane_from_point_normal_v3(plane, faces_center[i], f->no);

View File

@ -58,13 +58,13 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
switch (center_mode) {
case BMOP_POKE_MEAN_WEIGHTED:
bm_face_calc_center_fn = BM_face_calc_center_mean_weighted;
bm_face_calc_center_fn = BM_face_calc_center_median_weighted;
break;
case BMOP_POKE_BOUNDS:
bm_face_calc_center_fn = BM_face_calc_center_bounds;
break;
case BMOP_POKE_MEAN:
bm_face_calc_center_fn = BM_face_calc_center_mean;
bm_face_calc_center_fn = BM_face_calc_center_median;
break;
default:
BLI_assert(0);
@ -94,7 +94,7 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
copy_v3_v3(f_center_mean, f_center);
}
else {
BM_face_calc_center_mean(f, f_center_mean);
BM_face_calc_center_median(f, f_center_mean);
}
}
@ -132,7 +132,7 @@ void bmo_poke_exec(BMesh *bm, BMOperator *op)
if (cd_loop_mdisp_offset != -1) {
float f_new_center[3];
BM_face_calc_center_mean(f_new, f_new_center);
BM_face_calc_center_median(f_new, f_new_center);
BM_face_interp_multires_ex(bm, f_new, f, f_new_center, f_center, cd_loop_mdisp_offset);
}

View File

@ -155,7 +155,7 @@ void bmo_similar_faces_exec(BMesh *bm, BMOperator *op)
case SIMFACE_COPLANAR:
/* compute the center of the polygon */
BM_face_calc_center_mean(f_ext[i].f, f_ext[i].c);
BM_face_calc_center_median(f_ext[i].f, f_ext[i].c);
/* compute the plane distance */
f_ext[i].d = dot_v3v3(f_ext[i].f->no, f_ext[i].c);

View File

@ -100,7 +100,7 @@ static void bm_decim_build_quadrics(BMesh *bm, Quadric *vquadrics)
double plane_db[4];
Quadric q;
BM_face_calc_center_mean(f, center);
BM_face_calc_center_median(f, center);
copy_v3db_v3fl(plane_db, f->no);
plane_db[3] = -dot_v3db_v3fl(plane_db, center);

View File

@ -1588,7 +1588,7 @@ bool BM_mesh_intersect(
BLI_assert(ELEM(side, 0, 1));
side = !side;
// BM_face_calc_center_mean(f, co);
// BM_face_calc_center_median(f, co);
BM_face_calc_point_in_face(f, co);
hits = isect_bvhtree_point_v3(tree_pair[side], looptri_coords, co);

View File

@ -215,7 +215,7 @@ static float edgetag_cut_cost_face(BMEdge *e_a, BMEdge *e_b, BMFace *f)
mid_v3_v3v3(e_a_cent, e_a->v1->co, e_a->v1->co);
mid_v3_v3v3(e_b_cent, e_b->v1->co, e_b->v1->co);
BM_face_calc_center_mean_weighted(f, f_cent);
BM_face_calc_center_median_weighted(f, f_cent);
return step_cost_3_v3(e_a_cent, e_b_cent, f_cent);
}
@ -380,8 +380,8 @@ static float facetag_cut_cost_edge(BMFace *f_a, BMFace *f_b, BMEdge *e, const vo
float f_b_cent[3];
float e_cent[3];
BM_face_calc_center_mean_weighted(f_a, f_a_cent);
BM_face_calc_center_mean_weighted(f_b, f_b_cent);
BM_face_calc_center_median_weighted(f_a, f_a_cent);
BM_face_calc_center_median_weighted(f_b, f_b_cent);
#if 0
mid_v3_v3v3(e_cent, e->v1->co, e->v2->co);
#else
@ -412,8 +412,8 @@ static float facetag_cut_cost_vert(BMFace *f_a, BMFace *f_b, BMVert *v, const vo
float f_a_cent[3];
float f_b_cent[3];
BM_face_calc_center_mean_weighted(f_a, f_a_cent);
BM_face_calc_center_mean_weighted(f_b, f_b_cent);
BM_face_calc_center_median_weighted(f_a, f_a_cent);
BM_face_calc_center_median_weighted(f_b, f_b_cent);
return step_cost_3_v3_ex(
f_a_cent, v->co, f_b_cent,

View File

@ -269,7 +269,7 @@ void BM_mesh_wireframe(
if (verts_relfac) {
if (use_relative_offset) {
verts_relfac[i] = BM_vert_calc_mean_tagged_edge_length(v_src);
verts_relfac[i] = BM_vert_calc_median_tagged_edge_length(v_src);
}
else {
verts_relfac[i] = 1.0f;
@ -315,7 +315,7 @@ void BM_mesh_wireframe(
verts_pos[i] = NULL;
}
/* conflicts with BM_vert_calc_mean_tagged_edge_length */
/* conflicts with BM_vert_calc_median_tagged_edge_length */
if (use_relative_offset == false) {
BM_elem_flag_disable(v_src, BM_ELEM_TAG);
}

View File

@ -1701,7 +1701,7 @@ static bool mouse_mesh_loop(bContext *C, const int mval[2], bool extend, bool de
float cent[3];
float co[2], tdist;
BM_face_calc_center_mean(f, cent);
BM_face_calc_center_median(f, cent);
if (ED_view3d_project_float_object(
vc.ar, cent, co, V3D_PROJ_TEST_CLIP_NEAR) == V3D_PROJ_RET_OK)
{

View File

@ -4981,7 +4981,7 @@ static void sort_bmelem_flag(
BM_ITER_MESH_INDEX (fa, &iter, em->bm, BM_FACES_OF_MESH, i) {
if (BM_elem_flag_test(fa, flag)) {
float co[3];
BM_face_calc_center_mean(fa, co);
BM_face_calc_center_median(fa, co);
mul_m4_v3(mat, co);
pb[i] = false;
@ -5049,7 +5049,7 @@ static void sort_bmelem_flag(
BM_ITER_MESH_INDEX (fa, &iter, em->bm, BM_FACES_OF_MESH, i) {
if (BM_elem_flag_test(fa, flag)) {
float co[3];
BM_face_calc_center_mean(fa, co);
BM_face_calc_center_median(fa, co);
pb[i] = false;
sb[affected[2]].org_idx = i;

View File

@ -3631,7 +3631,7 @@ static void draw_em_indices(BMEditMesh *em)
UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEAREA, col);
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
BM_face_calc_center_mean(f, pos);
BM_face_calc_center_median(f, pos);
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", i);
view3d_cached_text_draw_add(pos, numstr, numstr_len, 0, txt_flag, col);
}

View File

@ -5618,7 +5618,7 @@ static void slide_origdata_interp_data_vert(
BMLoop *l;
BM_ITER_ELEM_INDEX (l, &liter, sv->v, BM_LOOPS_OF_VERT, j) {
BM_face_calc_center_mean(l->f, faces_center[j]);
BM_face_calc_center_median(l->f, faces_center[j]);
}
BM_ITER_ELEM_INDEX (l, &liter, sv->v, BM_LOOPS_OF_VERT, j) {
@ -5628,7 +5628,7 @@ static void slide_origdata_interp_data_vert(
BMLoop *l_other;
int j_other;
BM_face_calc_center_mean(f_copy, f_copy_center);
BM_face_calc_center_median(f_copy, f_copy_center);
BM_ITER_ELEM_INDEX (l_other, &liter_other, sv->v, BM_LOOPS_OF_VERT, j_other) {
BM_face_interp_multires_ex(

View File

@ -889,7 +889,7 @@ static void uv_map_transform_calc_center_median(BMEditMesh *em, float r_center[3
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
float center[3];
BM_face_calc_center_mean(efa, center);
BM_face_calc_center_median(efa, center);
add_v3_v3(r_center, center);
center_accum_num += 1;
}

View File

@ -1217,7 +1217,7 @@ static BMFace *skin_hole_target_face(BMesh *bm, Frame *frame)
}
/* Nearest test */
BM_face_calc_center_mean(f, poly_center);
BM_face_calc_center_median(f, poly_center);
dist = len_v3v3(frame_center, poly_center);
if (dist < best_center_dist) {
center_target_face = f;

View File

@ -1877,7 +1877,7 @@ static PyObject *bpy_bmface_calc_tangent_vert_diagonal(BPy_BMFace *self)
}
PyDoc_STRVAR(bpy_bmface_calc_center_mean_doc,
PyDoc_STRVAR(bpy_bmface_calc_center_median_doc,
".. method:: calc_center_median()\n"
"\n"
" Return median center of the face.\n"
@ -1890,11 +1890,11 @@ static PyObject *bpy_bmface_calc_center_mean(BPy_BMFace *self)
float cent[3];
BPY_BM_CHECK_OBJ(self);
BM_face_calc_center_mean(self->f, cent);
BM_face_calc_center_median(self->f, cent);
return Vector_CreatePyObject(cent, 3, NULL);
}
PyDoc_STRVAR(bpy_bmface_calc_center_mean_weighted_doc,
PyDoc_STRVAR(bpy_bmface_calc_center_median_weighted_doc,
".. method:: calc_center_median_weighted()\n"
"\n"
" Return median center of the face weighted by edge lengths.\n"
@ -1902,12 +1902,12 @@ PyDoc_STRVAR(bpy_bmface_calc_center_mean_weighted_doc,
" :return: a 3D vector.\n"
" :rtype: :class:`mathutils.Vector`\n"
);
static PyObject *bpy_bmface_calc_center_mean_weighted(BPy_BMFace *self)
static PyObject *bpy_bmface_calc_center_median_weighted(BPy_BMFace *self)
{
float cent[3];
BPY_BM_CHECK_OBJ(self);
BM_face_calc_center_mean_weighted(self->f, cent);
BM_face_calc_center_median_weighted(self->f, cent);
return Vector_CreatePyObject(cent, 3, NULL);
}
@ -2781,8 +2781,8 @@ static struct PyMethodDef bpy_bmface_methods[] = {
{"calc_tangent_edge_pair", (PyCFunction)bpy_bmface_calc_tangent_edge_pair, METH_NOARGS, bpy_bmface_calc_tangent_edge_pair_doc},
{"calc_tangent_edge_diagonal", (PyCFunction)bpy_bmface_calc_tangent_edge_diagonal, METH_NOARGS, bpy_bmface_calc_tangent_edge_diagonal_doc},
{"calc_tangent_vert_diagonal", (PyCFunction)bpy_bmface_calc_tangent_vert_diagonal, METH_NOARGS, bpy_bmface_calc_tangent_vert_diagonal_doc},
{"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_mean_doc},
{"calc_center_median_weighted", (PyCFunction)bpy_bmface_calc_center_mean_weighted, METH_NOARGS, bpy_bmface_calc_center_mean_weighted_doc},
{"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_median_doc},
{"calc_center_median_weighted", (PyCFunction)bpy_bmface_calc_center_median_weighted, METH_NOARGS, bpy_bmface_calc_center_median_weighted_doc},
{"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc},
{"normal_update", (PyCFunction)bpy_bmface_normal_update, METH_NOARGS, bpy_bmface_normal_update_doc},