I've got two CompundPath objects that for the sake of this example are not intersecting. I would like the Location on each path that is closest to the other closest Location on the other path. (reminder that a Location is an actual point on the path, while a Point is one of the endpoints of a bezier.
I know that there is Path.getNearestLocation but it takes in a Point as an argument. I would like path1.getClosestLocations(path2).
Reference image I whipped up in paint dot net:

I was able to whip this up. 90% chance I'm going to alter it to get a more accurate and faster to compute result as this is an approximation, but it works for now.
If you want something more naïve that works but is more accurate, change the precision to be
1 / 200or1 / 1000.My plans for making it faster involve doing one pass at a rougher precision (say
1/20), and collect the ~10 closest point pairs, then go back over those with closest with a higher precision. I will post when I get that done, but I wanted to get something out there now.Right now (in 2023 on a nice dev machine) this function takes ~180ms when
path1has one straight line segment andpath2has 63 segments (mostly beziers).