How to pair (x,y) pairs using numpy
We can use Cython-powered kd-tree
for quick nearest-neighbor lookup to get nearest neighbour and hence achieve our desired output, like so -
from scipy.spatial import cKDTree
idx = cKDTree(B[:,:2]).query(A[:,:2], k=1)[1]
thickness = [(A[:,0] + B[idx,0]) / 2, (A[:,1] + B[idx,1]) / 2, A[:,2] + B[idx,2]]