Add the inequality d1-d2=d3-d4.
(
self,
d1: gm.Direction,
d2: gm.Direction,
d3: gm.Direction,
d4: gm.Direction,
dep: pr.Dependency,
)
| 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) |