diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-02 19:46:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-02 19:46:45 +0400 |
commit | fed1b8b16d2d6a56aeea496677f24b286672bb74 (patch) | |
tree | 542e5f6bcfef3491e61f745b4aa1cee769dff63c /source/blender/editors/mask/mask_ops.c | |
parent | dda63375b2fa581197e909c45116ac17b5f8782c (diff) |
Code cleanup: suffix vars to make obvious they are squared
Diffstat (limited to 'source/blender/editors/mask/mask_ops.c')
-rw-r--r-- | source/blender/editors/mask/mask_ops.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index bf2939c1a62..13ae17c6efd 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -72,7 +72,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, const MaskSplinePoint *point = NULL; float co[2]; const float threshold_sq = threshold * threshold; - float len = FLT_MAX, scalex, scaley; + float len_sq = FLT_MAX, scalex, scaley; int is_handle = FALSE, width, height; ED_mask_get_size(sa, &width, &height); @@ -96,7 +96,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, const for (i = 0; i < spline->tot_point; i++) { MaskSplinePoint *cur_point = &spline->points[i]; MaskSplinePoint *cur_point_deform = &points_array[i]; - float cur_len, vec[2], handle[2]; + float cur_len_sq, vec[2], handle[2]; vec[0] = cur_point_deform->bezt.vec[1][0] * scalex; vec[1] = cur_point_deform->bezt.vec[1][1] * scaley; @@ -106,31 +106,31 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, const handle[0] *= scalex; handle[1] *= scaley; - cur_len = len_squared_v2v2(co, handle); + cur_len_sq = len_squared_v2v2(co, handle); - if (cur_len < len) { + if (cur_len_sq < len_sq) { point_masklay = masklay; point_spline = spline; point = cur_point; - len = cur_len; + len_sq = cur_len_sq; is_handle = TRUE; } } - cur_len = len_squared_v2v2(co, vec); + cur_len_sq = len_squared_v2v2(co, vec); - if (cur_len < len) { + if (cur_len_sq < len_sq) { point_spline = spline; point_masklay = masklay; point = cur_point; - len = cur_len; + len_sq = cur_len_sq; is_handle = FALSE; } } } } - if (len < threshold_sq) { + if (len_sq < threshold_sq) { if (masklay_r) *masklay_r = point_masklay; @@ -141,7 +141,7 @@ MaskSplinePoint *ED_mask_point_find_nearest(const bContext *C, Mask *mask, const *is_handle_r = is_handle; if (score) - *score = sqrtf(len); + *score = sqrtf(len_sq); return point; } @@ -200,14 +200,14 @@ bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask, const float nor MaskSplinePoint *cur_point = &spline->points[i]; for (j = 0; j <= cur_point->tot_uw; j++) { - float cur_len, vec[2]; + float cur_len_sq, vec[2]; vec[0] = (*fp)[0] * scalex; vec[1] = (*fp)[1] * scaley; - cur_len = len_squared_v2v2(vec, co); + cur_len_sq = len_squared_v2v2(vec, co); - if (point == NULL || cur_len < len) { + if (point == NULL || cur_len_sq < len) { if (j == 0) uw = NULL; else @@ -216,7 +216,7 @@ bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask, const float nor point_masklay = masklay; point_spline = spline; point = cur_point; - len = cur_len; + len = cur_len_sq; } fp++; |