Fixed wrong self-intersection check for non-closed splines
This commit is contained in:
@@ -512,7 +512,7 @@ static void feather_bucket_get_diagonal(FeatherEdgesBucket *buckets, int start_b
|
|||||||
*diagonal_bucket_b_r = &buckets[diagonal_bucket_b_index];
|
*diagonal_bucket_b_r = &buckets[diagonal_bucket_b_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void spline_feather_collapse_inner_loops(float (*feather_points)[2], int tot_feather_point)
|
static void spline_feather_collapse_inner_loops(MaskSpline *spline, float (*feather_points)[2], int tot_feather_point)
|
||||||
{
|
{
|
||||||
#define BUCKET_INDEX(co) \
|
#define BUCKET_INDEX(co) \
|
||||||
feather_bucket_index_from_coord(co, min, bucket_scale, buckets_per_side)
|
feather_bucket_index_from_coord(co, min, bucket_scale, buckets_per_side)
|
||||||
@@ -541,8 +541,12 @@ static void spline_feather_collapse_inner_loops(float (*feather_points)[2], int
|
|||||||
int next = i + 1;
|
int next = i + 1;
|
||||||
float delta;
|
float delta;
|
||||||
|
|
||||||
if (next == tot_feather_point)
|
if (next == tot_feather_point) {
|
||||||
next = 0;
|
if (spline->flag & MASK_SPLINE_CYCLIC)
|
||||||
|
next = 0;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
delta = fabsf(feather_points[i][0] - feather_points[next][0]);
|
delta = fabsf(feather_points[i][0] - feather_points[next][0]);
|
||||||
if (delta > max_delta_x)
|
if (delta > max_delta_x)
|
||||||
@@ -585,8 +589,12 @@ static void spline_feather_collapse_inner_loops(float (*feather_points)[2], int
|
|||||||
int start = i, end = i + 1;
|
int start = i, end = i + 1;
|
||||||
int start_bucket_index, end_bucket_index;
|
int start_bucket_index, end_bucket_index;
|
||||||
|
|
||||||
if (end == tot_feather_point)
|
if (end == tot_feather_point) {
|
||||||
end = 0;
|
if (spline->flag & MASK_SPLINE_CYCLIC)
|
||||||
|
end = 0;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
start_bucket_index = BUCKET_INDEX(feather_points[start]);
|
start_bucket_index = BUCKET_INDEX(feather_points[start]);
|
||||||
end_bucket_index = BUCKET_INDEX(feather_points[end]);
|
end_bucket_index = BUCKET_INDEX(feather_points[end]);
|
||||||
@@ -718,7 +726,7 @@ float (*BKE_mask_spline_feather_differentiated_points_with_resolution_ex(MaskSpl
|
|||||||
|
|
||||||
/* this is slow! - don't do on draw */
|
/* this is slow! - don't do on draw */
|
||||||
if (do_collapse) {
|
if (do_collapse) {
|
||||||
spline_feather_collapse_inner_loops(feather, tot);
|
spline_feather_collapse_inner_loops(spline, feather, tot);
|
||||||
}
|
}
|
||||||
|
|
||||||
return feather;
|
return feather;
|
||||||
|
|||||||
Reference in New Issue
Block a user