1 #include <CGAL/Mesh_triangulation_3.h>
2 #include <CGAL/Mesh_complex_3_in_triangulation_3.h>
3 #include <CGAL/Mesh_criteria_3.h>
4
5 #include <CGAL/Polyhedron_3.h>
6 #include <CGAL/Polyhedral_mesh_domain_3.h>
7 #include <CGAL/make_mesh_3.h>
8 #include <CGAL/refine_mesh_3.h>
9
10 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
11 #include <CGAL/point_generators_3.h>
12
13 #include <iostream>
14 using namespace CGAL;
15
16 typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
17 typedef CGAL::Polyhedron_3<K> Polyhedron;
18 // Domain
19 typedef CGAL::Polyhedral_mesh_domain_3<Polyhedron, K> Mesh_domain;
20
21 #ifdef CGAL_CONCURRENT_MESH_3
22 typedef CGAL::Parallel_tag Concurrency_tag;
23 #else
24 typedef CGAL::Sequential_tag Concurrency_tag;
25 #endif
26
27 // Triangulation
28 typedef CGAL::Mesh_triangulation_3<
29 Mesh_domain,CGAL::Default,Concurrency_tag>::type Tr;
30
31 typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;
32
33 // Criteria
34 typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
35
36 // (Unweighted) point type
37 typedef Tr::Bare_point Point;
38
main()39 int main()
40 {
41 // Generated points are in that vector
42 std::vector<Point> points;
43 // Create input polyhedron
44 Polyhedron polyhedron;
45 polyhedron.make_tetrahedron(Point(-1,0,0), Point(0,1,0), Point(1,0,0), Point(0,0,-1));
46 // Create domain
47 Mesh_domain domain(polyhedron);
48 using namespace CGAL::parameters;
49 // Mesh criteria (no cell_size set)
50 Mesh_criteria criteria(facet_angle=25, facet_size=0.15, facet_distance=0.008,
51 cell_radius_edge_ratio=3);
52 // Mesh generation
53 C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude());
54
55 // Create the generator, input is the C3t3 c3t3
56 Random_points_in_tetrahedral_mesh_boundary_3<C3t3> g(c3t3);
57 // Get 100 random points in cdt
58 std::copy_n( g, 100, std::back_inserter(points));
59
60 // Check that we have really created 100 points.
61 assert( points.size() == 100);
62
63 // print the first point that was generated
64 std::cout << points[0] << std::endl;
65
66 return 0;
67 }
68
69
70