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

Function match_eqangle_ncoll_cyclic

dd.py:369–402  ·  view source on GitHub ↗

Match eqangle6 P A P B Q A Q B, ncoll P Q A B => cyclic A B P Q.

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

Source from the content-addressed store, hash-verified

367
368
369def match_eqangle_ncoll_cyclic(
370 g: gh.Graph,
371 g_matcher: Callable[str, list[tuple[gm.Point, ...]]],
372 theorem: pr.Theorem,
373) -> Generator[dict[str, gm.Point], None, None]:
374 """Match eqangle6 P A P B Q A Q B, ncoll P Q A B => cyclic A B P Q."""
375 for l1, l2, l3, l4 in g.all_eqangles_distinct_linepairss():
376 if len(set([l1, l2, l3, l4])) < 4:
377 continue # they all must be distinct.
378
379 p1s = l1.neighbors(gm.Point, return_set=True)
380 p2s = l2.neighbors(gm.Point, return_set=True)
381 p3s = l3.neighbors(gm.Point, return_set=True)
382 p4s = l4.neighbors(gm.Point, return_set=True)
383
384 p = intersect1(p1s, p2s)
385 if not p:
386 continue
387 q = intersect1(p3s, p4s)
388 if not q:
389 continue
390 a = intersect1(p1s, p3s)
391 if not a:
392 continue
393 b = intersect1(p2s, p4s)
394 if not b:
395 continue
396 if len(set([a, b, p, q])) < 4:
397 continue
398
399 if not g.check_ncoll([a, b, p, q]):
400 continue
401
402 yield dict(zip('ABPQ', [a, b, p, q]))
403
404
405def match_eqangle_para(

Callers

nothing calls this directly

Calls 4

intersect1Function · 0.85
neighborsMethod · 0.80
check_ncollMethod · 0.80

Tested by

no test coverage detected