diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-03 23:57:24 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-03 23:57:24 +0400 |
commit | 2a1ba8c85bd21d0eac3d348b162347da3b2171e2 (patch) | |
tree | 3a7a9e39a49cfc6f82e6410a4dc4a9ab505e7485 /source/blender/bmesh/intern | |
parent | dfb3e41cf91cce23a1d42efbfc2846de2db10000 (diff) |
style cleanup: formatting and some float/double promotion
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_construct.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.c | 35 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 12 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh_validate.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 2 |
7 files changed, 31 insertions, 34 deletions
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index c2d5d93cbc3..0169caa8f61 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -384,7 +384,7 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int totv, int n /* more of a weight then a distance */ far_cross_dist = (/* first we want to have a value close to zero mapped to 1 */ - 1.0 - fabsf(dot_v3v3(far_vec, far_cross_vec)) * + 1.0f - fabsf(dot_v3v3(far_vec, far_cross_vec)) * /* second we multiply by the distance * so points close to the center are not preferred */ diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index c774880332b..f64b55193c5 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -78,7 +78,7 @@ void BM_data_interp_from_verts(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v, con src[0] = v1->head.data; src[1] = v2->head.data; - w[0] = 1.0f-fac; + w[0] = 1.0f - fac; w[1] = fac; CustomData_bmesh_interp(&bm->vdata, src, w, NULL, 2, v->head.data); } @@ -198,20 +198,11 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *target, BMFace *source) static int compute_mdisp_quad(BMLoop *l, float v1[3], float v2[3], float v3[3], float v4[3], float e1[3], float e2[3]) { - float cent[3] = {0.0f, 0.0f, 0.0f}, n[3], p[3]; - BMLoop *l_first; - BMLoop *l_iter; - + float cent[3], n[3], p[3]; + /* computer center */ - l_iter = l_first = BM_FACE_FIRST_LOOP(l->f); - do { - cent[0] += (float)l_iter->v->co[0]; - cent[1] += (float)l_iter->v->co[1]; - cent[2] += (float)l_iter->v->co[2]; - } while ((l_iter = l_iter->next) != l_first); - - mul_v3_fl(cent, (1.0 / (float)l->f->len)); - + BM_face_calc_center_mean(l->f, cent); + add_v3_v3v3(p, l->prev->v->co, l->v->co); mul_v3_fl(p, 0.5); add_v3_v3v3(n, l->next->v->co, l->v->co); @@ -240,8 +231,8 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int if (fabsf(2.0f * (x - y + z)) > FLT_EPSILON * 10.0f) { float f2; - f1 = (sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z)); - f2 = (-sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z)); + f1 = ( sqrtf(y * y - 4.0f * x * z) - y + 2.0f * z) / (2.0f * (x - y + z)); + f2 = (-sqrtf(y * y - 4.0f * x * z) - y + 2.0f * z) / (2.0f * (x - y + z)); f1 = fabsf(f1); f2 = fabsf(f2); @@ -252,7 +243,7 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int f1 = -z / (y - 2 * z); CLAMP(f1, 0.0f, 1.0f + FLT_EPSILON); - if (isnan(f1) || f1 > 1.0 || f1 < 0.0f) { + if (isnan(f1) || f1 > 1.0f || f1 < 0.0f) { int i; for (i = 0; i < 2; i++) { @@ -345,8 +336,8 @@ static int mdisp_in_mdispquad(BMLoop *l, BMLoop *tl, float p[3], float *x, float sub_v3_v3(v1, c); sub_v3_v3(v2, c); sub_v3_v3(v3, c); sub_v3_v3(v4, c); - mul_v3_fl(v1, 1.0 + eps); mul_v3_fl(v2, 1.0 + eps); - mul_v3_fl(v3, 1.0 + eps); mul_v3_fl(v4, 1.0 + eps); + mul_v3_fl(v1, 1.0f + eps); mul_v3_fl(v2, 1.0f + eps); + mul_v3_fl(v3, 1.0f + eps); mul_v3_fl(v4, 1.0f + eps); add_v3_v3(v1, c); add_v3_v3(v2, c); add_v3_v3(v3, c); add_v3_v3(v4, c); @@ -392,9 +383,9 @@ static void bm_loop_flip_disp(float source_axis_x[3], float source_axis_y[3], d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 0, 1); - if (fabsf(d) < 1e-4) { + if (fabsf(d) < 1e-4f) { d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 0, 2); - if (fabsf(d) < 1e-4) + if (fabsf(d) < 1e-4f) d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 1, 2); } @@ -439,7 +430,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source) mdisp_axis_from_quad(v1, v2, v3, v4, axis_x, axis_y); res = (int)sqrt(mdisps->totdisp); - d = 1.0 / (float)(res - 1); + d = 1.0f / (float)(res - 1); for (x = 0.0f, ix = 0; ix < res; x += d, ix++) { for (y = 0.0f, iy = 0; iy < res; y += d, iy++) { float co1[3], co2[3], co[3]; diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index cb66486cd9e..fe94983dc88 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -47,10 +47,14 @@ BMAllocTemplate bm_mesh_chunksize_default = {512, 1024, 2048, 512}; static void bm_mempool_init(BMesh *bm, const BMAllocTemplate *allocsize) { - bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize->totvert, bm_mesh_chunksize_default.totvert, BLI_MEMPOOL_ALLOW_ITER); - bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize->totedge, bm_mesh_chunksize_default.totedge, BLI_MEMPOOL_ALLOW_ITER); - bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize->totloop, bm_mesh_chunksize_default.totloop, 0); - bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize->totface, bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER); + bm->vpool = BLI_mempool_create(sizeof(BMVert), allocsize->totvert, + bm_mesh_chunksize_default.totvert, BLI_MEMPOOL_ALLOW_ITER); + bm->epool = BLI_mempool_create(sizeof(BMEdge), allocsize->totedge, + bm_mesh_chunksize_default.totedge, BLI_MEMPOOL_ALLOW_ITER); + bm->lpool = BLI_mempool_create(sizeof(BMLoop), allocsize->totloop, + bm_mesh_chunksize_default.totloop, 0); + bm->fpool = BLI_mempool_create(sizeof(BMFace), allocsize->totface, + bm_mesh_chunksize_default.totface, BLI_MEMPOOL_ALLOW_ITER); #ifdef USE_BMESH_HOLES bm->looplistpool = BLI_mempool_create(sizeof(BMLoopList), allocsize[3], allocsize[3], FALSE, FALSE); diff --git a/source/blender/bmesh/intern/bmesh_mesh_validate.c b/source/blender/bmesh/intern/bmesh_mesh_validate.c index 3ec3b84c120..8ab5f10361f 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_validate.c +++ b/source/blender/bmesh/intern/bmesh_mesh_validate.c @@ -107,10 +107,12 @@ int BM_mesh_validate(BMesh *bm) ERRMSG("edge %d: has invalid loop, loop is of face %d", i, BM_elem_index_get(l_iter->f)); } else if (BM_vert_in_edge(e, l_iter->v) == FALSE) { - ERRMSG("edge %d: has invalid loop with vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f)); + ERRMSG("edge %d: has invalid loop with vert not in edge, loop is of face %d", + i, BM_elem_index_get(l_iter->f)); } else if (BM_vert_in_edge(e, l_iter->next->v) == FALSE) { - ERRMSG("edge %d: has invalid loop with next vert not in edge, loop is of face %d", i, BM_elem_index_get(l_iter->f)); + ERRMSG("edge %d: has invalid loop with next vert not in edge, loop is of face %d", + i, BM_elem_index_get(l_iter->f)); } } while ((l_iter = l_iter->radial_next) != l_first); } diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 5f3836cc413..c4cbb19eef7 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -1053,7 +1053,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_ /* first create the new edge, this is so we can copy the customdata from the old one * if splice if disabled, always add in a new edge even if theres one there. */ - e_new = BM_edge_create(bm, v1, v2, e, (check_flag & BM_EDGEROT_CHECK_SPLICE)!=0); + e_new = BM_edge_create(bm, v1, v2, e, (check_flag & BM_EDGEROT_CHECK_SPLICE) != 0); f_hflag_prev_1 = l1->f->head.hflag; f_hflag_prev_2 = l2->f->head.hflag; diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index dce491efe72..97347f841c8 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -1054,7 +1054,7 @@ static void bmo_flag_layer_alloc(BMesh *bm) BM_elem_index_set(ele, i); /* set_inline */ } - bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE); + bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE); BLI_mempool_destroy(oldpool); } @@ -1099,7 +1099,7 @@ static void bmo_flag_layer_free(BMesh *bm) BM_elem_index_set(ele, i); /* set_inline */ } - bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE); + bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE); BLI_mempool_destroy(oldpool); } @@ -1128,7 +1128,7 @@ static void bmo_flag_layer_clear(BMesh *bm) BM_elem_index_set(ele, i); /* set_inline */ } - bm->elem_index_dirty &= ~(BM_VERT|BM_EDGE|BM_FACE); + bm->elem_index_dirty &= ~(BM_VERT | BM_EDGE | BM_FACE); } void *BMO_slot_buffer_elem_first(BMOperator *op, const char *slotname) diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index e9a35ff70a2..8628ed7f9a1 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -900,7 +900,7 @@ float BM_vert_calc_edge_angle(BMVert *v) BMVert *v1 = BM_edge_other_vert(e1, v); BMVert *v2 = BM_edge_other_vert(e2, v); - return M_PI - angle_v3v3v3(v1->co, v->co, v2->co); + return (float)M_PI - angle_v3v3v3(v1->co, v->co, v2->co); } else { return DEG2RADF(90.0f); |