I'm trying to find the points on two curves (crvA and crvB) that are the closest to each other. The method "Curve.GetClosestPoints" is supposed to do give me those points.
But when I call:
crvA.getClosestPoints(crvB, pointOnA, pointOnB)
I get an error message saying: 'getClosestPoints' is not a member of 'Rhino.Geometry.Curve'
Nope, the method is missing entirely from the Rhino4 SDK. There's quite a lot of code to it so writing one yourself isn't trivial.
If you don't care much for speed, you could try to just sample one curve at SpanCount * 10 intervals. Find the two closest points to curve B, then sample in between these two points with 10 smaller steps. Then find the two best results, and sample in between those with 10 smaller steps. And so on and so forth until your stepsize is less than the accuracy you desire.
I think this algorithm only really works well on not too funky inputs though.
Thanks, I programmed some relaxation/cloth code that I could misuse to 'string a rubber band' between the curves. That would end up at the points of least distance. But like you said, it is going to be very slow and will get stuck in local minima if the curve is a bit funky.