Esempio n. 1
0
 def test_sample_points_with_areas(self, vertices, faces, dtype, device):
     num_samples = 1000
     face_areas = mesh.face_areas(vertices, faces)
     points1, face_choices1 = with_seed(1234)(mesh.sample_points)(
         vertices, faces, num_samples, face_areas)
     points2, face_choices2 = with_seed(1234)(mesh.sample_points)(
         vertices, faces, num_samples)
     assert torch.allclose(points1, points2)
     assert torch.equal(face_choices1, face_choices2)
Esempio n. 2
0
 def test_face_areas(self, device, dtype):
     vertices = torch.tensor(
         [[[0., 0., 0.], [0., 0., 1.], [0., 1., 0.], [2., 0., 0.2]],
          [[-1., -1., -1.], [-1., -1., 1.], [-1, 1., -1.], [3, -1., -0.6]]],
         device=device,
         dtype=dtype)
     faces = torch.tensor([[0, 1, 2], [1, 0, 3]],
                          device=device,
                          dtype=torch.long)
     output = mesh.face_areas(vertices, faces)
     expected_output = torch.tensor([[0.5, 1.], [2., 4.]],
                                    device=device,
                                    dtype=dtype)
     assert torch.equal(output, expected_output)