public boolean intersectsRectangle ( Rectangle r , boolean bias ) { int codeStart = code ( r , this . start ) ; int codeEnd = code ( r , this . end ) ; if ( 0 == ( codeStart | codeEnd ) ) { // both points are inside, trivial case return true ; } else if ( 0 != ( codeStart & codeEnd ) ) { // both points are either below, above, left or right of the box, no intersection return false ; } return bias ; }
Returns a fast computation if the line intersects the rectangle or bias if there is no fast way to compute the intersection .