Warning: session_start(): open(/var/lib/php/sessions/sess_2hi6t3su27tvfub9prqcbpnodg, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass SimpleOutlineWalker is Steppable {
IIntIntPred pixelIsInside;
int x, y;
int startX, startY;
NESWDirection direction = NESWDirection.east;
// seen points as intPairToLong
new CompactLongSet seen;
event foundPoint(int x, int y);
// x, y must be inside the shape
*(IIntIntPred *pixelIsInside, int *x, int *y) {
if (!pixelIsInside.get(x, y))
fail("pixel is not inside shape: " + x + "/" + y);
// go north until we hit the border
while (pixelIsInside.get(x, y-1))
--y;
startX = x; startY = y;
}
public bool step() {
foundPoint(x, y);
// try left, straight, right, back
for (int turn = 3; turn <= 6; turn++) {
NESWDirection newDirection = direction.plus(turn);
int x2 = x+newDirection.x, y2 = y+newDirection.y;
bool inside = pixelIsInside.get(x2, y2);
ifdef SimpleOutlineWalker_debug
printVars(+x, +y, +direction, +turn, +newDirection, +x2, +y2, +inside);
endifdef
if (inside) {
x = x2; y = y2; direction = newDirection;
break;
}
}
ret seen.add(intPairToLong(x, y));
//ret x != startX || y != startY;
}
}