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

Function match_circle_coll_eqangle_midp

dd.py:170–209  ·  view source on GitHub ↗

Match circle O A B C, coll M B C, eqangle A B A C O B O M => midp M B C.

(
    g: gh.Graph,
    g_matcher: Callable[str, list[tuple[gm.Point, ...]]],
    theorem: pr.Theorem,
)

Source from the content-addressed store, hash-verified

168
169
170def match_circle_coll_eqangle_midp(
171 g: gh.Graph,
172 g_matcher: Callable[str, list[tuple[gm.Point, ...]]],
173 theorem: pr.Theorem,
174) -> Generator[dict[str, gm.Point], None, None]:
175 """Match circle O A B C, coll M B C, eqangle A B A C O B O M => midp M B C."""
176 for p, a, b, c in g.all_circles():
177 ab = g._get_line(a, b)
178 if ab is None:
179 continue
180 if ab.val is None:
181 continue
182 ac = g._get_line(a, c)
183 if ac is None:
184 continue
185 if ac.val is None:
186 continue
187 pb = g._get_line(p, b)
188 if pb is None:
189 continue
190 if pb.val is None:
191 continue
192
193 bc = g._get_line(b, c)
194 if bc is None:
195 continue
196 bc_points = bc.neighbors(gm.Point, return_set=True)
197
198 anga, _ = g._get_angle(ab.val, ac.val)
199
200 for angp in pb.val.neighbors(gm.Angle):
201 if not g.is_equal(anga, angp):
202 continue
203
204 _, d = angp.directions
205 for l in d.neighbors(gm.Line):
206 l_points = l.neighbors(gm.Point, return_set=True)
207 m = intersect1(bc_points, l_points)
208 if m is not None:
209 yield dict(zip('ABCMO', [a, b, c, m, p]))
210
211
212def match_midp_perp_cong(

Callers

nothing calls this directly

Calls 6

intersect1Function · 0.85
all_circlesMethod · 0.80
_get_lineMethod · 0.80
neighborsMethod · 0.80
_get_angleMethod · 0.80
is_equalMethod · 0.80

Tested by

no test coverage detected