How to Check if Rectangles are Disjoint - pymupdf/PyMuPDF GitHub Wiki
Algebraic functions of rectangles and points can be used to check inclusion and intersection of such objects. Questions like "Are rectangles R1 and R2 disjoint?" or "Is point P outside or inside rectangle R?" can easily be answered.
-
r1.intersects(r2): is
Trueifr1has a non-empty intersection with rectangler2. -
r1.contains(x): is
Trueif the rectangle or pointxis contained in rectangler1. This is equivalent to the expressionx in r1.