SVG paths detect overlapping or closed shapes

I have brown bunches of svg and I want to detect and notify my user if there is any form behind or above another form. I know that the list of intersections is obtained if they intersect at the edges, but what happens if I want to find a figure that is behind another figure but does not intersect at the edges?

The encoluseList method seems to be dealing with bounding rectangles, not this.

Any ideas?

+7
source share
1 answer

To determine if the path / shape of another one overlaps 1. Calculation of the area covered by the final shape achieved
2. The calculation of the sum of the areas of all forms independently (since this is SVG, and the details of each path element are known, this can be done)
3. Comparison of two areas. If the two areas are the same, then there is no overlap, otherwise at least 2 shapes overlap.

The difficult step is step 1, which can be roughly calculated using the pixel drawing algorithm (my preference). For other methods, you can move on to the next question about the overlap stack relative to the area of โ€‹โ€‹overlapping circles

+1
source

All Articles