lib/PHPPdf/Core/Boundary.php
public function intersects(Boundary $boundary)
    {
        $firstPoint = $this->getFirstPoint();
        $diagonalPoint = $this->getDiagonalPoint();

        $compareFirstPoint = $boundary->getFirstPoint();
        $compareDiagonalPoint = $boundary->getDiagonalPoint();

        foreach($boundary->points as $point)
        {
            if($this->contains($point))
            {
                return true;
            }
        }
        
        foreach($this->points as $point)
        {
            if($boundary->contains($point))
            {
                return true;
            }
        }

        $centerPoint = $this->getPointBetween($firstPoint, $diagonalPoint);

        if($boundary->contains($centerPoint))
        {
            return true;
        }

        $centerPoint = $this->getPointBetween($compareFirstPoint, $compareDiagonalPoint);

        if($this->contains($centerPoint))
        {
            return true;
        }

        $centerPoint = $this->getPointBetween($firstPoint, $compareDiagonalPoint);

        if($this->contains($centerPoint) && $boundary->contains($centerPoint))
        {
            return true;
        }
        
        $centerPoint = $this->getPointBetween($compareFirstPoint, $diagonalPoint);

        if($this->contains($centerPoint) && $boundary->contains($centerPoint))
        {
            return true;
        }

        return false;
    }
public function intersects(Boundary $boundary)
    {
        $firstPoint = $this->getFirstPoint();
        $diagonalPoint = $this->getDiagonalPoint();

        $compareFirstPoint = $boundary->getFirstPoint();
        $compareDiagonalPoint = $boundary->getDiagonalPoint();

        foreach($boundary->points as $point)
        {
            if($this->contains($point))
            {
                return true;
            }
        }
        
        foreach($this->points as $point)
        {
            if($boundary->contains($point))
            {
                return true;
            }
        }

        $centerPoint = $this->getPointBetween($firstPoint, $diagonalPoint);

        if($boundary->contains($centerPoint))
        {
            return true;
        }

        $centerPoint = $this->getPointBetween($compareFirstPoint, $compareDiagonalPoint);

        if($this->contains($centerPoint))
        {
            return true;
        }

        $centerPoint = $this->getPointBetween($firstPoint, $compareDiagonalPoint);

        if($this->contains($centerPoint) && $boundary->contains($centerPoint))
        {
            return true;
        }
        
        $centerPoint = $this->getPointBetween($compareFirstPoint, $diagonalPoint);

        if($this->contains($centerPoint) && $boundary->contains($centerPoint))
        {
            return true;
        }

        return false;
    }
public function intersects ( Boundary $ boundary ) { $ firstPoint = $ this -> getFirstPoint ( ) ; $ diagonalPoint = $ this -> getDiagonalPoint ( ) ; $ compareFirstPoint = $ boundary -> getFirstPoint ( ) ; $ compareDiagonalPoint = $ boundary -> getDiagonalPoint ( ) ; foreach ( $ boundary -> points as $ point ) { if ( $ this -> contains ( $ point ) ) { return true ; } } foreach ( $ this -> points as $ point ) { if ( $ boundary -> contains ( $ point ) ) { return true ; } } $ centerPoint = $ this -> getPointBetween ( $ firstPoint , $ diagonalPoint ) ; if ( $ boundary -> contains ( $ centerPoint ) ) { return true ; } $ centerPoint = $ this -> getPointBetween ( $ compareFirstPoint , $ compareDiagonalPoint ) ; if ( $ this -> contains ( $ centerPoint ) ) { return true ; } $ centerPoint = $ this -> getPointBetween ( $ firstPoint , $ compareDiagonalPoint ) ; if ( $ this -> contains ( $ centerPoint ) && $ boundary -> contains ( $ centerPoint ) ) { return true ; } $ centerPoint = $ this -> getPointBetween ( $ compareFirstPoint , $ diagonalPoint ) ; if ( $ this -> contains ( $ centerPoint ) && $ boundary -> contains ( $ centerPoint ) ) { return true ; } return false ; }
Checks if boundaries have common points

@param Boundary $boundary
@return boolean
Checks if boundaries have common points