I have one points and many other points on 2D surface
import numpy as np
import math
pts_o = [[0,0], [11, 111], [222, 22], [333, 333]]
pts = np.array(pts_o)
ct = np.average(pts, axis=0)
res = []
for pt in pts_o:
res.append(math.sqrt((pt[0] - ct[0])**2 + (pt[1] - ct[1])**2))
res.sort()
I'd like to know how to get and sort the distances of between the central points to the other points by numpy.
I know linalg.norm
can do something similar for a point to b point:
dist = numpy.linalg.norm(a-b)
but how to use this function for many points?