public Rectangular intersection ( Rectangular other ) { if ( this . intersects ( other ) ) { return new Rectangular ( Math . max ( x1 , other . x1 ) , Math . max ( y1 , other . y1 ) , Math . min ( x2 , other . x2 ) , Math . min ( y2 , other . y2 ) ) ; } else { return new Rectangular ( ) ; //an empty rectangle } }
Computes the intersection of this rectangle with another one .