cgal
cgal copied to clipboard
Fairing of not so nice holes
Issue Details
Fairing after hole filling may lead to rather wrong results. This is probably due to the not very smooth surface around the hole, but it is worth to have a look if it can be made more robust.
Source Code
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/triangulate_hole.h>
#include <CGAL/Polygon_mesh_processing/measure.h>
#include <CGAL/Polygon_mesh_processing/border.h>
#include <fstream>
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
using Point_3 = Kernel::Point_3;
using Mesh = CGAL::Surface_mesh<Point_3>;
using halfedge_descriptor = boost::graph_traits<Mesh>::halfedge_descriptor;
int main(int argc, char* argv[])
{
Mesh m;
std::ifstream in("issue_7181.ply", std::ios_base::binary);
CGAL::IO::set_binary_mode (in);
CGAL::IO::read_PLY(in, m);
in.close();
halfedge_descriptor lh = CGAL::Polygon_mesh_processing::longest_border(m).first;
std::vector<halfedge_descriptor> boundaries;
CGAL::Polygon_mesh_processing::extract_boundary_cycles(m,std::back_inserter(boundaries));
for(halfedge_descriptor hd : boundaries){
CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(m, hd, CGAL::Emptyset_iterator(), CGAL::Emptyset_iterator());
}
std::ofstream out ("issue_7181_out.ply", std::ios_base::binary);
CGAL::IO::set_binary_mode (out);
CGAL::IO::write_PLY(out, m);
out.close();
return 0;
}
Changing the clamped / non-clamped of the cotan had some positive effects, see September weeks in https://cgalwiki.geometryfactory.com/CGAL/Members/wiki/GSoC2024/Mollification.
Code is in this branch