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

Function line_line_intersection

numericals.py:577–585  ·  view source on GitHub ↗
(l1: Line, l2: Line)

Source from the content-addressed store, hash-verified

575
576
577def line_line_intersection(l1: Line, l2: Line) -> Point:
578 a1, b1, c1 = l1.coefficients
579 a2, b2, c2 = l2.coefficients
580 # a1x + b1y + c1 = 0
581 # a2x + b2y + c2 = 0
582 d = a1 * b2 - a2 * b1
583 if d == 0:
584 raise InvalidLineIntersectError
585 return Point((c2 * b1 - c1 * b2) / d, (c1 * a2 - c2 * a1) / d)
586
587
588def check_too_close(

Callers 15

test_sketch_bisectMethod · 0.85
footMethod · 0.85
intersectMethod · 0.85
intersectMethod · 0.85
__init__Method · 0.85
bring_togetherFunction · 0.85
highlightFunction · 0.85
sketch_incenter2Function · 0.85
sketch_excenter2Function · 0.85
sketch_centroidFunction · 0.85
sketch_2l1cFunction · 0.85
sketch_3peqFunction · 0.85

Calls 1

PointClass · 0.70

Tested by 1

test_sketch_bisectMethod · 0.68