Public Member Functions | |
def | __init__ |
def | __str__ |
def | __iter__ |
Returns an iterator that iterates over columns. | |
def | cell_iter |
Returns an iterator that iterates over all cells in the grid. | |
def | window_index_iter |
Returns an iterator that iterates over a subgrid of this grid. | |
def | wrapped_window_index_iter |
Returns an iterator that iterates over a subgrid of this grid. | |
def | window_iter |
Returns an iterator that iterates over a subgrid of this grid. | |
def | wrapped_window_iter |
Returns an iterator that iterates over a subgrid of this grid. | |
def | square_index_iter |
Returns an iterator that iterates over all cells in the square surrounding the given point. | |
def | wrapped_square_index_iter |
Returns an iterator that iterates over all cells in the square surrounding the given point. | |
def | square_iter |
Returns an iterator that iterates over all cells in the square surrounding the given point. | |
def | wrapped_square_iter |
Returns an iterator that iterates over all cells in the square surrounding the given point. | |
def | index_iter |
Returns an iterator that iterates over the indeces of this grid as tuples. | |
Public Attributes | |
width | |
height |
Definition at line 154 of file fast_grid.py.
def fast_grid.Container2D.__init__ | ( | self, | ||
width, | ||||
height | ||||
) |
def fast_grid.Container2D.__iter__ | ( | self | ) |
Returns an iterator that iterates over columns.
This iterator is provided so that a Grid2D better emulates a list of lists, as in the following example:
for col in grid: for item in col: process(item)
Definition at line 185 of file fast_grid.py.
def fast_grid.Container2D.__str__ | ( | self | ) |
Definition at line 161 of file fast_grid.py.
def fast_grid.Container2D.cell_iter | ( | self | ) |
Returns an iterator that iterates over all cells in the grid.
This allows you to write:
for cell in cell_iter(grid): process(cell)
Reimplemented in fast_grid.Grid2D.
Definition at line 197 of file fast_grid.py.
def fast_grid.Container2D.index_iter | ( | self | ) |
Returns an iterator that iterates over the indeces of this grid as tuples.
If grid is a 2 by 2 grid, then:
for p in index_iter(grid): print p
0, 0 0, 1 1, 0 1, 1
for p in index_iter(grid): grid[p] = random()
Definition at line 334 of file fast_grid.py.
def fast_grid.Container2D.square_index_iter | ( | self, | ||
p, | ||||
n | ||||
) |
Returns an iterator that iterates over all cells in the square surrounding the given point.
The square is 2*n + 1 units.
Definition at line 279 of file fast_grid.py.
def fast_grid.Container2D.square_iter | ( | self, | ||
p, | ||||
n | ||||
) |
Returns an iterator that iterates over all cells in the square surrounding the given point.
The square is 2*n + 1 units.
Definition at line 299 of file fast_grid.py.
def fast_grid.Container2D.window_index_iter | ( | self, | ||
p0, | ||||
p1 | ||||
) |
Returns an iterator that iterates over a subgrid of this grid.
The iterator will iterate over all cells x, y in the grid such that
x0 <= x < x1 y0 <= y < y1
Definition at line 212 of file fast_grid.py.
def fast_grid.Container2D.window_iter | ( | self, | ||
p0, | ||||
p1 | ||||
) |
Returns an iterator that iterates over a subgrid of this grid.
The iterator will iterate over all cells x, y in the grid such that
x0 <= x < x1 y0 <= y < y1
Definition at line 247 of file fast_grid.py.
def fast_grid.Container2D.wrapped_square_index_iter | ( | self, | ||
p, | ||||
n | ||||
) |
Returns an iterator that iterates over all cells in the square surrounding the given point.
The square is 2*n + 1 units. The iterator wraps over the grid. For example, if x is one unit too high (it is outside the grid to the right), the iterator will return first cell in that row.
Definition at line 290 of file fast_grid.py.
def fast_grid.Container2D.wrapped_square_iter | ( | self, | ||
p, | ||||
n | ||||
) |
Returns an iterator that iterates over all cells in the square surrounding the given point.
The square is 2*n + 1 units. The iterator wraps over the grid. For example, if x is one unit too high (it is outside the grid to the right), the iterator will return first cell in that row.
Definition at line 310 of file fast_grid.py.
def fast_grid.Container2D.wrapped_window_index_iter | ( | self, | ||
p0, | ||||
p1 | ||||
) |
Returns an iterator that iterates over a subgrid of this grid.
The iterator will iterate over all cells x, y in the grid such that
x0 <= x < x1 y0 <= y < y1
The iterator wraps over the grid. For example, if x is one unit too high (it is outside the grid to the right), the iterator will return the index of the first cell in that row.
Definition at line 231 of file fast_grid.py.
def fast_grid.Container2D.wrapped_window_iter | ( | self, | ||
p0, | ||||
p1 | ||||
) |
Returns an iterator that iterates over a subgrid of this grid.
The iterator will iterate over all cells x, y in the grid such that
x0 <= x < x1 y0 <= y < y1
The iterator wraps over the grid. For example, if x is one unit too high (it is outside the grid to the right), the iterator will return first cell in that row.
Definition at line 267 of file fast_grid.py.
Definition at line 158 of file fast_grid.py.
Definition at line 157 of file fast_grid.py.