Ejemplo n.º 1
0
 /**
  * Определяет, пересикается ли текущий прямоугольник
  * с заданным по оси X
  *
  * @param Rectangle $rect
  * @return boolean
  */
 public function isIntersectsWithX(Rectangle $rect)
 {
     if ($rect->isNull() || $this->isNull()) {
         return false;
     }
     $left1 = $this->getLeft();
     $left2 = $rect->getLeft();
     if ($left1 < $left2) {
         return $left2 - $left1 < $this->getWidth();
     } else {
         if ($left1 >= $left2) {
             return $left1 - $left2 < $rect->getWidth();
         }
     }
 }