1

I have 2 paths : A and B img path AB

I would like to create a new path : A-B. Which is the path A minus the path B. img path A - path B

How can I achieve this ? I guess It's really computationally intensive. Maybe there is already library that are optimised to do this ?

Note: A and B can be quite complex (containing MHVLCQASTZ elements)

Alan
  • 13
  • 1
  • 3
  • you could maybe make path B a clip-path and use it to clip path A. Is that what you mean? Or make it a mask and mask path A – Robert Longson May 11 '17 at 02:55
  • Yeah it effectively works with mask. But for compatibility reason I need to deal directly with path. – Alan May 11 '17 at 03:39
  • I suspect that's not possible with complete generality. At the very least it's very hard so you'd need to try to solve it and present us with a much smaller problem when you get stuck and even that might not have an answer. – Robert Longson May 11 '17 at 06:30
  • 1
    have a look [here](http://processingjs.nihongoresources.com/shapeboolean/) ,[here](http://stackoverflow.com/questions/15035884/boolean-operations-on-svg-paths), [here](https://github.com/poilu/raphael-boolean), [here](http://bl.ocks.org/nitaku/8751669) and [here](http://paperjs.org/reference/pathitem/)... the list goes on... – Holger Will May 11 '17 at 07:25
  • Use a library. Barring that, be prepared to intersect all pairs of segments, for all possible combinations of segment types. Lots of hard work, and possibly some specific questions along the way, but as a general concept easy enough. – MvG May 11 '17 at 22:45
  • Thanks for the links. Yeah with simple shapes such as square/circle. It shouldn't be too complicated. But with complexe paths it's looks really much harder. I'll to come up with a solution and come back here if I have some more specifics questions. – Alan May 12 '17 at 05:32

0 Answers0