summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/example
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-06-22 08:30:53 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2018-06-22 08:30:53 +0000
commit138ee2657f03206209ff5c7d6c4392168beef819 (patch)
tree62f464875d12d48c2eb79a14def1dda8383849a7 /src/Alpha_complex/example
parent82f15e71f43a5547627699b625830126dad1c4ab (diff)
Use unique_ptr to store cgal alpha_shapes_3. Required for not objects_ to be freed.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3626 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6dc9bbe25757a1a7bef2178ef63876c20d3a38b1
Diffstat (limited to 'src/Alpha_complex/example')
-rw-r--r--src/Alpha_complex/example/traits_test.cpp160
1 files changed, 152 insertions, 8 deletions
diff --git a/src/Alpha_complex/example/traits_test.cpp b/src/Alpha_complex/example/traits_test.cpp
index 99f1543c..3be62ad3 100644
--- a/src/Alpha_complex/example/traits_test.cpp
+++ b/src/Alpha_complex/example/traits_test.cpp
@@ -1,4 +1,5 @@
#include <gudhi/Alpha_complex_3d.h>
+#include <gudhi/Simplex_tree.h>
#include <iostream>
#include <string>
@@ -15,31 +16,174 @@ void usage(int nbArgs, char * const progName) {
int main(int argc, char **argv) {
//if ((argc != 1) && (argc != 2)) usage(argc, (argv[0] - 1));
+ std::cout << "Alpha complex 3d" << std::endl;
using Alpha_shapes_3d = Gudhi::alpha_complex::Alpha_shapes_3d;
std::vector<Alpha_shapes_3d::Point_3> points;
- points.push_back(Alpha_shapes_3d::Point_3(1., 2., 3.));
- points.push_back(Alpha_shapes_3d::Point_3(6., 5., 4.));
+ points.push_back(Alpha_shapes_3d::Point_3(0.0, 0.0, 0.0));
+ points.push_back(Alpha_shapes_3d::Point_3(0.0, 0.0, 0.2));
+ points.push_back(Alpha_shapes_3d::Point_3(0.2, 0.0, 0.2));
+ points.push_back(Alpha_shapes_3d::Point_3(0.6, 0.6, 0.0));
+ points.push_back(Alpha_shapes_3d::Point_3(0.8, 0.8, 0.2));
+ points.push_back(Alpha_shapes_3d::Point_3(0.2, 0.8, 0.6));
Gudhi::alpha_complex::Alpha_complex_3d<Alpha_shapes_3d> alpha_complex(points);
+ Gudhi::Simplex_tree<> stree;
+ alpha_complex.create_complex(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;
- w_points.push_back(Weighted_alpha_shapes_3d::Point_3(1., 2., 3.));
- w_points.push_back(Weighted_alpha_shapes_3d::Point_3(6., 5., 4.));
+ w_points.push_back(Weighted_alpha_shapes_3d::Point_3(0.0, 0.0, 0.0));
+ w_points.push_back(Weighted_alpha_shapes_3d::Point_3(0.0, 0.0, 0.2));
+ w_points.push_back(Weighted_alpha_shapes_3d::Point_3(0.2, 0.0, 0.2));
+ w_points.push_back(Weighted_alpha_shapes_3d::Point_3(0.6, 0.6, 0.0));
+ w_points.push_back(Weighted_alpha_shapes_3d::Point_3(0.8, 0.8, 0.2));
+ w_points.push_back(Weighted_alpha_shapes_3d::Point_3(0.2, 0.8, 0.6));
+
+ std::vector<double> weights = {0.01, 0.005, 0.006, 0.01, 0.009, 0.001};
- std::vector<double> weights = {0.01, 0.005};
+ Gudhi::alpha_complex::Alpha_complex_3d<Weighted_alpha_shapes_3d> weighted_alpha_complex(w_points, weights);
- Gudhi::alpha_complex::Alpha_complex_3d<Weighted_alpha_shapes_3d> weighted_alpha_complex(points, weights);
+ Gudhi::Simplex_tree<> w_stree;
+ weighted_alpha_complex.create_complex(w_stree);
+ 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(1., 2., 3.));
- p_points.push_back(Periodic_alpha_shapes_3d::Point_3(6., 5., 4.));
+ 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));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.0, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.2, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.4, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.6, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.0, 0.8, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.0, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.2, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.4, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.6, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.2, 0.8, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.0, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.2, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.4, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.6, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.4, 0.8, 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.0, 0.2));
+ 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.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));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.2, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.4, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.6, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.6, 0.8, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.0, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.2, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.4, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.0));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.2));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.4));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.6));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.6, 0.8));
+ p_points.push_back(Periodic_alpha_shapes_3d::Point_3(0.8, 0.8, 0.0));
+ 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,
0., 0., 0.,
1., 1., 1.);
+ 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));