0

I am working with the CGAL example example\Poisson_surface_reconstruction_3\poisson_reconstruction_example.cpp.

I am able to make it with CMake and can build and run it with visual studio, but the program quits at the very beginning with "Error: cannot read file data/kitten.xyz". I checked and the kitten.xyz file is in the data folder and can be opened with software like CloudCompare. I have also tried some other .xyz files, but none of them could be opened.

This is the code used in the example:

 PointList points;
    std::ifstream stream("data/kitten.xyz");
    if (!stream ||
        !CGAL::read_xyz_points(
                              stream,
                              std::back_inserter(points),
                              CGAL::parameters::point_map (Point_map()).
                              normal_map (Normal_map())))
    {
      std::cerr << "Error: cannot read file data/kitten.xyz" << std::endl;
      return EXIT_FAILURE;
    }

This are the first couple lines of the kitten.xyz file:

-0.0721898 -0.159749 -0.108444 0.340472 0.937712 -0.0690972
0.145233 -0.163455 0.107108 0.821548 0.302589 0.483218
0.126784 -0.175123 -0.0474613 0.625688 0.275329 -0.729869
-0.0481776 -0.165903 -0.0696537 0.304957 0.95168 0.0361474
-0.061821 -0.160092 -0.0798811 0.303781 0.952723 0.00601667

Does anyone have an idea?

Thanks!

Schimpf
  • 23
  • 5
  • Can you narrow this down to opening and reading the file, or parsing it? If it's opening it, can you check the working directory is set in the project settings debug tab? It might be starting in the directory where the compiled binary is, not where you expect it to. – Rup May 18 '20 at 14:09
  • Actually I made a stupid mistake... I forgot to copy the data folder to my build directory. Sorry about that! It works now. – Schimpf May 18 '20 at 14:19

1 Answers1

2

In my case, I did not copy the data folder to my build directory, thus the .xyz file could not be found and opened.

Schimpf
  • 23
  • 5