Commit 0e709a12 authored by dickelbeck's avatar dickelbeck
Browse files

added bool Intersects()

parent 8bfdd040
Loading
Loading
Loading
Loading
+57 −40
Original line number Diff line number Diff line
@@ -697,6 +697,23 @@ bool EDA_Rect::Inside( const wxPoint& point )
}


bool EDA_Rect::Intersects( const EDA_Rect aRect ) const
{
    // this logic taken from wxWidgets' geometry.cpp file:

    int left   = MAX( m_Pos.x , aRect.m_Pos.x );
    int right  = MIN( m_Pos.x+m_Size.x, aRect.m_Pos.x+aRect.m_Size.x );
    int top    = MAX( m_Pos.y , aRect.m_Pos.y );
    int bottom = MIN( m_Pos.y+m_Size.y, aRect.m_Pos.y + aRect.m_Size.y );

    if( left < right && top < bottom )
    {
        return true;
    }
    return false;
}


/**************************************************/
EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
/**************************************************/