summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/example
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-06-22 15:50:51 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-06-22 15:50:51 +0000
commitc5ccdfae66f8e3a33bec20a310df134d3e1ab4bf (patch)
treeaf67107d8009259621f872ed9cab59e0805cea62 /src/Alpha_complex/example
parent138ee2657f03206209ff5c7d6c4392168beef819 (diff)
Compiles run and tests for Alpha_3d, exact, weighted, periodic and weighted periodic
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3627 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: e24d7de108d3e77eaf6319a8165a7c65bec57884
Diffstat (limited to 'src/Alpha_complex/example')
-rw-r--r--src/Alpha_complex/example/traits_test.cpp170
1 files changed, 163 insertions, 7 deletions
diff --git a/src/Alpha_complex/example/traits_test.cpp b/src/Alpha_complex/example/traits_test.cpp
index 3be62ad3..1dd062de 100644
--- a/src/Alpha_complex/example/traits_test.cpp
+++ b/src/Alpha_complex/example/traits_test.cpp
@@ -5,6 +5,7 @@
#include <string>
#include <vector>
#include <limits> // for numeric limits
+#include <random>
void usage(int nbArgs, char * const progName) {
std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n";
@@ -31,6 +32,21 @@ int main(int argc, char **argv) {
Gudhi::Simplex_tree<> stree;
alpha_complex.create_complex(stree);
+ std::cout << "Exact alpha complex 3d" << std::endl;
+ using Exact_alpha_shapes_3d = Gudhi::alpha_complex::Exact_alpha_shapes_3d;
+ std::vector<Exact_alpha_shapes_3d::Point_3> e_points;
+ e_points.push_back(Exact_alpha_shapes_3d::Point_3(0.0, 0.0, 0.0));
+ e_points.push_back(Exact_alpha_shapes_3d::Point_3(0.0, 0.0, 0.2));
+ e_points.push_back(Exact_alpha_shapes_3d::Point_3(0.2, 0.0, 0.2));
+ e_points.push_back(Exact_alpha_shapes_3d::Point_3(0.6, 0.6, 0.0));
+ e_points.push_back(Exact_alpha_shapes_3d::Point_3(0.8, 0.8, 0.2));
+ e_points.push_back(Exact_alpha_shapes_3d::Point_3(0.2, 0.8, 0.6));
+
+ Gudhi::alpha_complex::Alpha_complex_3d<Exact_alpha_shapes_3d> exact_alpha_complex(e_points);
+
+ Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence> exact_stree;
+ exact_alpha_complex.create_complex(exact_stree);
+
std::cout << "Weighted alpha complex 3d" << std::endl;
using Weighted_alpha_shapes_3d = Gudhi::alpha_complex::Weighted_alpha_shapes_3d;
std::vector<Weighted_alpha_shapes_3d::Point_3> w_points;
@@ -51,6 +67,7 @@ int main(int argc, char **argv) {
std::cout << "Periodic alpha complex 3d" << std::endl;
using Periodic_alpha_shapes_3d = Gudhi::alpha_complex::Periodic_alpha_shapes_3d;
std::vector<Periodic_alpha_shapes_3d::Point_3> p_points;
+
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.0));
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.2));
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.4));
@@ -131,8 +148,7 @@ int main(int argc, char **argv) {
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.0, 0.4));
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.0, 0.6));
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.0, 0.8));
- p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.0, 0.0));
- p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.1, 0.0)); //
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.1, 0.0));
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.0));
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.2));
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.4));
@@ -177,22 +193,162 @@ int main(int argc, char **argv) {
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.8, 0.2));
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.8, 0.4));
p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.8, 0.6));
- //p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.8, 0.8));
- Gudhi::alpha_complex::Alpha_complex_3d<Periodic_alpha_shapes_3d> periodic_alpha_complex(points,
+ Gudhi::alpha_complex::Alpha_complex_3d<Periodic_alpha_shapes_3d> periodic_alpha_complex(p_points,
0., 0., 0.,
1., 1., 1.);
+ Gudhi::Simplex_tree<> p_stree;
+ periodic_alpha_complex.create_complex(p_stree);
+
std::cout << "Weighted periodic alpha complex 3d" << std::endl;
using Weighted_periodic_alpha_shapes_3d = Gudhi::alpha_complex::Weighted_periodic_alpha_shapes_3d;
std::vector<Weighted_periodic_alpha_shapes_3d::Point_3> wp_points;
- wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.1, 0.2, 0.3));
- wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.5, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.0, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.0, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.0, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.0, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.0, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.1, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.6));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.8));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.8, 0.0));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.8, 0.2));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.8, 0.4));
+ wp_points.push_back(Weighted_periodic_alpha_shapes_3d::Point_3(0.8, 0.8, 0.6));
+
+ std::vector<double> p_weights;
+
+ std::random_device rd;
+ std::mt19937 mt(rd());
+ // Weights must be in range [0, <1/64]
+ std::uniform_real_distribution<double> dist(0.0, 0.0156245);
+
+ for (std::size_t i = 0; i < wp_points.size(); ++i) {
+ double value = dist(mt);
+ std::cout << value << std::endl;
+ p_weights.push_back(value);
+ }
Gudhi::alpha_complex::Alpha_complex_3d<Weighted_periodic_alpha_shapes_3d>
- weighted_periodic_alpha_complex(points, weights,
+ weighted_periodic_alpha_complex(wp_points, p_weights,
0., 0., 0.,
1., 1., 1.);
+ Gudhi::Simplex_tree<> wp_stree;
+ weighted_periodic_alpha_complex.create_complex(wp_stree);
return 0;
}