int main(int , char** argv) { Tr tr; C2T3 c2t3(tr); std::ifstream ifs(argv[1]); if( !ifs ) { std::cerr << "Usage:\n" << " " << argv[0] << " FILE\n" << "\n" << " FILE must be " << format_cgal_description << "\n"; return EXIT_FAILURE; } std::cout << " Reading " << argv[1] << std::endl; if( CGAL::Mesh_3::input_mesh(ifs, c2t3, true, &std::cerr) ) // if( CGAL::input_pslg_from_medit(ifs, // c2t3, // true, // debug // &std::cout) ) // debug to cout { display_faces_counts(tr, " ", &std::cout); std::cout << "\n Statistics:\n"; std::cout << "(vertices)\n"; display_vertices_by_surface_indices_statistics(tr, " ", &std::cout); std::cout << "(facets)\n"; display_facets_by_surface_indices_statistics(c2t3, " ", &std::cout); Compute_min_angle<Tr> min_angle(tr); double min = 180; for(Tr::Finite_cells_iterator cit = tr.finite_cells_begin(); cit != tr.finite_cells_end(); ++cit) if(cit->is_in_domain()) { const double angle = min_angle(cit); if( angle < min ) min = angle; } std::cout << "\nmin angle: " << min << "\n"; return EXIT_SUCCESS; } else return EXIT_FAILURE; }
int main() { CGAL::Timer t; t.start(); // Define functions Function f1(&torus_function); Function f2(&sphere_function<5>); Function f3(&tanglecube_function); Function f4(&heart_function); Function f5(&klein_function); Function f6(&false_knot_function); Function f7(&knot1_function); Function f8(&octic_function); Function_vector v; v.push_back(&f1); //v.push_back(&f2); //v.push_back(&f3); //v.push_back(&f4); //v.push_back(&f5); //v.push_back(&f6); //v.push_back(&f7); //v.push_back(&f8); // Domain (Warning: Sphere_3 constructor uses square radius !) Mesh_domain domain(v, K::Sphere_3(CGAL::ORIGIN, 5.*5.), 1e-6); // Set mesh criteria Facet_criteria facet_criteria(30, 0.2, 0.02); // angle, size, approximation Cell_criteria cell_criteria(2., 0.4); // radius-edge ratio, size Mesh_criteria criteria(facet_criteria, cell_criteria); // Mesh generation C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_exude(), no_perturb()); // Perturbation (maximum cpu time: 10s, targeted dihedral angle: default) CGAL::perturb_mesh_3(c3t3, domain, time_limit = 10); // Exudation CGAL::exude_mesh_3(c3t3,12); CGAL::Random rand; t.stop(); std::cout << "Time elapsed for building the mesh: " << t.time() << std::endl; t.reset(); t.start(); int nr = 1500; std::vector<Point> points; points.reserve(nr); CGAL::Random_points_in_mesh_3<Point, C3t3, FastPolicy> g(c3t3); t.stop(); std::cout << "Time elapsed for init Random_points_in_mesh_3: " << t.time() << std::endl; t.reset(); t.start(); CGAL::cpp11::copy_n( g, nr, std::back_inserter(points)); t.stop(); std::cout << "Time elapsed for generating the points: " << t.time() << std::endl; t.reset(); Tr tr = c3t3.triangulation(); Tetrahedron3 tet; Tr::Finite_cells_iterator it = tr.finite_cells_begin(); for (; it != tr.finite_cells_end(); it++) { if (c3t3.is_in_complex(it)) { tet = tr.tetrahedron(it); break; } } t.start(); std::vector<Point> points_tet; points_tet.reserve(nr); CGAL::Random_points_in_tetrahedron_3<Point> g1(tet); CGAL::cpp11::copy_n(g1, nr, std::back_inserter(points_tet)); t.stop(); std::cout << "Time elapsed for " << nr << " points in one tetrahedron: " << t.time() << std::endl; t.reset(); std::cout << "The generated points are: " << std::endl; for (int i = 0; i < nr; i++) { std::cout << points[i].x() << " " << points[i].y() << " " << points[i].z() << std::endl; } points_tet.clear(); points.clear(); v.clear(); return 0; }