Exemplo n.º 1
0
def test_beampoly_vertical_intersection():
    tri = Rectangle(Point([-5, 0]), Point([5, 0]), Point([5, 1]),
                    Point([-5, 1]))
    beam = Beam(Point([0, -1]), Point([0, 1]), 1)
    assert_allclose(beampoly(beam, tri), 1, rtol=1e-6)
Exemplo n.º 2
0
def test_beampoly_intersecting_partially_from_bottom():
    tri = Rectangle(Point([0, 0]), Point([1, 0]), Point([1, 1]), Point([0, 1]))
    beam = Beam(Point([-2, 0]), Point([2, 0]), 1)
    assert_allclose(beampoly(beam, tri), 1 / 2, rtol=1e-6)
Exemplo n.º 3
0
def test_beampoly_intersecting_fully():
    tri = Rectangle(Point([-1, -1]), Point([1, -1]), Point([1, 1]),
                    Point([-1, 1]))
    beam = Beam(Point([-2, 0]), Point([2, 0]), 3)
    assert_allclose(beampoly(beam, tri), 4, rtol=1e-6)
Exemplo n.º 4
0
def test_beampoly_nonintersecting_bottom():
    tri = Triangle(Point([0, 1]), Point([1, -1]), Point([-1, -1]))
    beam = Beam(Point([-2, -2]), Point([2, -2]), 2)
    assert_allclose(beampoly(beam, tri), 0., rtol=1e-6)