Search code examples
c++file-iomeshcgal

What mesh file types are supported for input by the C++ library CGAL?


I've searched through the documentation, and it appears that they at least support .off files. http://doc.cgal.org/latest/Mesh_3/index.html

However, I want to know if they allow for input of STL files as well, before I trouble myself with trying to use the library.


Solution

  • There is a piece of code in CGAL-4.6/demo/Polyhedron/ that permits to load an STL file to a CGAL::Polyhedron_3 object. The demo allows to load an STL file, and then save to an OFF file.

    Alternatively, if you need to have a STL-loader inside your own code, you might copy-paste and adapt the existing code.

    The file is in demo/Polyhedron/Polyhedron_demo_stl_plugin.cpp and it uses an undocumented header file include/CGAL/IO/Polyhedron_builder_from_STL.h.