Commit 0e709a12 authored by dickelbeck's avatar dickelbeck

added bool Intersects()

parent 8bfdd040
......@@ -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 )
/**************************************************/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment