public boolean almostParallel ( SquareNode a , int sideA , SquareNode b , int sideB ) { double selected = acuteAngle ( a , sideA , b , sideB ) ; if ( selected > parallelThreshold ) return false ; // see if the two sides are about parallel too // double left = acuteAngle(a,add(sideA,-1),b,add(sideB,1)); // double right = acuteAngle(a,add(sideA,1),b,add(sideB,-1)); // // if( left > selected+parallelThreshold || right > selected+parallelThreshold ) // return false; // if( selected > acuteAngle(a,sideA,b,add(sideB,1)) || selected > acuteAngle(a,sideA,b,add(sideB,-1)) ) // return false; // // if( selected > acuteAngle(a,add(sideA,1),b,sideB) || selected > acuteAngle(a,add(sideA,-1),b,sideB) ) // return false; return true ; }
Checks to see if the two sides are almost parallel to each other by looking at their acute angle .