zone.py 453 B

12345678910111213141516171819
  1. '''
  2. Created on 19 nov. 2016
  3. @author: olinox
  4. '''
  5. from core.geometry import neighbours
  6. def zone(geometry, x0, y0, radius):
  7. """ returns the list of the coordinates of the cells in the zone around (x0, y0)
  8. """
  9. buffer = frozenset( [ (x0, y0) ] )
  10. for _ in range(0, radius):
  11. current = buffer
  12. for x, y in current:
  13. buffer |= frozenset( neighbours.neighbours_of( geometry, x, y ) )
  14. return list(buffer)