code: boolean alignEdges(FastQueue<Node> corners) {
  		open.clear();
  		open.add( corners.get(0) );
  
  		marked.resize(corners.size);
  		marked.fill(false);
  
  		marked.set(corners.get(0).index,true);
  
  		while( !open.isEmpty() ) {
  			Node na = open.remove();
  
  			// examine each neighbor and see the neighbor is correctly aligned
  			for (int i = 0; i < 4; i++) {
  				if( na.edges[i] == null ) {
  					continue;
  				}
  				// Compute which index should be an edge pointing back at 'na'
  				int j = (i+2)%4;
  
  				Node nb = na.edges[i];
  
  				// Sanity check. If it has been marked it should be correctly aligned
  				if( marked.get(nb.index) ) {
  					if( nb.edges[j] != na ) {
  						if( verbose != null ) verbose.println("BUG! node "+nb.index+" has been processed and edge "+j+" doesn't point to node "+na.index);
  						return false;
  					}
  					continue;
  				}
  
  				// Rotate edges
  				boolean failed = true;
  				for (int attempt = 0; attempt < 4; attempt++) {
  					if( nb.edges[j] != na ) {
  						nb.rotateEdgesDown();
  					} else {
  						failed = false;
  						break;
  					}
  				}
  				if( failed ) {
  					if( verbose != null ) verbose.println("BUG! Can't align edges");
  					return false;
  				}
  				marked.set(nb.index,true);
  				open.add(nb);
  			}
  		}
  		return true;
  	}
docs: Enforces the rule that an edge in node A has an edge in node B that points back to A at index (i+2)%4.