Wavefront OBJ reader for building CGAL::Polyhedron_3

CGAL provides high quality generic half-edge data structure for representing polyhedral surfaces as well as many algorithms for mesh processing. However, CGAL doesn’t have any in-build support for building a polyhedron from Wavefront OBJ or PLY file. The following code is a basic OBJ file loader which reads vertex coordinates and faces (can be polygons) from OBJ file. Note that it doesn’t read vertex normals, face normals, or texture coordinates. Code is well commented and should be fairly obvious.

importOBJ() Function

Using importOBJ()



  • Minliang Reply

    Thank you very much!

  • Andrei Serebro Reply

    Thank you very much for sharing this useful stuff!
    There is a small typo in the code above, though. It should be


    rather than


Write a comment, your thoughts are welcome: