From 8cd9d784c7e4785d38b336bc852ffb8be3fde867 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 14 Jun 2014 17:27:50 +1000 Subject: Replace sqrt with hypot for wipe-effect & transform code --- source/blender/blenkernel/intern/seqeffects.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/blenkernel/intern/seqeffects.c') diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c index 7ed9af8b87f..2b14b92217b 100644 --- a/source/blender/blenkernel/intern/seqeffects.c +++ b/source/blender/blenkernel/intern/seqeffects.c @@ -1398,7 +1398,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f x = x - halfx; y = y - halfy; - temp2 = asin(abs(y) / sqrt(x * x + y * y)); + temp2 = asin(abs(y) / hypot(x, y)); if (x <= 0 && y >= 0) temp2 = (float)M_PI - temp2; else if (x <= 0 && y <= 0) temp2 += (float)M_PI; else if (x >= 0 && y <= 0) temp2 = 2.0f * (float)M_PI - temp2; @@ -1441,7 +1441,7 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f temp1 = xo * (1 - facf0 / 2) - xo * facf0 / 2; temp2 = yo * (1 - facf0 / 2) - yo * facf0 / 2; - pointdist = sqrtf(temp1 * temp1 + temp2 * temp2); + pointdist = hypot(temp1, temp2); if (b2 < b1 && b2 < b3) { if (hwidth < pointdist) @@ -1498,9 +1498,9 @@ static float check_zone(WipeZone *wipezone, int x, int y, Sequence *seq, float f hwidth = width * 0.5f; temp1 = (halfx - (halfx) * facf0); - pointdist = sqrtf(temp1 * temp1 + temp1 * temp1); + pointdist = hypotf(temp1, temp1); - temp2 = sqrtf((halfx - x) * (halfx - x) + (halfy - y) * (halfy - y)); + temp2 = hypotf(halfx - x, halfy - y); if (temp2 > pointdist) output = in_band(hwidth, fabsf(temp2 - pointdist), 0, 1); else output = in_band(hwidth, fabsf(temp2 - pointdist), 1, 1); -- cgit v1.2.3