Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. def translate(x, y, offset):
  2. (dx, dy) = offset
  3. return x - dx, y - dy
  4.  
  5. def draw(offset):
  6. data = np.zeros((100, 100))
  7. for i in range(-100, 100):
  8. for j in range(-100, 100):
  9. (x, y) = translate(i, j, offset)
  10. (x, y) = rotate(x, y)
  11. data[i, j] = ellipse(x, y)
  12. plt.imshow(data, cmap="gray")
  13.  
  14. for i in range(len(translation_points)):
  15. plt.subplot(4, 7, i+1)
  16. draw(translation_points[i])
  17.  
  18. for i in range(-100, 100):
  19. for j in range(-100, 100):
  20.  
  21. def translate(x, y, offset):
  22. (dx, dy) = offset
  23. return x - dx - 50, y - dy - 50
  24.  
  25. plt.xlim(-50, 50)
  26. plt.ylim(-50, 50)
  27. plt.imshow(data, cmap="cool", extent=[-data.shape[1]/2., data.shape[1]/2., -data.shape[0]/2., data.shape[0]/2.])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement