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

Function sketch_aline

numericals.py:1489–1507  ·  view source on GitHub ↗

Sketch the construction aline.

(args: tuple[gm.Point, ...])

Source from the content-addressed store, hash-verified

1487
1488
1489def sketch_aline(args: tuple[gm.Point, ...]) -> HalfLine:
1490 """Sketch the construction aline."""
1491 A, B, C, D, E = args
1492 ab = A - B
1493 cb = C - B
1494 de = D - E
1495
1496 dab = A.distance(B)
1497 ang_ab = np.arctan2(ab.y / dab, ab.x / dab)
1498
1499 dcb = C.distance(B)
1500 ang_bc = np.arctan2(cb.y / dcb, cb.x / dcb)
1501
1502 dde = D.distance(E)
1503 ang_de = np.arctan2(de.y / dde, de.x / dde)
1504
1505 ang_ex = ang_de + ang_bc - ang_ab
1506 X = E + Point(np.cos(ang_ex), np.sin(ang_ex))
1507 return HalfLine(E, X)
1508
1509
1510def sketch_amirror(args: tuple[gm.Point, ...]) -> HalfLine:

Callers 1

sketch_acircleFunction · 0.85

Calls 4

HalfLineClass · 0.85
cosMethod · 0.80
PointClass · 0.70
distanceMethod · 0.45

Tested by

no test coverage detected