I'm making a drawing tool using Paper JS. Now I want to fill a closed path from two items, say for example two rectangles that intersects.
Looking at the reference there seems to be a function to get the intersections but does not accomplish what I need as it makes another shape out of the intersection.
intersect(item)
or subtract(item)
Also in this scenario where it detects if the object is split.
If any of you guys have come across this issue please give some advice.
Thanks and regards.
There is a nice demo of boolean operations in the paper.js examples.
Use Path.unite()
, Path.intersect()
(and not Path.intersects()
), Path.subtract()
, Path.exclude()
to compute boolean operations.
You can also use Path.getIntersections()
or maybe the more appropriate Path.getCrossings()
to handle intersections with opened path.