I have an array of 3D points called points. Here are the first 20 points of that array:
points = np.array([[-1.33309284,-1.30808319,4.00199986],[-1.33209359,-1.30417236,3.99900007],[-1.33109427,-1.30026584,3.99600005],[-1.35235626,-1.30090892,4.00699997],[-1.34447409,-1.29896096,4.00099993],[-1.33627494,-1.29668835,3.99399996],[-1.35134384,-1.29700102,4.00400019],[-1.34346598,-1.29505737,3.99799991],[-1.33527122,-1.29278989,3.99099994],[-0.43118706,-1.29732492,4.00500011],[-0.42564261,-1.29829663,4.0079999,],[-1.35033125,-1.29309735,4.00099993],[-1.34245787,-1.29115818,3.99499989],[-1.33393295,-1.28857266,3.98699999],[-1.35809791,-1.28919816,3.99799991],[-1.35089223,-1.28790834,3.99399996],[-1.34470857,-1.2875859,3.99300003],[-1.36034349,-1.28562515,3.99600005],[-1.35381569,-1.28498166,3.99399996],[-1.34695627,-1.28401647,3.99099994]])
I have four x,y coordinates, which represent estimated corner points, but they are not necessarily present in the points array due to resolution.
corner_points = np.array([[-1.33109423,-1.30026583],[-1.33527123,-1.29278983],[-1.35089222,-1.28790833],[-1.33393293,-1.28857263]])
I want to find the four points in the points array that are the closest match to the x,y coordinates of the corner points.
Note: It was mentioned that pandas might be a more powerful tool for the task or a ball tree search from scikit i assume. I am not solely bound to using numpy. It would just be practical since I already use it in the script.