int getIndexOfFirstPixelToCheck( ref Vector2 last, ref Vector2 current )
{
// .: pixel
// l: last position
// c: current position
// f: first pixel for next search
// f . .
// l c .
// . . .
//Calculate in which direction the last move went and decide over the next pixel to check.
switch( (int)( current.X - last.X ) )
{
case 1:
switch( (int)( current.Y - last.Y ) )
{
case 1:
return 1;
case 0:
return 0;
case -1:
return 7;
}
break;
case 0:
switch( (int)( current.Y - last.Y ) )
{
case 1:
return 2;
case -1:
return 6;
}
break;
case -1:
switch( (int)( current.Y - last.Y ) )
{
case 1:
return 3;
case 0:
return 4;
case -1:
return 5;
}
break;
}
return 0;
}