diff options
Diffstat (limited to 'source/blender/bmesh/tools/BME_bevel.c')
-rw-r--r-- | source/blender/bmesh/tools/BME_bevel.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index a357767e1d8..e03df77a290 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -234,7 +234,8 @@ static int BME_bevel_get_vec(float *vec, BMVert *v1, BMVert *v2, BME_TransData_H * vec2 is the direction of projection (pointing away from vec1) * up_vec is used for orientation (expected to be normalized) * returns the length of the projected vector that lies along vec1 */ -static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int is_forward, BME_TransData_Head *UNUSED(td)) +static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, + int is_forward, BME_TransData_Head *UNUSED(td)) { float factor, vec3[3], tmp[3], c1, c2; @@ -264,7 +265,8 @@ static float BME_bevel_project_vec(float *vec1, float *vec2, float *up_vec, int * using the vert and the loop passed, get or make the split vert, set its coordinates * and transform properties, and set the max limits. * Finally, return the split vert. */ -static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, float *up_vec, float value, BME_TransData_Head *td) +static BMVert *BME_bevel_split_edge(BMesh *bm, BMVert *v, BMVert *v1, BMLoop *l, + float *up_vec, float value, BME_TransData_Head *td) { BME_TransData *vtd, *vtd1, *vtd2; BMVert *sv, *v2, *v3, *ov; @@ -496,7 +498,8 @@ static BMVert *BME_bevel_wire(BMesh *bm, BMVert *v, float value, int res, int UN } #endif -static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) +static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(options), + float *up_vec, BME_TransData_Head *td) { BMVert *v1, *v2, *kv; BMLoop *kl = NULL, *nl; @@ -617,7 +620,8 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti return l; } -static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(options), float *up_vec, BME_TransData_Head *td) +static BMLoop *BME_bevel_vert(BMesh *bm, BMLoop *l, float value, int UNUSED(options), + float up_vec[3], BME_TransData_Head *td) { BMVert *v1, *v2; /* BMFace *f; */ /* UNUSED */ @@ -810,7 +814,7 @@ static float BME_bevel_get_angle_vert(BMVert *v) } /* return cosf(angle_diff + 0.001f); */ /* compare with dot product */ - return (angle_diff / tot_angle) * (M_PI / 2); + return (angle_diff / tot_angle) * (float)(M_PI / 2.0); } static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v, float weight, float factor, int options) @@ -894,7 +898,7 @@ static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_ int count; float weight; BMIter iter; - const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001) : 0.0f; + const float threshold = (options & BME_BEVEL_ANGLE) ? cosf(angle + 0.001f) : 0.0f; BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) { weight = 0.0f; @@ -945,7 +949,8 @@ static void bevel_init_edges(BMesh *bm, int options, float angle, BME_TransData_ } } -static BMesh *BME_bevel_initialize(BMesh *bm, int options, int UNUSED(defgrp_index), float angle, BME_TransData_Head *td) +static BMesh *BME_bevel_initialize(BMesh *bm, int options, + int UNUSED(defgrp_index), float angle, BME_TransData_Head *td) { BMVert *v /*, *v2 */; BMEdge *e /*, *curedg */; @@ -1037,7 +1042,8 @@ static BMesh *BME_bevel_reinitialize(BMesh *bm) * A BMesh pointer to the BM passed as a parameter. */ -static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int options, int UNUSED(defgrp_index), BME_TransData_Head *td) +static BMesh *BME_bevel_mesh(BMesh *bm, float value, int UNUSED(res), int options, + int UNUSED(defgrp_index), BME_TransData_Head *td) { BMVert *v; BMEdge *e, *curedge; @@ -1102,14 +1108,14 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i BME_TransData_Head *td; BME_TransData *vtd; int i; - double fac = 1, d; + double fac = 1.0, d; td = BME_init_transdata(BLI_MEMARENA_STD_BUFSIZE); /* recursion math courtesy of Martin Poirier (theeth) */ for (i = 0; i < res - 1; i++) { - if (i == 0) fac += 1.0f / 3.0f; else fac += 1.0f / (3 * i * 2.0f); + if (i == 0) fac += 1.0 / 3.0; else fac += 1.0 / (3.0 * i * 2.0); } - d = 1.0f / fac; + d = 1.0 / fac; for (i = 0; i < res || (res == 0 && i == 0); i++) { BMO_push(bm, NULL); @@ -1143,7 +1149,7 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i else { d = value; } - madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor * d); + madd_v3_v3v3fl(v->co, vtd->org, vtd->vec, vtd->factor * (float)d); } } |