diff --git a/ChangeLog b/ChangeLog index 70efb053a78532d9f4e509f4d28000d541e07b59..a77ec39fec73089d994e82dc6857ec61eb703c2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Jun 13 21:07:20 1999 Raph Levien + + * art_svp_wind.c (art_svp_rewind_uncrossed): Made the winding + rule logic even more correct :). I somehow missed the fact that + a clockwise path should be given a winding number of zero; + last night's commit tried to make it -1 (which worked for the + test cases I was using). + Sun Jun 13 01:23:14 1999 Raph Levien * art_svp_wind.c (art_svp_rewind_uncrossed): Change to winding diff --git a/art_svp_wind.c b/art_svp_wind.c index 6383b6f1e679b5a984f8b0f870af080ff9c58052..51cf58fce64122cbb4e50b225a244a4cbeee05d1 100644 --- a/art_svp_wind.c +++ b/art_svp_wind.c @@ -1365,32 +1365,24 @@ art_svp_rewind_uncrossed (ArtSVP *vp, ArtWindRule rule) /* Determine winding number for this segment */ if (i == 0) - { - if (vp->segs[seg_idx].dir) - wind = 1; - else - wind = -1; - } + left_wind = 0; + else if (vp->segs[active_segs[i - 1]].dir) + left_wind = winding[active_segs[i - 1]]; else - { - if (vp->segs[active_segs[i - 1]].dir) - left_wind = winding[active_segs[i - 1]]; - else - left_wind = winding[active_segs[i - 1]] - 1; + left_wind = winding[active_segs[i - 1]] - 1; - if (vp->segs[seg_idx].dir) - wind = left_wind + 1; - else - wind = left_wind; - } + if (vp->segs[seg_idx].dir) + wind = left_wind + 1; + else + wind = left_wind; winding[seg_idx] = wind; switch (rule) { case ART_WIND_RULE_NONZERO: - keep = (wind == 1 || wind == -1); - invert = (wind < 0); + keep = (wind == 1 || wind == 0); + invert = (wind == 0); break; case ART_WIND_RULE_INTERSECT: keep = (wind == 2); @@ -1398,7 +1390,7 @@ art_svp_rewind_uncrossed (ArtSVP *vp, ArtWindRule rule) break; case ART_WIND_RULE_ODDEVEN: keep = 1; - invert = (wind & 1) ^ (wind > 0); + invert = !(wind & 1); break; case ART_WIND_RULE_POSITIVE: keep = (wind == 1);