Schimpf
Schimpf

Reputation: 23

CGAL: Cannot open .xyz file

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!

Upvotes: 0

Views: 312

Answers (1)

Schimpf
Schimpf

Reputation: 23

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

Upvotes: 2

Related Questions