Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/lasso_2d.c
| Context not available. | |||||
| int y0, | int y0, | ||||
| int x1, | int x1, | ||||
| int y1, | int y1, | ||||
| const int error_value) | const int error_value, | ||||
| bool fully_inside) | |||||
| { | { | ||||
| if (x0 == error_value || x1 == error_value || mcoords_len == 0) { | if (x0 == error_value || x1 == error_value || mcoords_len == 0) { | ||||
| Context not available. | |||||
| const int v1[2] = {x0, y0}, v2[2] = {x1, y1}; | const int v1[2] = {x0, y0}, v2[2] = {x1, y1}; | ||||
| /* check points in lasso */ | /* enclosed faces only checks for both points inside selection area */ | ||||
| if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v1[0], v1[1], error_value)) { | if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v1[0], v1[1], error_value) && | ||||
| return true; | BLI_lasso_is_point_inside(mcoords, mcoords_len, v2[0], v2[1], error_value)) { | ||||
| } | |||||
| if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v2[0], v2[1], error_value)) { | |||||
| return true; | return true; | ||||
| } | } | ||||
| /* no points in lasso, so we have to intersect with lasso edge */ | if (!fully_inside) { | ||||
| /* check points in lasso */ | |||||
| if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v1[0], v1[1], error_value)) { | |||||
| return true; | |||||
| } | |||||
| if (BLI_lasso_is_point_inside(mcoords, mcoords_len, v2[0], v2[1], error_value)) { | |||||
| return true; | |||||
| } | |||||
| /* no points in lasso, so we have to intersect with lasso edge */ | |||||
| if (isect_seg_seg_v2_int(mcoords[0], mcoords[mcoords_len - 1], v1, v2) > 0) { | if (isect_seg_seg_v2_int(mcoords[0], mcoords[mcoords_len - 1], v1, v2) > 0) { | ||||
| return true; | |||||
| } | |||||
| for (uint a = 0; a < mcoords_len - 1; a++) { | |||||
| if (isect_seg_seg_v2_int(mcoords[a], mcoords[a + 1], v1, v2) > 0) { | |||||
| return true; | return true; | ||||
| } | } | ||||
| for (unsigned int a = 0; a < mcoords_len - 1; a++) { | |||||
| if (isect_seg_seg_v2_int(mcoords[a], mcoords[a + 1], v1, v2) > 0) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| return false; | return false; | ||||
| Context not available. | |||||