本文整理汇总了C++中Tr::tetrahedron方法的典型用法代码示例。如果您正苦于以下问题:C++ Tr::tetrahedron方法的具体用法?C++ Tr::tetrahedron怎么用?C++ Tr::tetrahedron使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tr
的用法示例。
在下文中一共展示了Tr::tetrahedron方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
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;
}