diff options
Diffstat (limited to 'source/blender/blenlib/intern/polyfill2d.c')
-rw-r--r-- | source/blender/blenlib/intern/polyfill2d.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/polyfill2d.c b/source/blender/blenlib/intern/polyfill2d.c index 34aad5c07e9..629c9ea6de6 100644 --- a/source/blender/blenlib/intern/polyfill2d.c +++ b/source/blender/blenlib/intern/polyfill2d.c @@ -328,9 +328,12 @@ static bool pf_ear_tip_check(PolyFill *pf, const unsigned int index_ear_tip) /* Because the polygon has clockwise winding order, * the area sign will be positive if the point is strictly inside. * It will be 0 on the edge, which we want to include as well. */ - if ((span_tri_v2_sign(v1, v2, v) != CONCAVE) && - (span_tri_v2_sign(v2, v3, v) != CONCAVE) && - (span_tri_v2_sign(v3, v1, v) != CONCAVE)) + + /* note: check (v3, v1) first since it fails _far_ more often then the other 2 checks (those fail equally). + * It's logical - the chance is low that points exist on the same side as the ear we're clipping off. */ + if ((span_tri_v2_sign(v3, v1, v) != CONCAVE) && + (span_tri_v2_sign(v1, v2, v) != CONCAVE) && + (span_tri_v2_sign(v2, v3, v) != CONCAVE)) { return false; } |