The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Remove tripple points on other points

These changes was commited to the Birdfont repository Wed, 06 Jul 2016 21:33:12 +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>
Wed, 06 Jul 2016 21:33:12 +0000 (23:33 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Wed, 06 Jul 2016 21:33:12 +0000 (23:33 +0200)
commit ebdb5a59faa23f13ab176de0e120aae5f250aae0
tree 5888adae8abaaaf9d895d23fcf54511abd388d16
parent 0f40cc1ec04c1b63443f886c9ba2324dae3f2b6e
Remove tripple points on other points

libbirdfont/Path.vala
--- a/libbirdfont/Path.vala +++ b/libbirdfont/Path.vala @@ -2266,8 +2266,12 @@ for (int i = 0; i < points.size + 1; i++) { EditPoint ep = points.get (i % points.size); n = points.get ((i + 1) % points.size); + EditPoint previous = points.get ((i - 1 + points.size) % points.size); - if (Path.distance_to_point (n, ep) < t) { + if (Path.distance_to_point (n, ep) < t && Path.distance_to_point (previous, ep) < t) { + points.remove (ep); + i--; + } else if (Path.distance_to_point (n, ep) < t) { remove.add (ep); } }