I'm able to create edges between vectors in a random point cloud (the cubes), and the points on a spline. But the connections are not optimal - I assume they're matched up by index - and thus overlap messily.
How can I draw optimal, shortest-distance connections between the point cloud (cubes) and points on the spline? Bonus points if each point cloud vector is matched to a unique point on the spline (ie. each spline point is connected to only one point cloud vector).
I suspect a KD Tree may be a good approach, considering it has a 'nearest point' function, but my few attempts weren't successful.