Instead of iterating through the segment list each time, we use a kdTree structure to efficiently query a 2d point cloud for the nearest neighbors Fixes https://gitlab.com/kicad/code/kicad/-/issues/21352