The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Remove overlapping regions in merge

These changes was commited to the Birdfont repository Fri, 14 Aug 2015 08:22:02 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 14 Aug 2015 08:22:02 +0000 (10:22 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 14 Aug 2015 08:22:02 +0000 (10:22 +0200)
commit f50dfe4e26c43c5769caeb4295129b6c8fd86051
tree 60e919389d8d349e8385cec7ee62c5c82926cdbd
parent 3d04b66d84654ef8b6caf159dae586b09de7d0aa
Remove overlapping regions in merge

libbirdfont/StrokeTool.vala
--- a/libbirdfont/StrokeTool.vala +++ b/libbirdfont/StrokeTool.vala @@ -225,23 +225,38 @@ p.update_region_boundaries (); flat.add (p.flatten ()); } - + foreach (Path p in r.paths) { PathList pl = get_insides (flat, p); - + int counters = 0; int clockwise = 0; foreach (Path i in pl.paths) { if (i.is_clockwise ()) { + print (@"clockwise++: $(i.points.size) $(i.get_first_point ().x), $(i.get_first_point ().y)\n"); clockwise++; } else { + print (@"counters++: $(i.points.size)\n"); counters++; } } print (@"clockwise $clockwise counters $counters pl.size $(pl.paths.size)\n"); + if (p.is_clockwise ()) { + if (clockwise - 1 > counters) { + remove.add (p); + break; + } + } else { + if (clockwise < counters - 1) { + remove.add (p); + break; + } + } + + /* if (p.is_clockwise ()) { int c = clockwise - counters; if (c % 2 == 0) { @@ -255,8 +270,9 @@ break; } } + */ } - + foreach (Path p in remove) { r.paths.remove (p); remove_merged_curve_parts (r); @@ -2246,7 +2262,7 @@ } if (inside) { - insides.add (path); + insides.add (p); // add the flat inside to the list } } } @@ -2292,7 +2308,6 @@ prev = path.points.get (path.points.size - 1); foreach (EditPoint p in path.points) { - // FIXME: double check stroke if ((fabs (p.x - point.x) < 0.1 && fabs (p.y - point.y) < 0.1) || (fabs (prev.x - point.x) < 0.1 && fabs (prev.y - point.y) < 0.1)) { return true;