def _gen_starting_points(shape):
 (ny, nx) = shape
 xfirst = 0
 yfirst = 1
 xlast = (nx - 1)
 ylast = (ny - 1)
 (x, y) = (0, 0)
 i = 0
 direction = u'right'
 for i in xrange((nx * ny)):
  (yield (x, y))
  if (direction == u'right'):
   x += 1
   if (x >= xlast):
    xlast -= 1
    direction = u'up'
  elif (direction == u'up'):
   y += 1
   if (y >= ylast):
    ylast -= 1
    direction = u'left'
  elif (direction == u'left'):
   x -= 1
   if (x <= xfirst):
    xfirst += 1
    direction = u'down'
  elif (direction == u'down'):
   y -= 1
   if (y <= yfirst):
    yfirst += 1
    direction = u'right'

def _gen_starting_points ( shape ) : ( ny , nx ) = shape xfirst = 0 yfirst = 1 xlast = ( nx - 1 ) ylast = ( ny - 1 ) ( x , y ) = ( 0 , 0 ) i = 0 direction = u'right' for i in xrange ( ( nx * ny ) ) : ( yield ( x , y ) ) if ( direction == u'right' ) : x += 1 if ( x >= xlast ) : xlast -= 1 direction = u'up' elif ( direction == u'up' ) : y += 1 if ( y >= ylast ) : ylast -= 1 direction = u'left' elif ( direction == u'left' ) : x -= 1 if ( x <= xfirst ) : xfirst += 1 direction = u'down' elif ( direction == u'down' ) : y -= 1 if ( y <= yfirst ) : yfirst += 1 direction = u'right'
yield starting points for streamlines .