def test_points_type(self, verts, faces, points): with pytest.raises( TypeError, match=r"Expected points entries to be torch.float32 " r"but got torch.float16."): points = points.half() mesh.check_sign(verts, faces, points)
def test_faces_with_zero_area(self, verts, faces, points, expected): faces = torch.cat([ faces, torch.tensor([[1, 1, 1], [0, 0, 0], [2, 2, 2], [3, 3, 3]]).to(faces.device) ]) output = mesh.check_sign(verts, faces, points) assert (torch.equal(output, expected))
def test_meshes(self, verts, faces, points, expected): output = mesh.check_sign(verts, faces, points) assert (torch.equal(output, expected))
def test_single_batch(self, verts, faces, points, expected): output = mesh.check_sign(verts[0:1], faces, points[0:1]) assert (torch.equal(output, expected[0:1]))
def test_points_shape(self, verts, faces, points): with pytest.raises(ValueError, match=r"Expected points to have 3 coordinates " r"but got 2 coordinates."): points = points[..., :2] mesh.check_sign(verts, faces, points)
def test_faces_shape(self, verts, faces, points): with pytest.raises(ValueError, match=r"Expected faces to have 3 vertices " r"but got 2 vertices."): faces = faces[:, :2] mesh.check_sign(verts, faces, points)
def test_points_ndim(self, verts, faces, points): with pytest.raises(ValueError, match=r"Expected points to have 3 dimensions " r"but got 4 dimensions."): points = points.unsqueeze(-1) mesh.check_sign(verts, faces, points)
def test_hash_resolution_type(self, verts, faces, points): with pytest.raises(TypeError, match=r"Expected hash_resolution to be int " r"but got <class 'float'>."): mesh.check_sign(verts, faces, points, 512.0)
def test_faces_type(self, verts, faces, points): with pytest.raises(TypeError, match=r"Expected faces entries to be torch.int64 " r"but got torch.int32."): faces = faces.int() mesh.check_sign(verts, faces, points)
def test_verts_type(self, verts, faces, points): with pytest.raises(TypeError, match=r"Expected verts entries to be torch.float32 " r"but got torch.float64."): verts = verts.double() mesh.check_sign(verts, faces, points)