I'm using CGAL 5.1 with a kernel of type typedef CGAL::Simple_cartesian<float> Kernel; and a surface mesh type typedef CGAL::Surface_mesh<Kernel::Point_3> Mesh;
I load the mesh via Assimp, and everything seems fine. But when I come to run an edge_collapse I get an assertion failure CGAL_assertion(resulting_vertex_count == vertices(m_tm).size()); And sure enough, doing the math on the total number of vertices minus the removed vertex count shows that it's off by one regardless of the ratio I set.
The relevant code is:
if(!CGAL::is_triangle_mesh(*node->mesh_info.mesh))
{
std::cerr << "Input geometry is not triangulated." << std::endl;
return;
}
if(!is_valid_polygon_mesh(*node->mesh_info.mesh))
{
std::cerr << "Input geometry is not valid." << std::endl;
return;
}
SMS::Count_ratio_stop_predicate<Mesh> stop(reduction);
SMS::edge_collapse(*node->mesh_info.mesh, stop);
The two tests pass ok, so is there something obvious I'm missing? I've not tried the other algorithms yet, or set any of the optional properties. I've cleaned up the mesh using Assimp's tools for removing degenerate faces and edges, and merging coincident vertices, but I've not tried any of CGAL's tools.
I do have a "v:uv" property on each vertex, but the position property is whatever the default is.
If anyone could give me a sanity check, I'd appreciate it!