I just spend few hours with CGAL in Visual Studio C++ trying to understand how meshes work. What I want to get is an access to list of vertices and triangles (vertices in form of double[3], triangles in form of int[3]). Here is the script I am working on:
http://doc.cgal.org/latest/Surface_mesher/Surface_mesher_2mesh_a_3d_gray_image_8cpp-example.html
The point is - function CGAL::output_surface_facets_to_off (out, c2t3);
outputs me a nice file in .off format (accessible by MeshLab), but I CAN'T DO ANY SIMILAR just by manipulating a c2t3
or tr
variable. What I was expecting was something like:
c2t3.vertices (from 0 to N), and c2t3.triangles (from 0 to M) with values of triple of integers. What I've got was list of vertices, list of facets, list of cells, list of edges... and no way to get vertices numbers from facets any other way than finding for every vertice number in nonsorted list of vertices.
Can anybody solve my problem and point what I am doing wrong? Also, API of CGAL is very... raw. Digging with source was also very hardcore - so much I couldn't find output_surface function body.