Esempio n. 1
0
def test_beampoly_nonintersecting_bottom():
    tri = Triangle(Point([0, 1]), Point([1, -1]), Point([-1, -1]))
    beam = Probe(Point([-2, -2]), Point([2, -2]), 2)
    assert_allclose(beampoly(beam, tri), 0., rtol=1e-6)
Esempio n. 2
0
def test_beampoly_intersecting_partially_from_bottom():
    tri = Square(Point([0.5, 0.5]), side_length=1.0)
    beam = Probe(Point([-2, 0]), Point([2, 0]), 1)
    assert_allclose(beampoly(beam, tri), 1 / 2, rtol=1e-6)
Esempio n. 3
0
def test_beampoly_intersecting_fully():
    tri = Square(Point([0, 0]), side_length=2.0)
    beam = Probe(Point([-2, 0]), Point([2, 0]), 3)
    assert_allclose(beampoly(beam, tri), 4, rtol=1e-6)
Esempio n. 4
0
def test_beampoly_vertical_intersection():
    tri = Rectangle(Point([0, 0.5]), side_lengths=[10, 1])
    beam = Probe(Point([0, -1]), Point([0, 1]), 1)
    assert_allclose(beampoly(beam, tri), 1, rtol=1e-6)
Esempio n. 5
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)
Esempio n. 6
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)
Esempio n. 7
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)
Esempio n. 8
0
def test_beampoly_intersecting_partially_from_bottom():
    tri = Square(Point([0.5, 0.5]), side_length=1.0)
    beam = Probe(Point([-2, 0]), Point([2, 0]), 1)
    assert_allclose(beampoly(beam, tri), 1/2, rtol=1e-6)
Esempio n. 9
0
def test_beampoly_nonintersecting_bottom():
    tri = Triangle(Point([0, 1]), Point([1, -1]), Point([-1, -1]))
    beam = Probe(Point([-2, -2]), Point([2, -2]), 2)
    assert_allclose(beampoly(beam, tri), 0., rtol=1e-6)
Esempio n. 10
0
def test_beampoly_vertical_intersection():
    tri = Rectangle(Point([0, 0.5]), side_lengths=[10, 1])
    beam = Probe(Point([0, -1]), Point([0, 1]), 1)
    assert_allclose(beampoly(beam, tri), 1, rtol=1e-6)
Esempio n. 11
0
def test_beampoly_intersecting_fully():
    tri = Square(Point([0, 0]), side_length=2.0)
    beam = Probe(Point([-2, 0]), Point([2, 0]), 3)
    assert_allclose(beampoly(beam, tri), 4, rtol=1e-6)