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

Function match_eqangle_para

dd.py:405–426  ·  view source on GitHub ↗

Match eqangle A B P Q C D P Q => para A B C D.

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

Source from the content-addressed store, hash-verified

403
404
405def match_eqangle_para(
406 g: gh.Graph,
407 g_matcher: Callable[str, list[tuple[gm.Point, ...]]],
408 theorem: pr.Theorem,
409) -> Generator[dict[str, gm.Point], None, None]:
410 """Match eqangle A B P Q C D P Q => para A B C D."""
411 for measure in g.type2nodes[gm.Measure]:
412 angs = measure.neighbors(gm.Angle)
413 d12, d21 = defaultdict(list), defaultdict(list)
414 for ang in angs:
415 d1, d2 = ang.directions
416 if d1 is None or d2 is None:
417 continue
418 d12[d1].append(d2)
419 d21[d2].append(d1)
420
421 for d1, d2s in d12.items():
422 a, b = g.two_points_on_direction(d1)
423 for d2, d3 in utils.comb2(d2s):
424 c, d = g.two_points_on_direction(d2)
425 e, f = g.two_points_on_direction(d3)
426 yield dict(zip('ABCDPQ', [c, d, e, f, a, b]))
427
428
429def match_cyclic_eqangle(

Callers

nothing calls this directly

Calls 2

neighborsMethod · 0.80

Tested by

no test coverage detected