I have a two dimensional point, lets call it
p1 = (x,y)
and an array of points,
p2 = [(x1, y1), (x2, y2), (x3, y3)...]
I want to build an array that calculates the distance between each entry in p2 and the point p1. Next, I need to find the smallest distance between a point in p2 and p1 and return the original coordinates in p2. So far, I have tried the following:
dist1 = np.sqrt(p1.x**2 + p1.y**2)
dist2 = np.sqrt(p2.x**2 + p2.y**2)
dist = dist2-dist1
Which returns the error "operands could not be broadcast together with shapes (2,) (1265,)"
As far as finding the minimum distance, I think I need to use the numpy min function as follows
import numpy as np
np.min(dist)
But I am stuck on how to return the x nd y coordinates once I calculate the distance.