public boolean hasJoinedEdge ( Space other ) { // aligned vertical edges if ( inTolerance ( x , other . x + other . width ) || inTolerance ( x + width , other . x ) ) { if ( ( y >= other . y ) && ( y <= other . y + other . height ) ) { return true ; } if ( ( y + height >= other . y ) && ( y + height <= other . y + other . height ) ) { return true ; } if ( ( other . y >= y ) && ( other . y <= y + height ) ) { return true ; } if ( ( other . y + other . height >= y ) && ( other . y + other . height <= y + height ) ) { return true ; } } // aligned horizontal edges if ( inTolerance ( y , other . y + other . height ) || inTolerance ( y + height , other . y ) ) { if ( ( x >= other . x ) && ( x <= other . x + other . width ) ) { return true ; } if ( ( x + width >= other . x ) && ( x + width <= other . x + other . width ) ) { return true ; } if ( ( other . x >= x ) && ( other . x <= x + width ) ) { return true ; } if ( ( other . x + other . width >= x ) && ( other . x + other . width <= x + width ) ) { return true ; } } return false ; }
Check if this space has an edge that is joined with another