CDT++
Causal Dynamical Triangulations in C++
Loading...
Searching...
No Matches
Periodic_3_complex.hpp
Go to the documentation of this file.
1
6
10
11#ifndef INCLUDE_PERIODIC_3_COMPLEX_HPP_
12#define INCLUDE_PERIODIC_3_COMPLEX_HPP_
13
14#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
15#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
16#include <CGAL/Periodic_3_triangulation_traits_3.h>
17#include <CGAL/point_generators_3.h>
18#include <CGAL/Random.h>
19#include <CGAL/Timer.h>
20
21#include <cassert>
22#include <vector>
23
24using K = CGAL::Exact_predicates_inexact_constructions_kernel;
25using GT = CGAL::Periodic_3_triangulation_traits_3<K>;
26using PDT = CGAL::Periodic_3_Delaunay_triangulation_3<GT>;
27
30 int number_of_simplices) noexcept
31{
32 typedef CGAL::Creator_uniform_3<double, PDT::Point> Creator;
33 CGAL::Random random(7);
34 CGAL::Random_points_in_cube_3<PDT::Point, Creator> in_cube(.5, random);
35
38 int n = number_of_simplices / 6;
39 std::vector<PDT::Point> pts;
40
41 // Generate random points
42 for (int i = 0; i < n; i++)
43 {
44 PDT::Point p = *in_cube;
45 in_cube++;
46 pts.emplace_back(PDT::Point(p.x() + .5, p.y() + .5, p.z() + .5));
47 }
48
49 // Iterator range insertion using spatial sorting and dummy point heuristic
50 T3->insert(pts.begin(), pts.end(), true);
51
52 assert(T3->dimension() == 3);
53 assert(T3->is_valid());
54}
55#endif // INCLUDE_PERIODIC_3_COMPLEX_HPP_
void make_random_T3_simplicial_complex(PDT *T3, int number_of_simplices) noexcept
Make 3D toroidal (periodic in 3D) simplicial complexes.