Function: rectangle-intersect-p
rectangle-intersect-p is a byte-compiled function defined in
rect.el.gz.
Signature
(rectangle-intersect-p POS1 SIZE1 POS2 SIZE2)
Documentation
Return non-nil if two rectangles intersect.
POS1 and POS2 specify the positions of the upper-left corners of the first and second rectangles as conses of the form (COLUMN . LINE). SIZE1 and SIZE2 specify the dimensions of the first and second rectangles, as conses of the form (WIDTH . HEIGHT).
Source Code
;; Defined in /usr/src/emacs/lisp/rect.el.gz
(defun rectangle-intersect-p (pos1 size1 pos2 size2)
"Return non-nil if two rectangles intersect.
POS1 and POS2 specify the positions of the upper-left corners of
the first and second rectangles as conses of the form (COLUMN . LINE).
SIZE1 and SIZE2 specify the dimensions of the first and second
rectangles, as conses of the form (WIDTH . HEIGHT)."
(let ((x1 (car pos1))
(y1 (cdr pos1))
(x2 (car pos2))
(y2 (cdr pos2))
(w1 (car size1))
(h1 (cdr size1))
(w2 (car size2))
(h2 (cdr size2)))
(not (or (<= (+ x1 w1) x2)
(<= (+ x2 w2) x1)
(<= (+ y1 h1) y2)
(<= (+ y2 h2) y1)))))