sort

fun sort()

Swap top/bottom or left/right if there are flipped (i.e. left right and/or top bottom). This can be called if the edges are computed separately, and may have crossed over each other. If the edges are already correct (i.e. left <= right and top <= bottom) then nothing is done.