Пример #1
0
 def test_intersections_2(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, 1)
     direction = (0, 0, -1)
     # Assert two intersection points
     assert np.allclose(m.intersections(position, direction),
                        ((0.0, 0.0, 1.0), (0.0, 0.0, -1.0)))
Пример #2
0
 def test_far_point_arg_to_is_entering_raises(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, -1.1)
     direction = (0, 0, -1)  # travelling away
     try:
         m.is_entering(position, direction)
     except GeometryError:
         assert True
     else:
         assert False, "Expected GeometryError to be raised."
Пример #3
0
 def test_interior_point_arg_to_is_entering_raises(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, -0.9)
     direction = (0, 0, -1)
     try:
         m.is_entering(position, direction)
     except GeometryError:
         # Raises because point is not on surface
         assert True
     else:
         assert False, "Expected GeometryError to be raised."
Пример #4
0
 def test_surface_point_is_exiting_2(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, -1)
     direction = (0, 0, -1)
     # Assert surface point is entering
     assert m.is_entering(position, direction) == False
Пример #5
0
 def test_init(self):
     assert type(Mesh(trimesh.creation.icosphere())) == Mesh
Пример #6
0
 def test_on_surface(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, 1.0)
     # Assert not on surface
     assert m.is_on_surface(position) == True
Пример #7
0
 def test_interior_point_not_on_surface(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, 0.9)
     # Assert not on surface
     assert m.is_on_surface(position) == False
Пример #8
0
 def test_surface_point_not_contained(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, 1.0)
     # Assert not contained
     assert m.contains(position) == False
Пример #9
0
 def test_interior_point_contained(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, 0.9)
     # Assert not contained
     assert m.contains(position) == True
Пример #10
0
 def test_intersection_5(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, -1.1)
     direction = (0, 0, -1)
     # Assert zero intersection points
     assert len(m.intersections(position, direction)) == 0
Пример #11
0
 def test_is_entering_2(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, -1.0)
     direction = (0, 0, 1.0)  # Travelling towards, is entering
     assert m.is_entering(position, direction) == True
Пример #12
0
 def test_is_entering_1(self):
     m = Mesh(trimesh.creation.icosphere())
     position = (0, 0, -1.0)
     direction = (0, 0, -1)  # Travelling away, not entering
     assert m.is_entering(position, direction) == False