Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dist(a, b):
- return ((a[0] - b[0])**2 + (a[1] - b[1])**2)**0.5
- def f(poly):
- mxdist = 0
- for a in poly:
- for b in poly:
- mxdist = max(mxdist, dist(a, b))
- p = 0
- for i in range(len(poly)):
- j = (i + 1) % len(poly)
- p += dist(poly[i], poly[j])
- return mxdist / p
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement