public int getCornerIndex( SquareNode node ) {
		int index = nodes.indexOf(node);

		int x = index%columns;
		int y = index/columns;

		if( x <= 0 && y <= 0 ) {
			return 0;
		} else if( x > 0 && y <= 0 ) {
			return 1;
		} else if( x > 0 && y > 0 ) {
			return 2;
		} else if( x <= 0 && y > 0 ) {
			return 3;
		} else {
			throw new RuntimeException("Not corner!");
		}
	}
public int getCornerIndex ( SquareNode node ) { int index = nodes . indexOf ( node ) ; int x = index % columns ; int y = index / columns ; if ( x <= 0 && y <= 0 ) { return 0 ; } else if ( x > 0 && y <= 0 ) { return 1 ; } else if ( x > 0 && y > 0 ) { return 2 ; } else if ( x <= 0 && y > 0 ) { return 3 ; } else { throw new RuntimeException ( "Not corner!" ) ; } }
Returns the index of the corner.  0 = (0,0), 1 = (0,w-1), 2 = (h-1,w-1), 3 = (h-1,0)