Commit 50acfd7d authored by Raph Levien's avatar Raph Levien

A better fix to the winding rule handling of negative winding paths.

parent f6cae9e3
Sun Jun 13 21:07:20 1999 Raph Levien <raph@gimp.org>
* 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 <raph@gimp.org> Sun Jun 13 01:23:14 1999 Raph Levien <raph@gimp.org>
* art_svp_wind.c (art_svp_rewind_uncrossed): Change to winding * art_svp_wind.c (art_svp_rewind_uncrossed): Change to winding
......
...@@ -1365,32 +1365,24 @@ art_svp_rewind_uncrossed (ArtSVP *vp, ArtWindRule rule) ...@@ -1365,32 +1365,24 @@ art_svp_rewind_uncrossed (ArtSVP *vp, ArtWindRule rule)
/* Determine winding number for this segment */ /* Determine winding number for this segment */
if (i == 0) if (i == 0)
{ left_wind = 0;
if (vp->segs[seg_idx].dir) else if (vp->segs[active_segs[i - 1]].dir)
wind = 1; left_wind = winding[active_segs[i - 1]];
else
wind = -1;
}
else else
{ left_wind = winding[active_segs[i - 1]] - 1;
if (vp->segs[active_segs[i - 1]].dir)
left_wind = winding[active_segs[i - 1]];
else
left_wind = winding[active_segs[i - 1]] - 1;
if (vp->segs[seg_idx].dir) if (vp->segs[seg_idx].dir)
wind = left_wind + 1; wind = left_wind + 1;
else else
wind = left_wind; wind = left_wind;
}
winding[seg_idx] = wind; winding[seg_idx] = wind;
switch (rule) switch (rule)
{ {
case ART_WIND_RULE_NONZERO: case ART_WIND_RULE_NONZERO:
keep = (wind == 1 || wind == -1); keep = (wind == 1 || wind == 0);
invert = (wind < 0); invert = (wind == 0);
break; break;
case ART_WIND_RULE_INTERSECT: case ART_WIND_RULE_INTERSECT:
keep = (wind == 2); keep = (wind == 2);
...@@ -1398,7 +1390,7 @@ art_svp_rewind_uncrossed (ArtSVP *vp, ArtWindRule rule) ...@@ -1398,7 +1390,7 @@ art_svp_rewind_uncrossed (ArtSVP *vp, ArtWindRule rule)
break; break;
case ART_WIND_RULE_ODDEVEN: case ART_WIND_RULE_ODDEVEN:
keep = 1; keep = 1;
invert = (wind & 1) ^ (wind > 0); invert = !(wind & 1);
break; break;
case ART_WIND_RULE_POSITIVE: case ART_WIND_RULE_POSITIVE:
keep = (wind == 1); keep = (wind == 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment