#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
#include <CGAL/Polygon_mesh_processing/self_intersections.h>
#include <CGAL/boost/graph/copy_face_graph.h>
#include <CGAL/Polygon_mesh_processing/polygon_mesh_to_polygon_soup.h>
#include <CGAL/make_conforming_constrained_Delaunay_triangulation_3.h>
#include <CGAL/draw_constrained_triangulation_3.h>
#include <CGAL/IO/polygon_mesh_io.h>
#include <CGAL/IO/polygon_soup_io.h>
#include <CGAL/IO/write_MEDIT.h>
#include <vector>
using Point = K::Point_3;
bool verify_preconditions_mesh(const Surface_mesh& mesh)
{
Surface_mesh triangle_mesh;
if(!tri_ok)
return false;
}
template <typename PointRange, typename PolygonRange>
bool verify_preconditions_soup(const PointRange& points, const PolygonRange& polygons)
{
return !CGAL::Polygon_mesh_processing::does_polygon_soup_self_intersect(points, polygons);
}
int main(int argc, char* argv[])
{
const auto filename = (argc > 1) ? argv[1]
: CGAL::data_file_path("meshes/cubes.off");
using Points = std::vector<Point>;
using PLC_face = std::vector<std::size_t>;
using PLC_faces = std::vector<PLC_face>;
Points points;
PLC_faces faces;
{
std::cerr << "Error: cannot read file " << filename << std::endl;
return EXIT_FAILURE;
}
{
std::cout <<
"Number of facets in " << filename <<
": " << mesh.
number_of_faces() <<
"\n";
}
const bool is_polygon_mesh = !mesh.
is_empty();
if(is_polygon_mesh && !verify_preconditions_mesh(mesh))
{
std::cerr << "Error: input mesh is not a valid input for CCDT_3\n";
return EXIT_FAILURE;
}
else if(!verify_preconditions_soup(points, faces))
{
std::cerr << "Error: input polygon soup is not a valid input for CCDT_3\n";
return EXIT_FAILURE;
}
auto ccdt = is_polygon_mesh
if(ccdt.number_of_constrained_facets() == 0)
{
std::cerr << "Error: no constrained facets in the CDT.\n";
std::cerr << "Invalid input.\n";
return EXIT_SUCCESS;
}
std::cout << "Number of constrained facets in the CDT: "
<< ccdt.number_of_constrained_facets() << '\n';
std::ofstream ofs(argc > 2 ? argv[2] : "out.mesh");
ofs.precision(17);
return EXIT_SUCCESS;
}
size_type number_of_faces() const
bool read_polygon_soup(const std::string &fname, PointRange &points, PolygonRange &polygons, const NamedParameters &np=parameters::default_values())
void polygon_soup_to_polygon_mesh(const PointRange &points, const PolygonRange &polygons, PolygonMesh &out, const NamedParameters_PS &np_ps=parameters::default_values(), const NamedParameters_PM &np_pm=parameters::default_values())
bool is_polygon_soup_a_polygon_mesh(const PolygonRange &polygons)
bool does_self_intersect(const FaceRange &face_range, const TriangleMesh &tmesh, const NamedParameters &np=parameters::default_values())
bool triangulate_faces(FaceRange face_range, PolygonMesh &pmesh, const NamedParameters &np=parameters::default_values())
bool is_triangle_mesh(const FaceGraph &g)
void copy_face_graph(const SourceMesh &sm, TargetMesh &tm, const NamedParameters1 &np1=parameters::default_values(), const NamedParameters2 &np2=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 draw(const T3 &at3, const GSOptions &gso)
void write_MEDIT(std::ostream &os, const T3 &t3, const NamedParameters &np=parameters::default_values())