diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-20 19:54:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-20 20:02:21 +0400 |
commit | 55d75f5020ebdbaeb9cab1c7be565c83ba722bc2 (patch) | |
tree | 0798082991ace83f32f4d6c77b24629badf67ac4 /source/blender/editors | |
parent | 1a1bc281e64624d1a6b798f8dd84dda134f0f45a (diff) |
Code cleanup: correct abs use
also minor cleanup to rotation code
Diffstat (limited to 'source/blender/editors')
4 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index b18b21bd682..0cca1dd1689 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -1684,7 +1684,7 @@ static RetargetMode detectArcRetargetMode(RigArc *iarc) if (nb_edges > 2) { for (edge = iarc->edges.first; edge; edge = edge->next) { - if (fabs(edge->angle - avg_angle) > M_PI / 6) { + if (fabsf(edge->angle - avg_angle) > (float)(M_PI / 6)) { large_angle = 1; } } @@ -1795,7 +1795,7 @@ static float costLength(float original_length, float current_length, float lengt return MAX_COST; } else { - float length_ratio = fabs((current_length - original_length) / original_length); + float length_ratio = fabsf((current_length - original_length) / original_length); return length_weight * length_ratio * length_ratio; } } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 5f0ff4a1cfd..fcb2e6ad588 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4193,7 +4193,9 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, /* change of sign, we passed the 180 degree threshold. This means we need to add a turn. * to distinguish between transition from 0 to -1 and -PI to +PI, use comparison with PI/2 */ - if (mouse_angle * cache->previous_vertex_rotation < 0 && fabs(cache->previous_vertex_rotation) > M_PI_2) { + if ((mouse_angle * cache->previous_vertex_rotation < 0.0f) && + (fabsf(cache->previous_vertex_rotation) > (float)M_PI_2)) + { if (cache->previous_vertex_rotation < 0) cache->num_vertex_turns--; else diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index d9bc40b6555..6ca67aa91c8 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1302,7 +1302,7 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base, /* draw the circle/square representing spotbl */ if (la->type == LA_SPOT) { - float spotblcirc = fabs(z) * (1 - pow(la->spotblend, 2)); + float spotblcirc = fabsf(z) * (1.0f - powf(la->spotblend, 2)); /* hide line if it is zero size or overlaps with outer border, * previously it adjusted to always to show it but that seems * confusing because it doesn't show the actual blend size */ diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 64de56206c2..5f22a201600 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -1886,7 +1886,7 @@ static PBool p_collapse_allowed_geometric(PEdge *edge, PEdge *pair) if (p_vert_interior(oldv)) { /* hlscm criterion: angular defect smaller than threshold */ - if (fabs(angulardefect) > (M_PI * 30.0 / 180.0)) + if (fabsf(angulardefect) > (float)(M_PI * 30.0 / 180.0)) return P_FALSE; } else { @@ -1952,7 +1952,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair) sub_v3_v3v3(tetrav3, co2, oldv->co); cross_v3_v3v3(c, tetrav2, tetrav3); - volumecost += fabs(dot_v3v3(edgevec, c) / 6.0f); + volumecost += fabsf(dot_v3v3(edgevec, c) / 6.0f); #if 0 shapecost += dot_v3v3(co1, keepv->co); |