From a non-manifold OFF file, construct the constrained Delaunay triangulation.
From a non-manifold OFF file, construct the constrained Delaunay triangulation.
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/remesh_planar_patches.h>
#include <CGAL/make_conforming_constrained_Delaunay_triangulation_3.h>
#include <CGAL/IO/write_MEDIT.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
using face_descriptor = boost::graph_traits<Mesh>::face_descriptor;
int main(int argc, char* argv[])
{
std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cross.off");
Mesh input;
std::cerr << "Invalid input." << std::endl;
return 1;
}
<< input.number_of_faces() << " facets\n";
Mesh mesh;
auto plc_facet_map = get(CGAL::face_patch_id_t<int>(), mesh);
CGAL::parameters::face_patch_map(plc_facet_map)
.do_not_triangulate_faces(true));
filename = argc > 2 ? argv[2] : "mesh.ply";
CGAL::parameters::stream_precision(17));
std::cout << "Wrote segmented mesh to " << filename << "\n";
CGAL::parameters::plc_face_id(plc_facet_map));
std::cout << "Number of vertices in the CDT: "
<< ccdt.triangulation().number_of_vertices() << '\n'
<< "Number of constrained facets in the CDT: "
<< ccdt.number_of_constrained_facets() << '\n';
filename = argc > 3 ? argv[3] : "out.mesh";
std::ofstream out(filename);
out.precision(17);
std::cout << "Wrote CDT to " << filename << "\n";
return EXIT_SUCCESS;
}
size_type number_of_vertices() const
bool read_polygon_mesh(const std::string &fname, PolygonMesh &g, const NamedParameters &np=parameters::default_values())
void remesh_planar_patches(const TriangleMeshIn &tm_in, PolygonMeshOut &pm_out, const NamedParametersIn &np_in=parameters::default_values(), const NamedParametersOut &np_out=parameters::default_values())
bool write_polygon_mesh(const std::string &fname, Graph &g, const NamedParameters &np=parameters::default_values())
auto make_conforming_constrained_Delaunay_triangulation_3(const PolygonMesh &mesh, const NamedParameters &np=parameters::default_values())
creates a 3D constrained Delaunay triangulation conforming to the faces of a polygon mesh.
Definition: make_conforming_constrained_Delaunay_triangulation_3.h:146
void write_MEDIT(std::ostream &os, const T3 &t3, const NamedParameters &np=parameters::default_values())
Default_named_parameters default_values()