1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
-
!
-
!
-
!
-
!
-
!
-
!
-
!
-
-
!
|
-
!
|
-
!
|
|
-
!
|
|
|
|
-
!
-
!
|
|
|
|
|
-
|
|
!
|
|
|
|
|
|
|
|
|
!
| #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Mesh_triangulation_3.h>
#include <CGAL/Mesh_complex_3_in_triangulation_3.h>
#include <CGAL/Mesh_criteria_3.h>
#include <CGAL/Polyhedral_mesh_domain_with_features_3.h>
#include <CGAL/make_mesh_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/IO/Complex_3_in_triangulation_3_to_vtk.h>
#include <vtkSmartPointer.h>
#include <vtkUnstructuredGrid.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include <string>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedral_mesh_domain_with_features_3<K> Mesh_domain;
typedef CGAL::Mesh_triangulation_3<Mesh_domain>::type Tr;
typedef CGAL::Mesh_complex_3_in_triangulation_3<
Tr,Mesh_domain::Corner_index,Mesh_domain::Curve_segment_index> C3t3;
typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
using namespace CGAL::parameters;
int main()
{
Mesh_domain domain("data/mesh.off");
domain.detect_features();
Mesh_criteria criteria(facet_angle=25, facet_size=0.3, edge_size=0.3, facet_distance=0.1,
cell_radius_edge_ratio=3);
C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
lloyd(time_limit=30),
no_exude(),
perturb(sliver_bound=10, time_limit=15));
Mesh_criteria new_criteria(cell_radius_edge_ratio=3, cell_size=0.4);
CGAL::refine_mesh_3(c3t3, domain, new_criteria);
CGAL::perturb_mesh_3(c3t3, domain, time_limit=15);
vtkSmartPointer<vtkUnstructuredGrid> output =
vtkSmartPointer<vtkUnstructuredGrid>::New();
CGAL::output_c3t3_to_vtk_unstructured_grid(c3t3, output);
vtkSmartPointer<vtkXMLUnstructuredGridWriter> writer =
vtkSmartPointer<vtkXMLUnstructuredGridWriter>::New();
writer->SetFileName("out.vtu");
writer->SetInputData(output);
writer->Update();
}
|