#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/detect_features.h>
#include <CGAL/Polygon_mesh_processing/remesh.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <iostream>
#include <string>
using face_descriptor = boost::graph_traits<Mesh>::face_descriptor;
namespace PMP = CGAL::Polygon_mesh_processing;
struct Border_pmap
{
typedef boost::graph_traits<Mesh>::edge_descriptor key_type;
typedef bool value_type;
typedef value_type reference;
typedef boost::readable_property_map_tag category;
Border_pmap(const Mesh& m)
: m_mesh(m) {}
inline friend value_type get(const Border_pmap& bmp, const key_type& e)
{
return is_border(e, bmp.m_mesh);
}
const Mesh& m_mesh;
};
int main(int argc, char* argv[])
{
const std::string filename = (argc > 1)
? argv[1]
Mesh mesh;
if(!PMP::IO::read_polygon_mesh(filename, mesh)) {
std::cerr << "Invalid input." << std::endl;
return 1;
}
boost::property_map<Mesh, CGAL::edge_is_feature_t>::type
eif = get(CGAL::edge_is_feature, mesh);
boost::property_map<Mesh, CGAL::face_patch_id_t<int>>::type
pid = get(CGAL::face_patch_id_t<int>(), mesh);
std::size_t number_of_patches =
std::cout << "The input mesh has been segmented into " << number_of_patches << " patches." << std::endl;
0.1,
mesh,
PMP::parameters::edge_is_protected_map(Border_pmap(mesh))
.face_patch_map(pid)
.edge_is_constrained_map(eif)
.number_of_iterations(3));
std::cout << "Remeshing done." << std::endl;
CGAL::parameters::stream_precision(17));
return EXIT_SUCCESS;
}
boost::graph_traits< PolygonMesh >::faces_size_type sharp_edges_segmentation(const PolygonMesh &pmesh, FT angle_in_deg, EdgeIsFeatureMap edge_is_feature_map, PatchIdMap patch_id_map, const NamedParameters &np=parameters::default_values())
void isotropic_remeshing(const FaceRange &faces, SizingFunction &sizing, PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
remeshes a triangulated region of a polygon mesh.
Definition: remesh.h:226
bool write_polygon_mesh(const std::string &fname, Graph &g, const NamedParameters &np=parameters::default_values())
std::string data_file_path(const std::string &filename)