diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-01 21:27:14 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-01 21:27:14 +0400 |
commit | 75aeb37a18c7e91ec3c648bb5a28417ab9d46aac (patch) | |
tree | d0541f6bb5623fa959ce845ed2e312f2a4b0a616 /source | |
parent | fd6ab0564d487a057a44131c4464708efff8511f (diff) |
edge_inside_circle was doing redundant float -> int -> float conversion, also dist_squared_to_line_segment_v2 is quite simple so remove radius checks.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_select.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 58792d881b4..bb3aff54408 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1593,23 +1593,8 @@ static void view3d_userdata_boxselect_init(BoxSelectUserData *r_data, bool edge_inside_circle(const float cent[2], float radius, const float screen_co_a[2], const float screen_co_b[2]) { - int radius_squared = radius * radius; - - /* check points in circle itself */ - if (len_squared_v2v2(cent, screen_co_a) <= radius_squared) { - return true; - } - if (len_squared_v2v2(cent, screen_co_b) <= radius_squared) { - return true; - } - else { - /* pointdistline */ - if (dist_squared_to_line_segment_v2(cent, screen_co_a, screen_co_b) < (float)radius_squared) { - return true; - } - } - - return false; + const float radius_squared = radius * radius; + return (dist_squared_to_line_segment_v2(cent, screen_co_a, screen_co_b) < radius_squared); } static void do_paintvert_box_select__doSelectVert(void *userData, MVert *mv, const float screen_co[2], int UNUSED(index)) @@ -2333,7 +2318,7 @@ static void mesh_circle_doSelectEdge(void *userData, BMEdge *eed, const float sc { CircleSelectUserData *data = userData; - if (edge_inside_circle(data->mval_fl, (int)data->radius, screen_co_a, screen_co_b)) { + if (edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b)) { BM_edge_select_set(data->vc->em->bm, eed, data->select); } } |