blob: bfb6560626e7af3125f9a7d5e6ae62dee968e6b3 (
plain)
1
2
3
4
5
6
7
8
9
10
|
from geometry import Line, Point, gradient, intersection
ln1 = Line(start=Point(coord_x=0, coord_y=0), end=Point(coord_x=1, coord_y=2))
ln2 = Line(start=Point(coord_x=1, coord_y=1), end=Point(coord_x=2, coord_y=2))
assert gradient(ln1) == 2
assert gradient(ln2) == 1
assert intersection(ln1, ln2) == Point(coord_x=0, coord_y=0)
assert intersection(ln1, ln1) is None
|