I recently asked another question about SVG intersection here, to which I got some good answers. But I am now looking for a method to find if two paths intersect that respects stroke fill, and stroke size.
In my example, I am making an application for handwriting. I have an erase tool that can change its stroke width.
example 1: The red line in this photo represents the eraser, and the black line represents a stroke i want to erase. using the path intersection library and the methods from here (line intersects with absolute path) the intersection is not detected. Is there an easy way to do this?
example 2: I have a scissor tool in my application. The highlighted blue area intersects with the inner path because the fill overlaps with it. How do I determine if this type of event occurs? For another example, I also consider the below an intersection: example 3
My example code is very simple. I just have an SVG element with N paths inside of it. I want to have a script such that I can loop through all the paths and determine if any 2 intersect. If possible, I want to attach an event listener to each path to determine when it intersects with another. Is there an easy algorithm or solution for this?