MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / include_rect

Method include_rect

src/__init__.py:14701–14714  ·  view source on GitHub ↗

Extend to include rect-like r.

(self, r)

Source from the content-addressed store, hash-verified

14699 return self
14700
14701 def include_rect(self, r):
14702 """Extend to include rect-like r."""
14703 if len(r) != 4:
14704 raise ValueError("Rect: bad seq len")
14705 r = Rect(r)
14706 if r.is_infinite or self.is_infinite:
14707 self.x0, self.y0, self.x1, self.y1 = FZ_MIN_INF_RECT, FZ_MIN_INF_RECT, FZ_MAX_INF_RECT, FZ_MAX_INF_RECT
14708 elif r.is_empty:
14709 return self
14710 elif self.is_empty:
14711 self.x0, self.y0, self.x1, self.y1 = r.x0, r.y0, r.x1, r.y1
14712 else:
14713 self.x0, self.y0, self.x1, self.y1 = util_union_rect(self, r)
14714 return self
14715
14716 def intersect(self, r):
14717 """Restrict to common rect with rect-like r."""

Callers 3

__or__Method · 0.95
test_rectFunction · 0.95
include_rectMethod · 0.45

Calls 2

RectClass · 0.85
util_union_rectFunction · 0.85

Tested by 1

test_rectFunction · 0.76