I would like to add a modifier that creates a 2d metaball (or adhesion) effect. In the example, I used python lib Shapely(GEOS) and Animation nodes. Are there any libraries in Blender that would help me achieve this effect?
For animation nodes, you could do all in C modifiers because the data is evaluated by frame, so you can compute the stroke deformation for that frame.
There are quite a few options for existing libraries that handle 2D intersections.
If we use a 3rd party library, it would be good to check it’s well maintained and can be used for other areas of Blender if needed.
https://www.cgal.org can do this, further - check links at the bottom of this page.
A not-particularly obvious use of the newly added BLI_delaunay_cdt_calc function is that it can (robustly) do 2d intersections.
I don’t know if 2D intersection is involved in this problem? This is not a set of circles that need to be intersected, there’s also geometry between the circles. It’s an implicit function, where at every point in space you can query if you’re inside or outside.
The typical algorithm for that is marching squares (or dual contouring). We have similar algorithms for 3D in metaball tessellation and OpenVDB. I don’t think they’re easily reusable for 2D though, so I’d suggest to look for a simple implementation that can be copied/adapted into Blender.
Thanks for the links. I noticed that in the Grease pencil there is a select stroke segment (extend selection to stroke intersections). I need to study the code.