15 #include "Board/Rect.h"
20 operator||(
const Rect & rectA,
const Rect & rectB )
23 rect.
top = ( rectA.top > rectB.top ) ? rectA.top : rectB.top;
24 rect.left = (rectA.left < rectB.left) ? rectA.left : rectB.left;
25 if ( rectA.left + rectA.width > rectB.left + rectB.width )
26 rect.width = rectA.left + rectA.width - rect.left;
28 rect.width = rectB.left + rectB.width - rect.left;
29 if ( rectA.top - rectA.height < rectB.top - rectB.height )
30 rect.height = rect.top - ( rectA.top - rectA.height );
32 rect.height = rect.top - ( rectB.top - rectB.height );
37 operator&&(
const Rect & rectA,
const Rect & rectB )
40 rect.
top = ( rectA.top < rectB.top ) ? rectA.top : rectB.top;
41 rect.left = (rectA.left > rectB.left) ? rectA.left : rectB.left;
42 if ( rectA.left + rectA.width < rectB.left + rectB.width )
43 rect.width = rectA.left + rectA.width - rect.left;
45 rect.width = rectB.left + rectB.width - rect.left;
46 if ( rectA.top - rectA.height > rectB.top - rectB.height )
47 rect.height = rect.top - ( rectA.top - rectA.height );
49 rect.height = rect.top - ( rectB.top - rectB.height );
50 if ( rect.height < 0 ) rect.height = 0;
51 if ( rect.width < 0 ) rect.width = 0;