Example #1
0
def test_line_segment_point_intersection4():
    """A single point intersection"""
    ls1 = LineSegment(Point(0, 4), Point(20, 4))
    ls2 = LineSegment(Point(0, 0), Point(20, 20))
    assert ls1.intersect(ls2) == Point(4, 4)
    assert ls2.intersect(ls1) == Point(4, 4)
Example #2
0
def test_line_segment_point_intersection_horizontal_vertical_cross():
    """A single point intersection"""
    ls1 = LineSegment(Point(-4, 0), Point(4, 0))
    ls2 = LineSegment(Point(0, -4), Point(0, 4))
    assert ls1.intersect(ls2) == Point(0, 0)
    assert ls2.intersect(ls1) == Point(0, 0)
Example #3
0
def test_line_segment_point_intersection2():
    """A single point intersection"""
    ls1 = LineSegment(Point(0, 0), Point(1, 1))
    ls2 = LineSegment(Point(1, 1), Point(1, 1))
    assert ls1.intersect(ls2) == Point(1, 1)
    assert ls2.intersect(ls1) == Point(1, 1)