docs: void sortEdgesCCW(FastQueue<Node> corners) {
  		for (int nodeIdx = 0; nodeIdx < corners.size; nodeIdx++) {
  			Node na = corners.get(nodeIdx);
  
  			// reference node to do angles relative to.
  			double ref = Double.NaN;
  			int count = 0;
  			for (int i = 0; i < 4; i++) {
  				order[i] = i;
  				tmpEdges[i] = na.edges[i];
  				if( na.edges[i] == null ) {
  					directions[i] = Double.MAX_VALUE;
  				} else {
  					Node nb = na.edges[i];
  					double angleB = Math.atan2(nb.y-na.y,nb.x-na.x);
  					if( Double.isNaN(ref) ) {
  						ref = angleB;
  						directions[i] = 0;
  					} else {
  						directions[i] = UtilAngle.distanceCCW(ref,angleB);
  					}
  					count++;
  				}
  			}
  
  			sorter.sort(directions,0,4,order);
  			for (int i = 0; i < 4; i++) {
  				na.edges[i] = tmpEdges[ order[i] ];
  			}
  			if( count == 2 ) {
  				// If there are only two then we define the order to be defined by the one which minimizes
  				// CCW direction
  				if( directions[order[1]] > Math.PI ) {
  					na.edges[0] = tmpEdges[ order[1] ];
  					na.edges[1] = tmpEdges[ order[0] ];
  				} else {
  					na.edges[0] = tmpEdges[ order[0] ];
  					na.edges[1] = tmpEdges[ order[1] ];
  				}
  			} else if( count == 3 ) {
  				// Edges need to point along the 4 possible directions, in the case of 3 edges, there might
  				// need to be a gap at a different location than at the end
  				int selected = -1;
  				double largestAngle = 0;
  				for (int i = 0,j=2; i < 3; j=i,i++) {
  					double ccw = UtilAngle.distanceCCW(directions[order[j]],directions[order[i]]);
  					if( ccw > largestAngle ) {
  						largestAngle = ccw;
  						selected = j;
  					}
  				}
  
  				for (int i = 2; i > selected; i--) {
  					na.edges[i+1] = na.edges[i];
  				}
  				na.edges[selected+1]=null;
  
  			}
  		}
  	}