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

Function match_circle_eqangle_perp

dd.py:242–280  ·  view source on GitHub ↗

Match circle O A B C, eqangle A X A B C A C B => perp O A A X.

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

Source from the content-addressed store, hash-verified

240
241
242def match_circle_eqangle_perp(
243 g: gh.Graph,
244 g_matcher: Callable[str, list[tuple[gm.Point, ...]]],
245 theorem: pr.Theorem,
246) -> Generator[dict[str, gm.Point], None, None]:
247 """Match circle O A B C, eqangle A X A B C A C B => perp O A A X."""
248 for p, a, b, c in g.all_circles():
249 ca = g._get_line(c, a)
250 if ca is None:
251 continue
252 cb = g._get_line(c, b)
253 if cb is None:
254 continue
255 ab = g._get_line(a, b)
256 if ab is None:
257 continue
258
259 if ca.val is None:
260 continue
261 if cb.val is None:
262 continue
263 if ab.val is None:
264 continue
265
266 c_ang, _ = g._get_angle(cb.val, ca.val)
267 if c_ang is None:
268 continue
269
270 for ang in ab.val.neighbors(gm.Angle):
271 if g.is_equal(ang, c_ang):
272 _, d = ang.directions
273 for l in d.neighbors(gm.Line):
274 if a not in l.neighbors(gm.Point):
275 continue
276 x = diff_point(l, a)
277 if x is None:
278 continue
279 yield dict(zip('OABCX', [p, a, b, c, x]))
280 break
281
282
283def match_circle_perp_eqangle(

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected