Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-01-13 05:49:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-01-13 06:49:00 +0300
commita14c67b0adb9cf922f267b976c5d1194305a69ca (patch)
tree29f915c8d6cda3322512479cbc7e2cde246d2204 /source
parente2715b129c1e62c8076ab4a212634b2a99cd8bc3 (diff)
Polyfill2d: improve sweep clipping logic
Now only reverse the fill direction when reaching a non-concave corner. Gives ~4x speedup here in tests with complex ngon.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenlib/intern/polyfill2d.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/source/blender/blenlib/intern/polyfill2d.c b/source/blender/blenlib/intern/polyfill2d.c
index 397082b02d2..800f4cb23c3 100644
--- a/source/blender/blenlib/intern/polyfill2d.c
+++ b/source/blender/blenlib/intern/polyfill2d.c
@@ -516,18 +516,6 @@ static void pf_triangulate(PolyFill *pf)
#endif
);
-#ifdef USE_CLIP_SWEEP
-#ifdef USE_CLIP_EVEN
- if (pi_ear != pi_ear_init) {
- reverse = !reverse;
- }
-#else
- if (pi_ear != pf->indices) {
- reverse = !reverse;
- }
-#endif
-#endif
-
#ifdef USE_CONVEX_SKIP
if (pi_ear->sign != CONVEX) {
pf->coords_tot_concave -= 1;
@@ -576,6 +564,20 @@ static void pf_triangulate(PolyFill *pf)
#endif
#endif
+#ifdef USE_CLIP_EVEN
+#ifdef USE_CLIP_SWEEP
+ if (pi_ear_init->sign != CONVEX) {
+ /* take the extra step since this ear isn't a good candidate */
+ pi_ear_init = reverse ? pi_ear_init->prev : pi_ear_init->next;
+ reverse = !reverse;
+ }
+#endif
+#else
+ if ((reverse ? pi_prev->prev : pi_next->next)->sign != CONVEX) {
+ reverse = !reverse;
+ }
+#endif
+
}
if (pf->coords_tot == 3) {