use fabsf when using floats.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 21 Jul 2012 15:27:40 +0000 (15:27 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 21 Jul 2012 15:27:40 +0000 (15:27 +0000)
26 files changed:
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/curve.c
source/blender/blenlib/intern/lasso.c
source/blender/blenlib/intern/math_geom.c
source/blender/blenlib/intern/math_rotation.c
source/blender/editors/interface/interface.c
source/blender/editors/mesh/meshtools.c
source/blender/editors/object/object_vgroup.c
source/blender/editors/sculpt_paint/paint_utils.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_fly.c
source/blender/editors/transform/transform_constraints.c
source/blender/editors/transform/transform_manipulator.c
source/blender/editors/transform/transform_snap.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/modifiers/intern/MOD_cast.c
source/blender/nodes/texture/nodes/node_texture_texture.c
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/render_texture.c
source/blender/render/intern/source/renderdatabase.c
source/blender/render/intern/source/shadbuf.c
source/blender/render/intern/source/strand.c
source/blender/render/intern/source/zbuf.c
source/gameengine/Ketsji/KX_GameObject.cpp
source/gameengine/Ketsji/KX_IpoActuator.cpp
source/gameengine/VideoTexture/ImageRender.cpp

index af6583fd7262f5e5ae6bbf2b4c7499345c1d5cbf..6a8ddd8e00aebcdfc3213bc2f5cab94860a927cb 100644 (file)
@@ -1438,9 +1438,9 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
                                                if (strip->flag & ACTSTRIP_CYCLIC_USEZ) pose->cyclic_offset[2] = time * min[2];
                                        }
                                        else {
-                                               if (fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2]))
+                                               if (fabsf(min[0]) >= fabsf(min[1]) && fabsf(min[0]) >= fabsf(min[2]))
                                                        pose->cyclic_offset[0] = time * min[0];
-                                               else if (fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2]))
+                                               else if (fabsf(min[1]) >= fabsf(min[0]) && fabsf(min[1]) >= fabsf(min[2]))
                                                        pose->cyclic_offset[1] = time * min[1];
                                                else
                                                        pose->cyclic_offset[2] = time * min[2];
index 31491a80f2b961d0885f848caa1966247b203285..e7dc825accd3ee0c382fb33c17ebb574aa0bcfc1 100644 (file)
@@ -1712,7 +1712,7 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
        y2 /= t02;
 
        t02 = x1 * x2 + y1 * y2;
-       if (fabs(t02) >= 1.0)
+       if (fabsf(t02) >= 1.0f)
                t02 = 0.5 * M_PI;
        else
                t02 = (saacos(t02)) / 2.0f;
@@ -2366,9 +2366,9 @@ void BKE_curve_bevelList_make(Object *ob)
                        bevp0 = bevp1 + (nr - 1);
                        nr--;
                        while (nr--) {
-                               if (fabs(bevp0->vec[0] - bevp1->vec[0]) < 0.00001) {
-                                       if (fabs(bevp0->vec[1] - bevp1->vec[1]) < 0.00001) {
-                                               if (fabs(bevp0->vec[2] - bevp1->vec[2]) < 0.00001) {
+                               if (fabsf(bevp0->vec[0] - bevp1->vec[0]) < 0.00001f) {
+                                       if (fabsf(bevp0->vec[1] - bevp1->vec[1]) < 0.00001f) {
+                                               if (fabsf(bevp0->vec[2] - bevp1->vec[2]) < 0.00001f) {
                                                        bevp0->dupe_tag = TRUE;
                                                        bl->dupe_nr++;
                                                }
index 29b967fcd370f8843cdbff35aa14814720bc597a..7df4da80e164228686b8a27f67cd6ee3551ea349 100644 (file)
@@ -95,7 +95,7 @@ int BLI_lasso_is_point_inside(int mcords[][2], short moves,
                p2 = mcords[a + 1];
        }
 
-       if (fabs(angletot) > 4.0) return 1;
+       if (fabsf(angletot) > 4.0f) return 1;
        return 0;
 }
 
index f2ea93282c93048b3a346fd5b20687be04155cc5..de665686ea6bb4fed115ac71063b7b2099c2f329 100644 (file)
@@ -583,17 +583,17 @@ static short IsectLLPt2Df(const float x0, const float y0, const float x1, const
         * compute slopes, note the cludge for infinity, however, this will
         * be close enough
         */
-       if (fabs(x1 - x0) > 0.000001f)
+       if (fabsf(x1 - x0) > 0.000001f)
                m1 = (y1 - y0) / (x1 - x0);
        else
                return -1; /*m1 = (float)1e+10;*/ /* close enough to infinity */
 
-       if (fabs(x3 - x2) > 0.000001f)
+       if (fabsf(x3 - x2) > 0.000001f)
                m2 = (y3 - y2) / (x3 - x2);
        else
                return -1; /*m2 = (float)1e+10;*/ /* close enough to infinity */
 
-       if (fabs(m1 - m2) < 0.000001f)
+       if (fabsf(m1 - m2) < 0.000001f)
                return -1;  /* parallel lines */
 
        /* compute constants */
index ab5601fc2dc84fcb84f55b1b0bbbbacb8c130721..6dca708a048b9fc1a00e41416055fb91be0ca8f7 100644 (file)
@@ -453,7 +453,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
                nor[1] = -z2;
                nor[2] = y2;
 
-               if (fabs(y2) + fabs(z2) < 0.0001)
+               if (fabsf(y2) + fabsf(z2) < 0.0001f)
                        nor[1] = 1.0;
 
                co = x2;
@@ -463,7 +463,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
                nor[1] = 0.0;
                nor[2] = -x2;
 
-               if (fabs(x2) + fabs(z2) < 0.0001)
+               if (fabsf(x2) + fabsf(z2) < 0.0001f)
                        nor[2] = 1.0;
 
                co = y2;
@@ -473,7 +473,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
                nor[1] = x2;
                nor[2] = 0.0;
 
-               if (fabs(x2) + fabs(y2) < 0.0001)
+               if (fabsf(x2) + fabsf(y2) < 0.0001f)
                        nor[0] = 1.0;
 
                co = z2;
@@ -696,7 +696,7 @@ void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
        *angle = ha * 2;
 
        /* prevent division by zero for axis conversion */
-       if (fabs(si) < 0.0005)
+       if (fabsf(si) < 0.0005f)
                si = 1.0f;
 
        axis[0] = q[1] / si;
@@ -998,7 +998,7 @@ void mat3_to_eul(float *eul, float tmat[][3])
        mat3_to_eul2(tmat, eul1, eul2);
 
        /* return best, which is just the one with lowest values it in */
-       if (fabs(eul1[0]) + fabs(eul1[1]) + fabs(eul1[2]) > fabs(eul2[0]) + fabs(eul2[1]) + fabs(eul2[2])) {
+       if (fabsf(eul1[0]) + fabsf(eul1[1]) + fabsf(eul1[2]) > fabsf(eul2[0]) + fabsf(eul2[1]) + fabsf(eul2[2])) {
                copy_v3_v3(eul, eul2);
        }
        else {
@@ -1083,32 +1083,32 @@ void compatible_eul(float eul[3], const float oldrot[3])
        dy = eul[1] - oldrot[1];
        dz = eul[2] - oldrot[2];
 
-       while (fabs(dx) > 5.1) {
+       while (fabsf(dx) > 5.1f) {
                if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
                else eul[0] += 2.0f * (float)M_PI;
                dx = eul[0] - oldrot[0];
        }
-       while (fabs(dy) > 5.1) {
+       while (fabsf(dy) > 5.1f) {
                if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
                else eul[1] += 2.0f * (float)M_PI;
                dy = eul[1] - oldrot[1];
        }
-       while (fabs(dz) > 5.1) {
+       while (fabsf(dz) > 5.1f) {
                if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
                else eul[2] += 2.0f * (float)M_PI;
                dz = eul[2] - oldrot[2];
        }
 
        /* is 1 of the axis rotations larger than 180 degrees and the other small? NO ELSE IF!! */
-       if (fabs(dx) > 3.2 && fabs(dy) < 1.6 && fabs(dz) < 1.6) {
+       if (fabsf(dx) > 3.2f && fabsf(dy) < 1.6f && fabsf(dz) < 1.6f) {
                if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
                else eul[0] += 2.0f * (float)M_PI;
        }
-       if (fabs(dy) > 3.2 && fabs(dz) < 1.6 && fabs(dx) < 1.6) {
+       if (fabsf(dy) > 3.2f && fabsf(dz) < 1.6f && fabsf(dx) < 1.6f) {
                if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
                else eul[1] += 2.0f * (float)M_PI;
        }
-       if (fabs(dz) > 3.2 && fabs(dx) < 1.6 && fabs(dy) < 1.6) {
+       if (fabsf(dz) > 3.2f && fabsf(dx) < 1.6f && fabsf(dy) < 1.6f) {
                if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
                else eul[2] += 2.0f * (float)M_PI;
        }
@@ -1123,29 +1123,29 @@ void compatible_eul(float eul[3], const float oldrot[3])
 
        /* special case, tested for x-z  */
 
-       if ((fabs(dx) > 3.1 && fabs(dz) > 1.5) || (fabs(dx) > 1.5 && fabs(dz) > 3.1)) {
-               if (dx > 0.0) eul[0] -= M_PI;
+       if ((fabsf(dx) > 3.1f && fabsf(dz) > 1.5f) || (fabsf(dx) > 1.5f && fabsf(dz) > 3.1f)) {
+               if (dx > 0.0f) eul[0] -= M_PI;
                else eul[0] += M_PI;
                if (eul[1] > 0.0) eul[1] = M_PI - eul[1];
                else eul[1] = -M_PI - eul[1];
-               if (dz > 0.0) eul[2] -= M_PI;
+               if (dz > 0.0f) eul[2] -= M_PI;
                else eul[2] += M_PI;
 
        }
-       else if ((fabs(dx) > 3.1 && fabs(dy) > 1.5) || (fabs(dx) > 1.5 && fabs(dy) > 3.1)) {
-               if (dx > 0.0) eul[0] -= M_PI;
+       else if ((fabsf(dx) > 3.1f && fabsf(dy) > 1.5f) || (fabsf(dx) > 1.5f && fabsf(dy) > 3.1f)) {
+               if (dx > 0.0f) eul[0] -= M_PI;
                else eul[0] += M_PI;
-               if (dy > 0.0) eul[1] -= M_PI;
+               if (dy > 0.0f) eul[1] -= M_PI;
                else eul[1] += M_PI;
-               if (eul[2] > 0.0) eul[2] = M_PI - eul[2];
+               if (eul[2] > 0.0f) eul[2] = M_PI - eul[2];
                else eul[2] = -M_PI - eul[2];
        }
-       else if ((fabs(dy) > 3.1 && fabs(dz) > 1.5) || (fabs(dy) > 1.5 && fabs(dz) > 3.1)) {
-               if (eul[0] > 0.0) eul[0] = M_PI - eul[0];
+       else if ((fabsf(dy) > 3.1f && fabsf(dz) > 1.5f) || (fabsf(dy) > 1.5f && fabsf(dz) > 3.f1)) {
+               if (eul[0] > 0.0f) eul[0] = M_PI - eul[0];
                else eul[0] = -M_PI - eul[0];
-               if (dy > 0.0) eul[1] -= M_PI;
+               if (dy > 0.0f) eul[1] -= M_PI;
                else eul[1] += M_PI;
-               if (dz > 0.0) eul[2] -= M_PI;
+               if (dz > 0.0f) eul[2] -= M_PI;
                else eul[2] += M_PI;
        }
 #endif
@@ -1164,8 +1164,8 @@ void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[][3])
        compatible_eul(eul1, oldrot);
        compatible_eul(eul2, oldrot);
 
-       d1 = (float)fabs(eul1[0] - oldrot[0]) + (float)fabs(eul1[1] - oldrot[1]) + (float)fabs(eul1[2] - oldrot[2]);
-       d2 = (float)fabs(eul2[0] - oldrot[0]) + (float)fabs(eul2[1] - oldrot[1]) + (float)fabs(eul2[2] - oldrot[2]);
+       d1 = (float)fabsf(eul1[0] - oldrot[0]) + (float)fabsf(eul1[1] - oldrot[1]) + (float)fabsf(eul1[2] - oldrot[2]);
+       d2 = (float)fabsf(eul2[0] - oldrot[0]) + (float)fabsf(eul2[1] - oldrot[1]) + (float)fabsf(eul2[2] - oldrot[2]);
 
        /* return best, which is just the one with lowest difference */
        if (d1 > d2) {
@@ -1360,7 +1360,7 @@ void mat3_to_eulO(float eul[3], const short order, float M[3][3])
        mat3_to_eulo2(M, eul1, eul2, order);
 
        /* return best, which is just the one with lowest values it in */
-       if (fabs(eul1[0]) + fabs(eul1[1]) + fabs(eul1[2]) > fabs(eul2[0]) + fabs(eul2[1]) + fabs(eul2[2])) {
+       if (fabsf(eul1[0]) + fabsf(eul1[1]) + fabsf(eul1[2]) > fabsf(eul2[0]) + fabsf(eul2[1]) + fabsf(eul2[2])) {
                copy_v3_v3(eul, eul2);
        }
        else {
index 60f071f2ad2c48429bd7bc5b8adb33911db4ef6c..4ed547e92486a42abf9413fa033f24c6a7d3f561 100644 (file)
@@ -2134,7 +2134,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
 
                /* TODO - investigate why block->winmat[0][0] is negative
                 * in the image view when viewRedrawForce is called */
-               block->aspect = 2.0 / fabs( (getsizex) * block->winmat[0][0]);
+               block->aspect = 2.0f / fabsf(getsizex * block->winmat[0][0]);
        }
        else {
                /* no subwindow created yet, for menus for example, so we
@@ -2143,7 +2143,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
                wm_subwindow_getmatrix(window, window->screen->mainwin, block->winmat);
                wm_subwindow_getsize(window, window->screen->mainwin, &getsizex, &getsizey);
 
-               block->aspect = 2.0 / fabs(getsizex * block->winmat[0][0]);
+               block->aspect = 2.0f / fabsf(getsizex * block->winmat[0][0]);
                block->auto_open = TRUE;
                block->flag |= UI_BLOCK_LOOP; /* tag as menu */
        }
index 044c23092bd6aef01c92443f8e07ad05711586e1..2e75a779fedb5714c841c71e06b0fb55a76b755a 100644 (file)
@@ -1030,13 +1030,13 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float
                BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
                        uv_poly_center(em, efa, cent);
                        
-                       if ( (fabs(cent[0] - cent_vec[0]) < 0.001) && (fabs(cent[1] - cent_vec[1]) < 0.001) ) {
+                       if ( (fabsf(cent[0] - cent_vec[0]) < 0.001f) && (fabsf(cent[1] - cent_vec[1]) < 0.001f) ) {
                                BMIter liter;
                                BMLoop *l;
                                
                                BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                                        MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
-                                       if ( (fabs(luv->uv[0] - vec[0]) < 0.001) && (fabs(luv->uv[1] - vec[1]) < 0.001) ) {
+                                       if ( (fabsf(luv->uv[0] - vec[0]) < 0.001f) && (fabsf(luv->uv[1] - vec[1]) < 0.001f) ) {
                                                return luv->uv;
                                                                
                                        }
index 2e9652686da23b6d8aa7dedd25053b6432b4c289..11e98c970a0a9b3059caa3e28354fc200a80b283 100644 (file)
@@ -954,7 +954,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
                                        dist = dists[i];
                                }
                                else {
-                                       if (fabs(dist - distToBe) < fabs(dists[i] - distToBe)) {
+                                       if (fabsf(dist - distToBe) < fabsf(dists[i] - distToBe)) {
                                                upDown[i] = 0;
                                                changes[i][0] = vc;
                                                changes[i][1] = hc;
@@ -963,7 +963,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
                                        else {
                                                upDown[i] = 1;
                                        }
-                                       if (fabs(dists[i] - distToBe) > fabs(distToStart - distToBe)) {
+                                       if (fabsf(dists[i] - distToBe) > fabsf(distToStart - distToBe)) {
                                                changes[i][0] = 0;
                                                changes[i][1] = 0;
                                                dists[i] = distToStart;
@@ -979,7 +979,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
                        for (i = k + 1; i < totweight; i++) {
                                dist = dists[i];
 
-                               if (fabs(dist) > fabs(dists[i])) {
+                               if (fabsf(dist) > fabsf(dists[i])) {
                                        bestIndex = i;
                                }
                        }
@@ -1009,7 +1009,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
                bestIndex = -1;
                /* find the best change with an acceptable horizontal change */
                for (i = 0; i < totweight; i++) {
-                       if (fabs(changes[i][0]) > fabs(changes[i][1] * 2.0f)) {
+                       if (fabsf(changes[i][0]) > fabsf(changes[i][1] * 2.0f)) {
                                bestIndex = i;
                                break;
                        }
index 3c8f39a44b12a7d767abd2328912945cf2ddc09f..3f9e0051d2e0cfa171efef200381cc824f0596be 100644 (file)
@@ -287,7 +287,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
                                /* the triangle with the largest absolute values is the one
                                 * with the most negative weights */
                                imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[3].co, p, w);
-                               absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
+                               absw = fabsf(w[0]) + fabsf(w[1]) + fabsf(w[2]);
                                if (absw < minabsw) {
                                        uv[0] = tf->uv[0][0] * w[0] + tf->uv[1][0] * w[1] + tf->uv[3][0] * w[2];
                                        uv[1] = tf->uv[0][1] * w[0] + tf->uv[1][1] * w[1] + tf->uv[3][1] * w[2];
@@ -295,7 +295,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
                                }
 
                                imapaint_tri_weights(ob, mv[1].co, mv[2].co, mv[3].co, p, w);
-                               absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
+                               absw = fabsf(w[0]) + fabsf(w[1]) + fabsf(w[2]);
                                if (absw < minabsw) {
                                        uv[0] = tf->uv[1][0] * w[0] + tf->uv[2][0] * w[1] + tf->uv[3][0] * w[2];
                                        uv[1] = tf->uv[1][1] * w[0] + tf->uv[2][1] * w[1] + tf->uv[3][1] * w[2];
@@ -304,7 +304,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
                        }
                        else {
                                imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[2].co, p, w);
-                               absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
+                               absw = fabsf(w[0]) + fabsf(w[1]) + fabsf(w[2]);
                                if (absw < minabsw) {
                                        uv[0] = tf->uv[0][0] * w[0] + tf->uv[1][0] * w[1] + tf->uv[2][0] * w[2];
                                        uv[1] = tf->uv[0][1] * w[0] + tf->uv[1][1] * w[1] + tf->uv[2][1] * w[2];
index 8d5dbb51be75bb4d5908448697899a28ed557b4c..d20b0eb991f6873069769c94904150c608f1e75f 100644 (file)
@@ -6191,9 +6191,9 @@ static void get_local_bounds(Object *ob, float center[3], float size[3])
                copy_v3_v3(size, ob->size);
        }
        else {
-               size[0] = 0.5 * fabs(bb->vec[0][0] - bb->vec[4][0]);
-               size[1] = 0.5 * fabs(bb->vec[0][1] - bb->vec[2][1]);
-               size[2] = 0.5 * fabs(bb->vec[0][2] - bb->vec[1][2]);
+               size[0] = 0.5 * fabsf(bb->vec[0][0] - bb->vec[4][0]);
+               size[1] = 0.5 * fabsf(bb->vec[0][1] - bb->vec[2][1]);
+               size[2] = 0.5 * fabsf(bb->vec[0][2] - bb->vec[1][2]);
 
                center[0] = (bb->vec[0][0] + bb->vec[4][0]) / 2.0;
                center[1] = (bb->vec[0][1] + bb->vec[2][1]) / 2.0;
index 40837d00409da77fe9359eaf342731401b5fa738..15e32ea2de4eb3b4cf558f5b4ec2414206773a79 100644 (file)
@@ -333,8 +333,9 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event
        upvec[2] = 0.0f;
        copy_m3_m4(mat, fly->rv3d->viewinv);
        mul_m3_v3(mat, upvec);
-       if (fabs(upvec[2]) < 0.1)
+       if (fabsf(upvec[2]) < 0.1f) {
                fly->zlock = 1;
+       }
        upvec[0] = 0;
        upvec[1] = 0;
        upvec[2] = 0;
index 7c0d4f10186582a4e7f853e13361bf63e978cd4a..55110e48469a8c1c16db8bc0e408a85641b2496f 100644 (file)
@@ -288,7 +288,7 @@ static void planeProjection(TransInfo *t, float in[3], float out[3])
        sub_v3_v3v3(vec, out, in);
 
        factor = dot_v3v3(vec, norm);
-       if (fabs(factor) <= 0.001) {
+       if (fabsf(factor) <= 0.001f) {
                return; /* prevent divide by zero */
        }
        factor = dot_v3v3(vec, vec) / factor;
index 1507dbfddda50f107263a1347324f4cf3cf9409c..31250e3a50c71b64f6db6b97130b5959166e95e8 100644 (file)
@@ -607,7 +607,7 @@ static void test_manipulator_axis(const bContext *C)
 
        ED_view3d_global_to_vector(rv3d, rv3d->twmat[3], vec);
 
-       angle = fabs(angle_v3v3(rv3d->twmat[0], vec));
+       angle = fabsf(angle_v3v3(rv3d->twmat[0], vec));
        if (angle > (float)M_PI / 2.0f) {
                angle = (float)M_PI - angle;
        }
@@ -616,7 +616,7 @@ static void test_manipulator_axis(const bContext *C)
                rv3d->twdrawflag &= ~(MAN_TRANS_X | MAN_SCALE_X);
        }
 
-       angle = fabs(angle_v3v3(rv3d->twmat[1], vec));
+       angle = fabsf(angle_v3v3(rv3d->twmat[1], vec));
        if (angle > (float)M_PI / 2.0f) {
                angle = (float)M_PI - angle;
        }
@@ -625,7 +625,7 @@ static void test_manipulator_axis(const bContext *C)
                rv3d->twdrawflag &= ~(MAN_TRANS_Y | MAN_SCALE_Y);
        }
 
-       angle = fabs(angle_v3v3(rv3d->twmat[2], vec));
+       angle = fabsf(angle_v3v3(rv3d->twmat[2], vec));
        if (angle > (float)M_PI / 2.0f) {
                angle = (float)M_PI - angle;
        }
index 1286a520bb9fed6b7ecb38b3ecaafca3e3de59ab..0ea48e81029f7a0251fc4a85ec5e26287e8f9e7f 100644 (file)
@@ -1081,7 +1081,7 @@ static void TargetSnapClosest(TransInfo *t)
                                                
                                                dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
                                                
-                                               if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
+                                               if (closest == NULL || fabsf(dist) < fabsf(t->tsnap.dist)) {
                                                        copy_v3_v3(t->tsnap.snapTarget, loc);
                                                        closest = td;
                                                        t->tsnap.dist = dist; 
@@ -1097,7 +1097,7 @@ static void TargetSnapClosest(TransInfo *t)
                                        
                                        dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
                                        
-                                       if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
+                                       if (closest == NULL || fabsf(dist) < fabsf(t->tsnap.dist)) {
                                                copy_v3_v3(t->tsnap.snapTarget, loc);
                                                closest = td;
                                                t->tsnap.dist = dist; 
@@ -1120,7 +1120,7 @@ static void TargetSnapClosest(TransInfo *t)
                                
                                dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
                                
-                               if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
+                               if (closest == NULL || fabsf(dist) < fabsf(t->tsnap.dist)) {
                                        copy_v3_v3(t->tsnap.snapTarget, loc);
                                        closest = td;
                                        t->tsnap.dist = dist; 
index 7ef205b69f06bc3322aa9e4af701d1d35bd89f1e..0510ae21326ddafffbd8ef574d41e1c014ac7582 100644 (file)
@@ -733,7 +733,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const
 
                uv_poly_center(em, efa, cent);
 
-               dist = fabs(co[0] - cent[0]) + fabs(co[1] - cent[1]);
+               dist = fabsf(co[0] - cent[0]) + fabsf(co[1] - cent[1]);
 
                if (dist < mindist) {
                        hit->tf = tf;
@@ -869,7 +869,7 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float c
                
                BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                        luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
-                       dist = fabs(co[0] - luv->uv[0]) + fabs(co[1] - luv->uv[1]);
+                       dist = fabsf(co[0] - luv->uv[0]) + fabsf(co[1] - luv->uv[1]);
 
                        if (dist <= mindist) {
                                mindist = dist;
index 5e791a9f748b33ffd631a4dc61496101e04263d8..c80b4dfa4debb17a6ff105756cc4bcf29c5663b5 100644 (file)
@@ -381,9 +381,9 @@ static void cuboid_do(
                }
 
                /* we want a symmetric bound box around the origin */
-               if (fabs(min[0]) > fabs(max[0])) max[0] = fabs(min[0]); 
-               if (fabs(min[1]) > fabs(max[1])) max[1] = fabs(min[1]); 
-               if (fabs(min[2]) > fabs(max[2])) max[2] = fabs(min[2]);
+               if (fabsf(min[0]) > fabsf(max[0])) max[0] = fabsf(min[0]);
+               if (fabsf(min[1]) > fabsf(max[1])) max[1] = fabsf(min[1]);
+               if (fabsf(min[2]) > fabsf(max[2])) max[2] = fabsf(min[2]);
                min[0] = -max[0];
                min[1] = -max[1];
                min[2] = -max[2];
index 98382e24290f03fbc7d5a9f7666db4819777e55f..4832f19f2c7a30e35fe7633d16ddcbeba14af044 100644 (file)
@@ -65,7 +65,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
        
        if (node->custom2 || node->need_exec==0) {
                /* this node refers to its own texture tree! */
-               copy_v4_v4(out, (fabs(co[0] - co[1]) < 0.01) ? white : red);
+               copy_v4_v4(out, (fabsf(co[0] - co[1]) < 0.01f) ? white : red);
        }
        else if (nodetex) {
                TexResult texres;
index 3408eb74b58f23cea57716ca39d24cd94bb1ae71..a6f6458392fd614b2993823f5886377915d5bceb 100644 (file)
@@ -2374,9 +2374,8 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
                        displace_render_vert(re, obr, &shi, vlr->v4, 3, scale, mat, imat);
 
                /*      closest in displace value.  This will help smooth edges.   */ 
-               if ( fabs(vlr->v1->accum - vlr->v3->accum) > fabs(vlr->v2->accum - vlr->v4->accum)) 
-                       vlr->flag |= R_DIVIDE_24;
-               else vlr->flag &= ~R_DIVIDE_24;
+               if (fabsf(vlr->v1->accum - vlr->v3->accum) > fabsf(vlr->v2->accum - vlr->v4->accum)) vlr->flag |=  R_DIVIDE_24;
+               else                                                                                 vlr->flag &= ~R_DIVIDE_24;
        }
        
        /* Recalculate the face normal  - if flipped before, flip now */
@@ -4260,8 +4259,8 @@ static void check_non_flat_quads(ObjectRen *obr)
                                        normal_tri_v3(nor, vlr->v2->co, vlr->v3->co, vlr->v4->co);
                                        d2 = dot_v3v3(nor, vlr->v2->n);
 
-                                       if ( fabs(d1) < fabs(d2) ) vlr->flag |= R_DIVIDE_24;
-                                       else vlr->flag &= ~R_DIVIDE_24;
+                                       if (fabsf(d1) < fabsf(d2) ) vlr->flag |=  R_DIVIDE_24;
+                                       else                        vlr->flag &= ~R_DIVIDE_24;
 
                                        /* new vertex pointers */
                                        if (vlr->flag & R_DIVIDE_24) {
index 74e2c094850f5352a84418bf528183ce651de8de..3703f819b3bb494327587c8f7fc75fc7734544df 100644 (file)
@@ -791,9 +791,9 @@ static int cubemap(MTex *mtex, VlakRen *vlr, const float n[3], float x, float y,
                                float nor[3];
                                normal_tri_v3(nor, vlr->v1->orco, vlr->v2->orco, vlr->v3->orco);
                                
-                               if ( fabs(nor[0])<fabs(nor[2]) && fabs(nor[1])<fabs(nor[2]) ) vlr->puno |= ME_PROJXY;
-                               else if ( fabs(nor[0])<fabs(nor[1]) && fabs(nor[2])<fabs(nor[1]) ) vlr->puno |= ME_PROJXZ;
-                               else vlr->puno |= ME_PROJYZ;
+                               if      (fabsf(nor[0]) < fabsf(nor[2]) && fabsf(nor[1]) < fabsf(nor[2])) vlr->puno |= ME_PROJXY;
+                               else if (fabsf(nor[0]) < fabsf(nor[1]) && fabsf(nor[2]) < fabsf(nor[1])) vlr->puno |= ME_PROJXZ;
+                               else                                                                     vlr->puno |= ME_PROJYZ;
                        }
                        else return cubemap_glob(n, x, y, z, adr1, adr2);
                }
index b12753543e9dade3cd9e5a16d78fc721c0b6c339..db045284d5b7227572658ba64486a92cd15b232b 100644 (file)
@@ -1309,11 +1309,11 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
                        
                                /* the Zd value is still not really correct for pano */
                        
-                               vec[2]-= har->hasize;   /* z negative, otherwise it's clipped */
+                               vec[2] -= har->hasize;  /* z negative, otherwise it's clipped */
                                projectfunc(vec, re->winmat, hoco);
-                               zn= hoco[3];
-                               zn= fabs( (float)har->zs - 0x7FFFFF*(hoco[2]/zn));
-                               har->zd= CLAMPIS(zn, 0, INT_MAX);
+                               zn = hoco[3];
+                               zn = fabsf((float)har->zs - 0x7FFFFF * (hoco[2] / zn));
+                               har->zd = CLAMPIS(zn, 0, INT_MAX);
                        
                        }
                        
index 9995a3cbd17e910250af0c429b06e272d9daf140..7dc77d3632ad830e4465ee957d424bc717184460 100644 (file)
@@ -1176,8 +1176,8 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
        dy[0]= xs1 - dy[0];
        dy[1]= ys1 - dy[1];
        
-       xres= fac*(fabs(dx[0]) + fabs(dy[0]));
-       yres= fac*(fabs(dx[1]) + fabs(dy[1]));
+       xres = fac * (fabsf(dx[0]) + fabsf(dy[0]));
+       yres = fac * (fabsf(dx[1]) + fabsf(dy[1]));
        if (xres<1.0f) xres= 1.0f;
        if (yres<1.0f) yres= 1.0f;
        
index 0e7c8a13043a657dcff16d306ead4808ef770440..51be519d5b80bd8d8edc4a2d8831c901f890ced4 100644 (file)
@@ -577,8 +577,8 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
        /* add to pixel list */
        if (zverg < bufferz && (spart->totapixbuf[offset] < MAX_ZROW)) {
                if (!spart->rectmask || zverg > maskz) {
-                       t = u*spart->t[0] + v*spart->t[1] + (1.0f-u-v)*spart->t[2];
-                       s = fabs(u*spart->s[0] + v*spart->s[1] + (1.0f-u-v)*spart->s[2]);
+                       t = u * spart->t[0] + v * spart->t[1] + (1.0f - u - v) * spart->t[2];
+                       s = fabsf(u * spart->s[0] + v * spart->s[1] + (1.0f - u - v) * spart->s[2]);
 
                        apn= spart->apixbuf + offset;
                        while (apn) {
index fde25865577917d082a0550c3d1831c5e3bd5d3c..e09529fd8ace2e20aee088518024da26133853c6 100644 (file)
@@ -443,7 +443,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], co
        
        mask= zspan->mask;
        
-       if (fabs(dx) > fabs(dy)) {
+       if (fabsf(dx) > fabsf(dy)) {
 
                /* all lines from left to right */
                if (vec1[0]<vec2[0]) {
@@ -597,7 +597,7 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], cons
        dx= vec2[0]-vec1[0];
        dy= vec2[1]-vec1[1];
        
-       if (fabs(dx) > fabs(dy)) {
+       if (fabsf(dx) > fabsf(dy)) {
 
                /* all lines from left to right */
                if (vec1[0]<vec2[0]) {
@@ -727,7 +727,7 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), con
        dx= vec2[0]-vec1[0];
        dy= vec2[1]-vec1[1];
        
-       if (fabs(dx) > fabs(dy)) {
+       if (fabsf(dx) > fabsf(dy)) {
                
                /* all lines from left to right */
                if (vec1[0]<vec2[0]) {
index c5145ef2171badcf0cdfe67950e6dbc1e6cc6ce5..b005684a6db5127e659756254dfe5b0af418bb5f 100644 (file)
@@ -1162,8 +1162,8 @@ void KX_GameObject::NodeSetWorldScale(const MT_Vector3& scale)
        {
                // Make sure the objects have some scale
                MT_Vector3 p_scale = parent->GetWorldScaling();
-               if (fabs(p_scale[0]) < FLT_EPSILON || 
-                       fabs(p_scale[1]) < FLT_EPSILON || 
+               if (fabs(p_scale[0]) < FLT_EPSILON ||
+                       fabs(p_scale[1]) < FLT_EPSILON ||
                        fabs(p_scale[2]) < FLT_EPSILON)
                { 
                        return; 
@@ -1190,8 +1190,8 @@ void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans)
        {
                // Make sure the objects have some scale
                MT_Vector3 scale = parent->GetWorldScaling();
-               if (fabs(scale[0]) < FLT_EPSILON || 
-                       fabs(scale[1]) < FLT_EPSILON || 
+               if (fabs(scale[0]) < FLT_EPSILON ||
+                       fabs(scale[1]) < FLT_EPSILON ||
                        fabs(scale[2]) < FLT_EPSILON)
                { 
                        return; 
@@ -1203,7 +1203,7 @@ void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans)
                MT_Vector3 newpos = invori*(trans-parent->GetWorldPosition())*scale;
                NodeSetLocalPosition(MT_Point3(newpos[0],newpos[1],newpos[2]));
        }
-       else 
+       else
        {
                NodeSetLocalPosition(trans);
        }
index 7e7e7f8cef2dcc713f23e7546a039a1aa2080e12..5599f3e31c62187022bf6f469ed909de27e0a246 100644 (file)
@@ -379,7 +379,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
 
 void KX_IpoActuator::ResetStartTime()
 {
-       this->m_starttime = -2.0*fabs(this->m_endframe - this->m_startframe) - 1.0;
+       this->m_starttime = -2.0f * fabsf(this->m_endframe - this->m_startframe) - 1.0f;
 }
 
 int KX_IpoActuator::string2mode(const char *modename)
index 97e52e3af3d2502f272e46cdcd425652795b739b..2cc2c6efa1e15b97d0d597a584d4920d730e0533 100644 (file)
@@ -637,8 +637,8 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
        // otherwise the Y axis is the up direction.
        // If the mirror is not perfectly vertical(horizontal), the Z(Y) axis projection on the mirror
        // plan by the normal will be the up direction.
-       if (fabs(mirrorNormal[2]) > fabs(mirrorNormal[1]) &&
-               fabs(mirrorNormal[2]) > fabs(mirrorNormal[0]))
+       if (fabsf(mirrorNormal[2]) > fabsf(mirrorNormal[1]) &&
+           fabsf(mirrorNormal[2]) > fabsf(mirrorNormal[0]))
        {
                // the mirror is more horizontal than vertical
                copy_v3_v3(axis, yaxis);
@@ -649,7 +649,7 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
                copy_v3_v3(axis, zaxis);
        }
        dist = dot_v3v3(mirrorNormal, axis);
-       if (fabs(dist) < FLT_EPSILON)
+       if (fabsf(dist) < FLT_EPSILON)
        {
                // the mirror is already fully aligned with up axis
                copy_v3_v3(mirrorUp, axis);