MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / add_eqangle

Method add_eqangle

ar.py:625–653  ·  view source on GitHub ↗

Add the inequality d1-d2=d3-d4.

(
      self,
      d1: gm.Direction,
      d2: gm.Direction,
      d3: gm.Direction,
      d4: gm.Direction,
      dep: pr.Dependency,
  )

Source from the content-addressed store, hash-verified

623 return super().add_eq3(d1, d2, ang, dep)
624
625 def add_eqangle(
626 self,
627 d1: gm.Direction,
628 d2: gm.Direction,
629 d3: gm.Direction,
630 d4: gm.Direction,
631 dep: pr.Dependency,
632 ) -> None:
633 """Add the inequality d1-d2=d3-d4."""
634 # Use string as variables.
635 l1, l2, l3, l4 = [d._obj.num for d in [d1, d2, d3, d4]] # pylint: disable=protected-access
636 d1, d2, d3, d4 = self.get_name([d1, d2, d3, d4])
637 ang1 = {d1: 1, d2: -1}
638 ang2 = {d3: 1, d4: -1}
639
640 if l2 > l1:
641 ang1 = plus({self.pi: 1}, ang1)
642 if l4 > l3:
643 ang2 = plus({self.pi: 1}, ang2)
644
645 ang12 = minus(ang1, ang2)
646 self.record_eq(d1, d2, d3, d4)
647 self.record_eq(d1, d3, d2, d4)
648
649 expr = list(ang12.items())
650 if not self.add_expr(expr):
651 return []
652
653 self.register(expr, dep)
654
655 def get_all_eqs_and_why(self) -> Generator[Any, None, None]:
656 return super().get_all_eqs_and_why(True)

Calls 6

plusFunction · 0.85
minusFunction · 0.85
get_nameMethod · 0.80
record_eqMethod · 0.80
add_exprMethod · 0.80
registerMethod · 0.80