I am using paperjs and now have a need to do vector segmentation of freely drawn line segments. Specifically, it has a function similar to erasing, and the eraser itself has a volume. Then the intersecting parts of the eraser need to be removed and a new vector path generated。 I use the subtract and intersection methods from paperjs, but there are still many problems. I am not sure whether it is because I am not familiar with them or because paperjs is flawed. Or how to get some algorithm to solve this problem.
At the first, it will be

at the finally,it should be

i move the eraser in middle,and it should divide to 4 parts