diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-06-14 11:27:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-06-14 11:34:52 +0400 |
commit | 8cd9d784c7e4785d38b336bc852ffb8be3fde867 (patch) | |
tree | a3f8132de4d6c9db8fd334bb6936c0418caf241a /source/blender/blenkernel/intern/seqeffects.c | |
parent | 94d4b313231cf0d7d94de1e9eaf21037c4929ee6 (diff) |
Replace sqrt with hypot for wipe-effect & transform code
Diffstat (limited to 'source/blender/blenkernel/intern/seqeffects.c')
-rw-r--r-- | source/blender/blenkernel/intern/seqeffects.c | 8 |
1 files changed, 4 insertions, 4 deletions
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); |