I want to find the minimum sum of distances of a point(x, y)
from other points which lies in the x-y plane
. There are 8 cells which are 1 unit far from any given cell. Here distance between two points is not meant to calculate manhattan distance between those points. Here point (x+1, y+1)
is 1 unit far from point (x, y)
. In the above diagram point,
point p
is 4 unit far from point t
. Since there are 4 cells between p
and t
. Point s
is 2 unit far from point p
. Since there are two cells between p
and s
.
The point from where I want to find the sum of distance is one of the points which lies in the x-y plane
is one, which gives the minimum sum of distances. For example. In the above example image,
point g(3,2)
is in the minimum distance from all other points. The resultant distance is 2(a-g)
+ 1(b-g)
+ 2(c-g)
+ 1(d-g)
+ 1(e-g)
+ 2(f-g)
=9. My objective is to find the minimum sum of distances of a point, which is 9 in this example. Thank you.
To find out the minimum sum of distances, my idea is is get that point first, which is close to all other points. Once i get the point, i can get the distance from all points to that point and finally sum up. But i don't know how can i get the point which is close to all other points.