This implements the _automerge_ feature which finds nearby end points
during stroke draw and merges the new curve with existing strokes.
New utility functions are added in `geometry` for slightly generalized
functionality. The `curves_merge_endpoints` takes an index map that
describes how to connect curves by index. It performs a topological sort
and reorders connected curves into contiguous ranges. This can be used
with an arbitrary number of connected curves. The tool feature itself
only uses a single curve, based on 2D end point positions.
Unit tests have been added for the curve merge utility function.
Pull Request: https://projects.blender.org/blender/blender/pulls/124459