Given an array of points in 3D space, I need to find the closest point to a given point p
.
I am looking to optimize performance for this search. Currently, I am using square of magnitude as a metric to compare distances, because of the obvious optimization in comparison to Euclidean distance (which requires the calculation of the square root).
I am aware of the existence of the Manhattan distance. However, I am not sure whether this metric could be used in this case. I need to do this evaluation correctly.
Is there a better way of achieving this calculation, performance wise? Perhaps storing the points in a specialized data structure, or using a different metric?
I read the related question (Fastest way to find the closest point to a given point in 3D, in Python), but am still wondering about the optimal metric for comparison.