def test_beamcirc_intersecting_fully_from_bottom_inside_center(): circ = Circle(Point([0, -0.5]), 3) beam = Probe(Point([-2, 0]), Point([2, 0]), 2) assert_allclose(beamcirc(beam, circ), 11.5955559562, rtol=1e-6)
def test_beamcirc_intersecting_fully(): circ = Circle(Point([0, 0]), 1) beam = Probe(Point([-2, 0]), Point([2, 0]), 2) assert_allclose(beamcirc(beam, circ), 3.14159265359, rtol=1e-6)
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)
def test_beamcirc_intersecting_fully_from_bottom_outside_center(): circ = Circle(Point([0, -1.5]), 3) beam = Probe(Point([-2, 0]), Point([2, 0]), 2) assert_allclose(beamcirc(beam, circ), 10.0257253792, rtol=1e-6)
def test_beamcirc_intersecting_partially_from_bottom_outside_center(): circ = Circle(Point([0, -1.5]), 1) beam = Probe(Point([-2, 0]), Point([2, 0]), 2) assert_allclose(beamcirc(beam, circ), 0.614184849304, rtol=1e-6)
def test_beamcirc_intersecting_partially_from_bottom_inside_center(): circ = Circle(Point([0, -0.5]), 1) beam = Probe(Point([-2, 0]), Point([2, 0]), 2) assert_allclose(beamcirc(beam, circ), 2.52740780429, rtol=1e-6)
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)
def test_beamcirc_nonintersecting_bottom(): circ = Circle(Point([0, -3]), 1) beam = Probe(Point([-2, 0]), Point([2, 0]), 2) assert_allclose(beamcirc(beam, circ), 0., rtol=1e-6)
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)
def test_beamcirc_vertical_intersection(): circ = Circle(Point([0, 0]), 1) beam = Probe(Point([-1, -1]), Point([1, 1]), 1) assert_allclose(beamcirc(beam, circ), 1.91322295498, rtol=1e-6)
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)