0

Let's say I have a cloud of points, defined by 3 coordinates(x, y, z). It could work in any number of dimensions, I imagine. I want to find such a point(arbitrary, does not have to be in the cloud), that the average Euclidean distance from it to points in the cloud.Basically, it would be like finding a good spot in the city for a firefighting station, given that we know coordinates of houses that can catch fire and want to minimize our reaction time.

I wrote this function, but not sure if it makes sense.

def centrum(cloud):
    size=len(cloud)
#generalize to n dimensions
    xc=0
    yc=0
    zc=0
    for point in cloud:
        xc=xc+point.x
        yc=yc+point.y
        zc=zc+point.z
    return Point(xc/size, yc/size, zc/size)
  • Does this answer your question? [Calculate the center point of multiple latitude/longitude coordinate pairs](https://stackoverflow.com/questions/6671183/calculate-the-center-point-of-multiple-latitude-longitude-coordinate-pairs) – Passerby Oct 30 '21 at 11:20
  • The point you are looking for is the [Geometric Median](https://en.wikipedia.org/wiki/Geometric_median). Btw, it is debatable if a firefighting station location should minimize average reaction time or worst-case reaction time. Optimizing the latter would require finding the smallest bounding sphere. – Nico Schertler Nov 01 '21 at 09:45

0 Answers0