diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-02-01 18:36:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-02-01 19:24:48 +0400 |
commit | a1a0ebbf490fd36d893ad5b0a37e099f3d035eac (patch) | |
tree | b77aa5ecaa83b233c804598563a56ed33b49be5a /source/blender/editors/space_clip/clip_draw.c | |
parent | 798e684c7c4d8b7c0c31a5f892ae43189e8d1b8c (diff) |
Code cleanup: use length squared where possible
Diffstat (limited to 'source/blender/editors/space_clip/clip_draw.c')
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 983858ac568..aee6e2cda93 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -769,12 +769,12 @@ static float get_shortest_pattern_side(MovieTrackingMarker *marker) next = (i + 1) % 4; - cur_len = len_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]); + cur_len = len_squared_v2v2(marker->pattern_corners[i], marker->pattern_corners[next]); len = min_ff(cur_len, len); } - return len; + return sqrtf(len); } static void draw_marker_slide_square(float x, float y, float dx, float dy, int outline, float px[2]) @@ -1031,8 +1031,7 @@ static void getArrowEndPoint(const int width, const int height, const float zoom direction[0] *= width; direction[1] *= height; - max_length = len_v2(direction); - normalize_v2(direction); + max_length = normalize_v2(direction); mul_v2_fl(direction, min_ff(32.0f / zoom, max_length)); direction[0] /= width; direction[1] /= height; @@ -1461,7 +1460,7 @@ static void draw_tracking_tracks(SpaceClip *sc, Scene *scene, ARegion *ar, Movie sub_v2_v2(vec, npos); - if (len_v2(vec) < 3.0f) + if (len_squared_v2(vec) < (3.0f * 3.0f)) glColor3f(0.0f, 1.0f, 0.0f); else glColor3f(1.0f, 0.0f, 0.0f); |