def test_floating_volume_above_scene(self): model = Model() model.add_node(0, 0, 0) model.add_node(0, 1, 0) model.add_node(1, 1, 0) model.add_node(1, 0, 0) model.add_triangle(0, 1, 2) model.add_triangle(1, 2, 3) intersected_triangles = model.fresnel_zone_intersection(1, 1, Point3D(-0.5, 0, 2), Point3D(0.5, 0, 1)) self.assertEqual(intersected_triangles, [])
def test_volume_inside_scene(self): """Simple test with a planar scene and a cube on top of it""" # build a model with two triangles (z=0) model = Model() model.add_node(0, 0, 0) model.add_node(0, 1, 0) model.add_node(1, 1, 0) model.add_node(1, 0, 0) model.add_triangle(0, 1, 2) model.add_triangle(1, 2, 3) intersected_triangles = model.fresnel_zone_intersection(1, 1, Point3D(-0.5, 0, 0), Point3D(0.5, 0, 0)) self.assertEqual(intersected_triangles, [0, 1])
def test_volume_on_scene(self): """Simple test with a squared planar scene and a cube on top of it""" model = Model() model.add_node(0, 0, 0) model.add_node(0, 1, 0) model.add_node(1, 1, 0) model.add_node(2, 1, 0) model.add_node(1, 2, 0) model.add_triangle(0, 1, 2) model.add_triangle(2, 3, 4) # It is on the first triangle but not on the second one intersected_triangles = model.fresnel_zone_intersection(1, 1, Point3D(-0.5, 0, 0), Point3D(0.5, 0, 0)) self.assertEqual(intersected_triangles, [0])