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

Function match_eqangle_perp_perp

dd.py:342–366  ·  view source on GitHub ↗

Match eqangle A B P Q C D U V, perp P Q U V => perp 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

340
341
342def match_eqangle_perp_perp(
343 g: gh.Graph,
344 g_matcher: Callable[str, list[tuple[gm.Point, ...]]],
345 theorem: pr.Theorem,
346) -> Generator[dict[str, gm.Point], None, None]:
347 """Match eqangle A B P Q C D U V, perp P Q U V => perp A B C D."""
348 for ang in g.vhalfpi.neighbors(gm.Angle):
349 # d1 perp d2
350 d1, d2 = ang.directions
351 if d1 is None or d2 is None:
352 continue
353 for d3, d4 in utils.comb2(g.type2nodes[gm.Direction]):
354 if d1 == d3 or d2 == d4:
355 continue
356 # if d1 - d3 = d2 - d4 => d3 perp d4
357 a13, a31 = g._get_angle(d1, d3)
358 a24, a42 = g._get_angle(d2, d4)
359 if a13 is None or a31 is None or a24 is None or a42 is None:
360 continue
361 if g.is_equal(a13, a24) and g.is_equal(a31, a42):
362 a, b = g.two_points_on_direction(d1)
363 c, d = g.two_points_on_direction(d2)
364 m, n = g.two_points_on_direction(d3)
365 p, q = g.two_points_on_direction(d4)
366 yield dict(zip('ABCDPQUV', [m, n, p, q, a, b, c, d]))
367
368
369def match_eqangle_ncoll_cyclic(

Callers

nothing calls this directly

Calls 4

neighborsMethod · 0.80
_get_angleMethod · 0.80
is_equalMethod · 0.80

Tested by

no test coverage detected