src/main/java/org/fit/layout/model/Rectangular.java
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
	    }    	
    }
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
	    }    	
    }
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.
@param other the other rectangle
@return the resulting intersection or an empty rectangle when there is no intersection
Computes the intersection of this rectangle with another one .