jotto

Untitled

May 24th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. enum = range(len(minT))
  2.  
  3. c1 = (rand.random_integers(0, 14000), rand.random_integers(0, 100))
  4. c2 = (rand.random_integers(0, 14000), rand.random_integers(0, 100))
  5. c3 = (rand.random_integers(0, 14000), rand.random_integers(0, 100))
  6.  
  7. c1p = []
  8. c2p = []
  9. c3p = []
  10.  
  11. for point in enum:
  12.     dist = []
  13.     x1 = point - c1[0]
  14.     y1 = minT[point] - c1[1]
  15.     dist1 = sqrt(x1**2 + y1**2)
  16.     x2 = point - c2[0]
  17.     y2 = minT[point] - c2[1]
  18.     dist2 = sqrt(x2**2 + y2**2)
  19.     x3 = point - c3[0]
  20.     y3 = minT[point] - c3[1]
  21.     dist3 = sqrt(x3**2 + y3**2)
  22.     c1p.append((point, minT[point])) if dist1 < dist2 and dist1 < dist3 else c2p.append((point, minT[point])) if dist2 < dist3 else c3p.append((point, minT[point]))
  23.  
  24. scatter(*zip(*c1p), marker='x', c='red')
  25. scatter(*zip(*c2p), marker='x', c='blue')
  26. scatter(*zip(*c3p), marker='x', c='green')
  27. scatter(*c1, marker='o', c='red', s=100)
  28. scatter(*c2, marker='o', c='blue', s=100)
  29. scatter(*c3, marker='o', c='green', s=100)
  30. show()
Advertisement
Add Comment
Please, Sign In to add comment