Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
My script above is quite simple and primitive, joining line-ends that are less than a certain threshold apart. The new line that joins existing line-ends has stroke-width=1. It is easily modified to make the new line the same stroke-width as the average of lines already present.
If the lines are always straight, Hough lines can find intersections.
When two lines are at an angle to each other, and the lines are thick and perhaps curved, we can erase (make transparent) a circle or square at the mid-point of the two ends, and fill that hole eg with "-process fillholespri". Then the two lines will be extended until they intersect (provided the intersection point is within the erased circle). The extensions will match the stroke-width etc of the lines already present. However, the extensions will still be straight.
I don't know of a method that will join line-ends with a curved line.