1 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
2
3 #include <CGAL/Mesh_triangulation_3.h>
4 #include <CGAL/Mesh_complex_3_in_triangulation_3.h>
5 #include <CGAL/Mesh_criteria_3.h>
6
7 #include <CGAL/Polyhedron_3.h>
8 #include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
9 #include <CGAL/make_mesh_3.h>
10 #include <CGAL/Timer.h>
11
12 // Domain
13 typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
14
15 typedef CGAL::Mesh_polyhedron_3<K>::type Polyhedron;
16
17 typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
18
19
20 // Triangulation
21 typedef CGAL::Mesh_triangulation_3<Mesh_domain,CGAL::Default,CGAL::Sequential_tag>::type Tr;
22
23 typedef CGAL::Mesh_complex_3_in_triangulation_3<
24 Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_index> C3t3;
25
26 // Criteria
27 typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
28
29 // To avoid verbose function and named parameters call
30 using namespace CGAL::parameters;
31
main(int argc,char * argv[])32 int main(int argc, char*argv[])
33 {
34 std::cout.precision(17);
35 std::cerr.precision(17);
36 const char* fname = (argc>1)?argv[1]:"data/horizons.off";
37 std::ifstream input(fname);
38 const char* fname2 = (argc>2)?argv[2]:"data/horizons-domain.off";
39 std::ifstream input2(fname2);
40 Polyhedron sm, smbounding;
41 input >> sm;
42 input2 >> smbounding;
43 if(input.fail()){
44 std::cerr << "Error: Cannot read file " << fname << std::endl;
45 return EXIT_FAILURE;
46 }
47 CGAL::Timer t;
48 t.start();
49 // Create domain
50 Mesh_domain domain(sm, smbounding);
51
52 // Get sharp features
53 domain.detect_features();
54
55 // Mesh criteria
56 Mesh_criteria criteria(edge_size = 0.025,
57 facet_angle = 25, facet_size = 0.05, facet_distance = 0.005,
58 cell_radius_edge_ratio = 3, cell_size = 0.05);
59
60 // Mesh generation
61 C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
62 no_perturb(), no_exude());
63
64 std::cerr << t.time() << " sec." << std::endl;
65 // Output
66 dump_c3t3(c3t3, "out");
67 }
68