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

Method make_equal

graph.py:1005–1029  ·  view source on GitHub ↗

Make that two nodes x and y are equal, i.e. merge their value node.

(self, x: gm.Node, y: gm.Node, deps: Dependency)

Source from the content-addressed store, hash-verified

1003 return nm.check_sameside([p.num for p in points])
1004
1005 def make_equal(self, x: gm.Node, y: gm.Node, deps: Dependency) -> None:
1006 """Make that two nodes x and y are equal, i.e. merge their value node."""
1007 if x.val is None:
1008 x, y = y, x
1009
1010 self.connect_val(x, deps=None)
1011 self.connect_val(y, deps=None)
1012 vx = x._val
1013 vy = y._val
1014
1015 if vx == vy:
1016 return
1017
1018 merges = [vx, vy]
1019
1020 if (
1021 isinstance(x, Angle)
1022 and x not in self.aconst.values()
1023 and y not in self.aconst.values()
1024 and x.directions == y.directions[::-1]
1025 and x.directions[0] != x.directions[1]
1026 ):
1027 merges = [self.vhalfpi, vx, vy]
1028
1029 self.merge(merges, deps)
1030
1031 def merge_vals(self, vx: gm.Node, vy: gm.Node, deps: Dependency) -> None:
1032 if vx == vy:

Callers 10

add_eqrat_constMethod · 0.95
do_algebraMethod · 0.95
add_paraMethod · 0.95
add_perpMethod · 0.95
add_congMethod · 0.95
make_equal_pairsMethod · 0.95
_add_eqangleMethod · 0.95
add_aconstMethod · 0.95
add_s_angleMethod · 0.95
_add_eqratioMethod · 0.95

Calls 2

connect_valMethod · 0.95
mergeMethod · 0.95

Tested by

no test coverage detected