Closed morgan-bc closed 3 years ago
You could switch back your mesh to a simple polygon soup, repair it, and then use CGAL's orientation functions which will duplicate your non-manifold elements as to get a valid 2D halfedge data structure.
This code is pretty much this pipeline, reading a polygon soup as input. All these functions are documented if you want further information about their inner workings (doc.cgal.org).
Does this work?
std::vector<Kernel::Point_3> points;
std::vector<CGAL_Polygon> polygons;
CGAL::Polygon_mesh_processing::polygon_mesh_to_polygon_soup(in,points,polygons);
//remove duplicated points and polygons
CGAL::Polygon_mesh_processing::orient_polygon_soup(points,polygons);
CGAL::Polygon_mesh_processing::merge_duplicate_points_in_polygon_soup(points,polygons);
CGAL::Polygon_mesh_processing::merge_duplicate_polygons_in_polygon_soup(points,polygons);
SMesh out;
CGAL::Polygon_mesh_processing::repair_polygon_soup(points,polygons,
CGAL::parameters::erase_all_duplicates(true).
require_same_orientation(true));
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points,polygons,out);
I tried in this way but the dupicated vertices are not removed
orient_polygon_soup()
should be the last step before polygon_soup_to_polygon_mesh()
.
Please use the following template to help us solving your issue.
Issue Details
I want to process dirty triangle meshes which may include many duplicated vertices and non-manifold faces using half-edge structure. I use openmesh to read the mesh. Is there any method in CGAL can remove duplicated vertices and construct right half-edge strcuture ?
Environment