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

Method is_convex

src/__init__.py:14446–14465  ·  view source on GitHub ↗

Check if quad is convex and not degenerate. Notes: Check that for the two diagonals, the other two corners are not on the same side of the diagonal. Returns: True or False.

(self)

Source from the content-addressed store, hash-verified

14444
14445 @property
14446 def is_convex(self):
14447 """Check if quad is convex and not degenerate.
14448
14449 Notes:
14450 Check that for the two diagonals, the other two corners are not
14451 on the same side of the diagonal.
14452 Returns:
14453 True or False.
14454 """
14455 m = planish_line(self.ul, self.lr) # puts this diagonal on x-axis
14456 p1 = self.ll * m # transform the
14457 p2 = self.ur * m # other two points
14458 if p1.y * p2.y > 0:
14459 return False
14460 m = planish_line(self.ll, self.ur) # puts other diagonal on x-axis
14461 p1 = self.lr * m # transform the
14462 p2 = self.ul * m # remaining points
14463 if p1.y * p2.y > 0:
14464 return False
14465 return True
14466
14467 @property
14468 def is_empty(self):

Callers

nothing calls this directly

Calls 1

planish_lineFunction · 0.85

Tested by

no test coverage detected