Closed stla closed 2 years ago
You need to assign to each vertex an index that you will then use when describing a face.
You can use the following code to set and get the id of a vertex per face (did not try to compile it).
int i=0;
std::unordered_map<AFS_Tds2::Vertex_Handle, int> v2i;
auto get_face_id = [&v2i, &i](AFS_Tds2::Vertex_Handle v)
{
auto insert_res = v2i.insert( std::make_pair(v, i));
if (insert_res.second) ++i;
return insert_res.first->second;
};
....
int vid = get_face_id(ch->vertex(i));
Even simpler, adapt the following example: https://doc.cgal.org/latest/Advancing_front_surface_reconstruction/Advancing_front_surface_reconstruction_2reconstruction_surface_mesh_8cpp-example.html
Vertices are provided by batch and you have a call to operator() per face.
Thanks. When I deal with C++ I'm playing beyond my skills. Here I see a vector of Facet
which is declared (std::vector<Facet> facets;
) but it is used nowhere. Is it normal?
Indeed, I guess at first @afabri wanted to fill a soup but decided to fill a Surface_mesh
instead. @afabri would you mind fixing it?
If you want to use the two vectors instead of the mesh, simply push_back points and faces in the constructor and operator=.
Hello,
When I do an Advanced Front Surface reconstruction, I end up with duplicated vertices and the triangles indices are simply 1, 2, 3 - 4, 5, 6 - ...
The result is sent to R and I do the mesh cleaning in R, with the Rvcg package. It removes the duplicated vertices and recalculates the faces indices. Is it possible to do that with CGAL?
Below is my code but it uses the Rcpp library, this is the library which allows to combine R and C++.