paperjs / paper.js

The Swiss Army Knife of Vector Graphics Scripting – Scriptographer ported to JavaScript and the browser, using HTML5 Canvas. Created by @lehni & @puckey
http://paperjs.org
Other
14.46k stars 1.22k forks source link

Intersect is removing needed path #1362

Open karltdev opened 7 years ago

karltdev commented 7 years ago

Sketch

I have a path containing letter "Aa". I also added a path for masking. When I intersect two paths, letter "a" disappears. Please refer to above sketch for detail.

sasensi commented 5 years ago

The problem is in your path data. If you take a close look at the path data for the lower case "a" letter, you'll notice that it is overlapping itself exactly like if we copied the path in place then joined the tail of the first to the head of the second. This sketch, which incrementally offset each point of the path in y direction, demonstrate what I say (we can distinguish the path shape 2 times).

screenshot-sketch paperjs org-2018 11 07-16-03-15

A simple solution consists in correcting the path, like I did in this sketch.

screenshot-sketch paperjs org-2018 11 07-16-03-25

This seems like an extreme edge case for boolean operations and I'm not sure we should cover it. @lehni, what do you think ?