core.field
Class ScanlineGridIterator
java.lang.Object
core.field.ScanlineGridIterator
- All Implemented Interfaces:
- Vec2Iterator
- public class ScanlineGridIterator
- extends java.lang.Object
- implements Vec2Iterator
Iterates over an integer, rectangular grid in scanline order.
- Version:
- 1.0
- Author:
- Andreas Sundquist
Field Summary |
private Vec2 |
v
|
private int |
x
|
private int |
xmax
|
private int |
xmin
|
private int |
y
|
private int |
ymax
|
private int |
ymin
|
Constructor Summary |
ScanlineGridIterator(int width,
int height)
Constructs a ScanlineGridIterator that iterates over the integer
grid [0, width-1] x [0, height-1] in left-right, top-down order. |
ScanlineGridIterator(int xorigin,
int yorigin,
int width,
int height)
Constructs a ScanlineGridIterator that iterates over the integer grid
[xorigin, xorigin+width-1] x [yorigin, yorigin+height-1] in left-right,
top-down order. |
Method Summary |
Vec2 |
next()
Returns: null if there are no more points in the sequence, else
a Vec2 whose value is the next point. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
xmin
private int xmin
xmax
private int xmax
ymin
private int ymin
ymax
private int ymax
x
private int x
y
private int y
v
private Vec2 v
ScanlineGridIterator
public ScanlineGridIterator(int width,
int height)
- Constructs a ScanlineGridIterator that iterates over the integer
grid [0, width-1] x [0, height-1] in left-right, top-down order.
ScanlineGridIterator
public ScanlineGridIterator(int xorigin,
int yorigin,
int width,
int height)
- Constructs a ScanlineGridIterator that iterates over the integer grid
[xorigin, xorigin+width-1] x [yorigin, yorigin+height-1] in left-right,
top-down order.
next
public Vec2 next()
- Returns: null if there are no more points in the sequence, else
a Vec2 whose value is the next point. The returned Vec2
may be modified by the caller. The same Vec2 may be
written to again on the subsequent call to next().
- Specified by:
next
in interface Vec2Iterator