Пример #1
0
void Box::Merge( Box const& other )
{
    if( other.Empty() )
        return;
    if( Empty() )
    {
        *this = other;
        return;
    }

    int l = std::min(x, other.x );
    int t = std::min(y, other.y );
    int r = std::max( XMax(), other.XMax() );
    int b = std::max( YMax(), other.YMax() );

    x = l;
    y = t;
    w = (r-l)+1;
    h = (b-t)+1;
}