Code Cleanup: correct fabsf/fabs/abs use

This commit is contained in:
Campbell Barton 2013-12-04 09:23:29 +11:00
parent 239f0dbcd2
commit f3d13bec6d
5 changed files with 11 additions and 5 deletions

View File

@ -144,6 +144,7 @@ MINLINE void negate_v3_short(short r[3]);
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT;
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT;
MINLINE float dot_v4v4(const float a[4], const float b[4]) ATTR_WARN_UNUSED_RESULT;
MINLINE float cross_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT;
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3]);

View File

@ -988,7 +988,7 @@ bool is_orthogonal_m4(float m[4][4])
for (i = 0; i < 4; i++) {
for (j = 0; j < i; j++) {
if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON)
if (fabsf(dot_v4v4(m[i], m[j])) > 1.5f * FLT_EPSILON)
return 0;
}
@ -1018,7 +1018,7 @@ bool is_orthonormal_m4(float m[4][4])
int i;
for (i = 0; i < 4; i++)
if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON)
if (fabsf(dot_v4v4(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON)
return 0;
return 1;

View File

@ -595,6 +595,11 @@ MINLINE float dot_v3v3(const float a[3], const float b[3])
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
}
MINLINE float dot_v4v4(const float a[4], const float b[4])
{
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
}
MINLINE float cross_v2v2(const float a[2], const float b[2])
{
return a[0] * b[1] - a[1] * b[0];

View File

@ -160,8 +160,8 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
int dx = x2 - x1;
int dy = y2 - y1;
dx = copysign(ceilf(0.3f * fabsf(dx)), dx);
dy = copysign(ceilf(0.3f * fabsf(dy)), dy);
dx = copysign(ceilf(0.3f * abs(dx)), dx);
dy = copysign(ceilf(0.3f * abs(dy)), dy);
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);

View File

@ -228,7 +228,7 @@ static void spothalo(struct LampRen *lar, ShadeInput *shi, float *intens)
maxz*= lar->sh_zfac;
maxy= lar->imat[0][1]*p1[0]+lar->imat[1][1]*p1[1]+lar->imat[2][1]*p1[2];
if (fabsf(nray[2]) < FLT_EPSILON) {
if (fabs(nray[2]) < FLT_EPSILON) {
use_yco = TRUE;
}
}