Something like this could work:
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import Voronoi, voronoi_plot_2d, distance
points = np.random.uniform(0, 100, size=(10, 2))
vor = Voronoi(points)
voronoi_plot_2d(vor)
dists = []
for i,point in enumerate(points):
# get nearby vertices
ridges = np.where(vor.ridge_points == i)[0]
vertex_set = set(np.array(vor.ridge_vertices)[ridges, :].ravel())
region = [x for x in vor.regions if set(x) == vertex_set][0]
region = [x for x in region if x != -1] # remove outliers
polygon = vor.vertices[region]
if len(polygon) < 1:
continue
# calc distance of every vertex to the initial point
distances = distance.cdist([point], polygon).T
max_dist_idx = np.argmax(distances)
max_dist = distances[max_dist_idx]
dists.append(max_dist)
# just for visuals
xvals = [point[0], polygon[max_dist_idx][0]]
yvals = [point[1], polygon[max_dist_idx][1]]
plt.plot(xvals,yvals,'r-')
# do stuff with that info
plt.show()
The method to match polygons with the enclosed point was posted here:
https://stackoverflow.com/a/47316980/9173710