code: def polygon_to_points(coords, z=None):
      
  
      bounds = array(coords).astype('int')
  
      bmax = bounds.max(0)
      bmin = bounds.min(0)
  
      path = Path(bounds)
  
      grid = meshgrid(range(bmin[0], bmax[0]+1), range(bmin[1], bmax[1]+1))
  
      grid_flat = zip(grid[0].ravel(), grid[1].ravel())
  
      points = path.contains_points(grid_flat).reshape(grid[0].shape).astype('int')
      points = where(points)
      points = (vstack([points[0], points[1]]).T + bmin[-1::-1]).tolist()
      if z is not None:
          points = map(lambda p: [p[0], p[1], z], points)
  
      return points
docs: Given a list of pairs of points which define a polygon,
      return a list of points interior to the polygon