Ejemplo n.º 1
0
 /// <summary>
 /// Gets the distance from this shape to another shape
 /// </summary>
 public float Distance( IShape2 shape )
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns true if this shape and another shape overlap
 /// </summary>
 public bool Overlaps( IShape2 shape )
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns true if this shape and another shape overlap
        /// </summary>
        public bool Overlaps( IShape2 shape )
        {
            Rectangle rect = ( Rectangle )shape;

            float x0 = m_X;
            float y0 = m_Y;
            float x1 = m_X + m_Width;
            float y1 = m_Y + m_Height;

            float x2 = rect.m_X;
            float y2 = rect.m_Y;
            float x3 = rect.m_X + rect.m_Width;
            float y3 = rect.m_Y + rect.m_Height;

            return ( ( !( ( x0 < x2 && x1 < x2 ) || ( x0 > x3 && x1 > x3 ) || ( y0 < y2 &&  y1 < y2 ) || ( y0 > y3  && y1 > y3 ) ) ) );
        }