Пример #1
0
 def test_diff_sample_points(self, vertices, faces, device, dtype):
     num_samples = 1000
     points1, face_choices1 = with_seed(1234)(mesh.sample_points)(
         vertices, faces, num_samples)
     points2, face_choices2 = with_seed(1235)(mesh.sample_points)(
         vertices, faces, num_samples)
     assert not torch.equal(points1, points2)
     assert not torch.equal(face_choices1, face_choices2)
Пример #2
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)
Пример #3
0
    def test_diff_packed_sample_points(self, packed_vertices_info,
                                       packed_faces_info, dtype, device):
        num_samples = 1000
        vertices, first_idx_vertices = packed_vertices_info
        faces, num_faces_per_mesh = packed_faces_info

        points1, face_choices1 = with_seed(1234)(
            mesh.packed_sample_points)(vertices, first_idx_vertices, faces,
                                       num_faces_per_mesh, num_samples)
        points2, face_choices2 = with_seed(1235)(
            mesh.packed_sample_points)(vertices, first_idx_vertices, faces,
                                       num_faces_per_mesh, num_samples)

        assert not torch.equal(points1, points2)
        assert not torch.equal(face_choices1, face_choices2)
Пример #4
0
    def test_packed_sample_points_with_areas(self, packed_vertices_info,
                                             packed_faces_info, dtype, device):
        num_samples = 1000
        vertices, first_idx_vertices = packed_vertices_info
        faces, num_faces_per_mesh = packed_faces_info

        face_areas = mesh.packed_face_areas(vertices, first_idx_vertices,
                                            faces, num_faces_per_mesh)

        points1, face_choices1 = with_seed(1234)(mesh.packed_sample_points)(
            vertices, first_idx_vertices, faces, num_faces_per_mesh,
            num_samples, face_areas)

        points2, face_choices2 = with_seed(1234)(
            mesh.packed_sample_points)(vertices, first_idx_vertices, faces,
                                       num_faces_per_mesh, num_samples)

        assert torch.allclose(points1, points2)
        assert torch.equal(face_choices1, face_choices2)