How to connect points most efficiently?

I want to connect Points A and B in with the shortest distances, but they also should cross each other the least amount possible, probably something like the picture.
Sorting the points distances purely by length would make some points have multiple connections and some points have no connections. It would be better if the connection is made in a way that produces the shortest total length, while also crossing each other.

In the exmplary picture, point 1 should connect to point B, although point A has a shorter distance. How should I think about this problem?

sonnenvektor matrix (10.9 KB)

You didn’t internalize your geometry.

Yes, sorry! I am attaching one with internalized geometry.
sonnenvektor matrix hilfe (12.8 KB)

There are some weird aspects to this code, perhaps including the basic premise…

Still, I used an Anemone 0.4 loop (white group) to avoid using any point twice.

sonnenvektor matrix (24.3 KB)

Added slider to Shift List:

sonnenvektor matrix (25.5 KB)

Does this alternative look correct to you visually?
sonnenvektor matrix hilfe (17.4 KB)


Haha, yes? What is wrong with the basic premise?

Thank you for your code!