Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-06-14 11:27:50 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-14 11:34:52 +0400
commit8cd9d784c7e4785d38b336bc852ffb8be3fde867 (patch)
treea3f8132de4d6c9db8fd334bb6936c0418caf241a /source/blender/editors/transform/transform_input.c
parent94d4b313231cf0d7d94de1e9eaf21037c4929ee6 (diff)
Replace sqrt with hypot for wipe-effect & transform code
Diffstat (limited to 'source/blender/editors/transform/transform_input.c')
-rw-r--r--source/blender/editors/transform/transform_input.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 6546a05aedd..61b2deabe12 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -64,18 +64,18 @@ static void InputSpring(TransInfo *UNUSED(t), MouseInput *mi, const int mval[2],
/* calculate ratio for shiftkey pos, and for total, and blend these for precision */
dx = (float)(mi->center[0] - mi->precision_mval[0]);
dy = (float)(mi->center[1] - mi->precision_mval[1]);
- ratio = sqrtf(dx * dx + dy * dy);
+ ratio = hypotf(dx, dy);
dx = (float)(mi->center[0] - mval[0]);
dy = (float)(mi->center[1] - mval[1]);
- precise_ratio = sqrtf(dx * dx + dy * dy);
+ precise_ratio = hypotf(dx, dy);
ratio = (ratio + (precise_ratio - ratio) / 10.0f) / mi->factor;
}
else {
dx = (float)(mi->center[0] - mval[0]);
dy = (float)(mi->center[1] - mval[1]);
- ratio = sqrtf(dx * dx + dy * dy) / mi->factor;
+ ratio = hypotf(dx, dy) / mi->factor;
}
output[0] = ratio;
@@ -195,7 +195,7 @@ static void InputCustomRatioFlip(TransInfo *UNUSED(t), MouseInput *mi, const int
dx = data[2] - data[0];
dy = data[3] - data[1];
- length = sqrt(dx * dx + dy * dy);
+ length = hypot(dx, dy);
if (mi->precision) {
/* deal with Shift key by adding motion / 10 to motion before shift press */