diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-07-31 14:33:49 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-07-31 14:33:49 +0000 |
commit | c89ae478ea5d6685c862533fac1aea973e9cda02 (patch) | |
tree | 8557a50f16155e082cc8b76ffd1831a5a3969604 /src/Alpha_complex/example | |
parent | d5b5de5aa50c2fdc73d00bbdcf295caf44237a34 (diff) |
Add unitary tests and documentation
Fix debug exception mechanism
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alpha_complex_3d_module_vincent@3712 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 43f66f3843981ab9cd74c117c2b1c6bb9b94810b
Diffstat (limited to 'src/Alpha_complex/example')
4 files changed, 112 insertions, 354 deletions
diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt index af4bfd74..4a1cd26d 100644 --- a/src/Alpha_complex/example/CMakeLists.txt +++ b/src/Alpha_complex/example/CMakeLists.txt @@ -30,4 +30,14 @@ if(CGAL_FOUND) ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_result_32.txt ${CMAKE_CURRENT_BINARY_DIR}/alphaoffreader_for_doc_32.txt) endif() endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.7.0) + if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) + add_executable ( Alpha_complex_example_weighted_3d_from_points Weighted_alpha_complex_3d_from_points.cpp ) + target_link_libraries(Alpha_complex_example_weighted_3d_from_points ${CGAL_LIBRARY}) + if (TBB_FOUND) + target_link_libraries(Alpha_complex_example_weighted_3d_from_points ${TBB_LIBRARIES}) + endif() + add_test(NAME Alpha_complex_example_weighted_3d_from_points + COMMAND $<TARGET_FILE:Alpha_complex_example_weighted_3d_from_points>) + + endif(NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.11.0) endif()
\ No newline at end of file diff --git a/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp new file mode 100644 index 00000000..abb73427 --- /dev/null +++ b/src/Alpha_complex/example/Weighted_alpha_complex_3d_from_points.cpp @@ -0,0 +1,71 @@ +#include <gudhi/Alpha_complex_3d.h> +#include <gudhi/Alpha_complex_3d_options.h> +// to construct a simplex_tree from alpha complex +#include <gudhi/Simplex_tree.h> + +#include <iostream> +#include <string> +#include <vector> +#include <limits> // for numeric limits + +using Weighted_alpha_shapes_3d = Gudhi::alpha_complex::Weighted_alpha_shapes_3d; +using Weighted_alpha_complex_3d = Gudhi::alpha_complex::Alpha_complex_3d<Weighted_alpha_shapes_3d>; +using Point = Gudhi::alpha_complex::Weighted_alpha_shapes_3d::Point_3 ; +using Vector_of_points = std::vector<Point>; +using Vector_of_weights = std::vector<Gudhi::alpha_complex::Weighted_alpha_shapes_3d::Alpha_shape_3::FT>; + +void usage(int nbArgs, char * const progName) { + std::cerr << "Error: Number of arguments (" << nbArgs << ") is not correct\n"; + std::cerr << "Usage: " << progName << " \n"; + exit(-1); // ----- >> +} + +int main(int argc, char **argv) { + if (argc != 1) { + std::cerr << "Error: Number of arguments (" << argc << ") is not correct\n"; + std::cerr << "Usage: " << (argv[0] - 1) << " \n"; + exit(-1); // ----- >> + } + + // ---------------------------------------------------------------------------- + // Init of a list of points and weights from a small molecule + // ---------------------------------------------------------------------------- + Vector_of_points points; + Vector_of_weights weights; + points.push_back(Point(1, -1, -1)); + weights.push_back(4.); + points.push_back(Point(-1, 1, -1)); + weights.push_back(4.); + points.push_back(Point(-1, -1, 1)); + weights.push_back(4.); + points.push_back(Point(1, 1, 1)); + weights.push_back(4.); + points.push_back(Point(2, 2, 2)); + weights.push_back(1.); + + // ---------------------------------------------------------------------------- + // Init of an alpha complex from the list of points + // ---------------------------------------------------------------------------- + Weighted_alpha_complex_3d alpha_complex_from_points(points, weights); + + Gudhi::Simplex_tree<> simplex; + if (alpha_complex_from_points.create_complex(simplex)) { + // ---------------------------------------------------------------------------- + // Display information about the alpha complex + // ---------------------------------------------------------------------------- + std::cout << "Alpha complex is of dimension " << simplex.dimension() << + " - " << simplex.num_simplices() << " simplices - " << + simplex.num_vertices() << " vertices." << std::endl; + + std::cout << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl; + for (auto f_simplex : simplex.filtration_simplex_range()) { + std::cout << " ( "; + for (auto vertex : simplex.simplex_vertex_range(f_simplex)) { + std::cout << vertex << " "; + } + std::cout << ") -> " << "[" << simplex.filtration(f_simplex) << "] "; + std::cout << std::endl; + } + } + return 0; +} diff --git a/src/Alpha_complex/example/traits_test.cpp b/src/Alpha_complex/example/traits_test.cpp deleted file mode 100644 index 1dd062de..00000000 --- a/src/Alpha_complex/example/traits_test.cpp +++ /dev/null @@ -1,354 +0,0 @@ -#include <gudhi/Alpha_complex_3d.h> -#include <gudhi/Simplex_tree.h> - -#include <iostream> -#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"; - std::cerr << "Usage: " << progName << " [alpha_square_max_value]\n"; - std::cerr << " i.e.: " << progName << " 60.0\n"; - exit(-1); // ----- >> -} - -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(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 << "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; - 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}; - - Gudhi::alpha_complex::Alpha_complex_3d<Weighted_alpha_shapes_3d> weighted_alpha_complex(w_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(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.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)); - - 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.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(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; -} diff --git a/src/Alpha_complex/example/weightedalpha3dfrompoints_for_doc.txt b/src/Alpha_complex/example/weightedalpha3dfrompoints_for_doc.txt new file mode 100644 index 00000000..7a09998d --- /dev/null +++ b/src/Alpha_complex/example/weightedalpha3dfrompoints_for_doc.txt @@ -0,0 +1,31 @@ +Alpha complex is of dimension 3 - 29 simplices - 5 vertices. +Iterator on alpha complex simplices in the filtration order, with [filtration value]: + ( 0 ) -> [-4] + ( 1 ) -> [-4] + ( 2 ) -> [-4] + ( 3 ) -> [-4] + ( 1 0 ) -> [-2] + ( 2 0 ) -> [-2] + ( 2 1 ) -> [-2] + ( 3 0 ) -> [-2] + ( 3 1 ) -> [-2] + ( 3 2 ) -> [-2] + ( 2 1 0 ) -> [-1.33333] + ( 3 1 0 ) -> [-1.33333] + ( 3 2 0 ) -> [-1.33333] + ( 3 2 1 ) -> [-1.33333] + ( 3 2 1 0 ) -> [-1] + ( 4 ) -> [-1] + ( 4 2 ) -> [-1] + ( 4 0 ) -> [23] + ( 4 1 ) -> [23] + ( 4 2 0 ) -> [23] + ( 4 2 1 ) -> [23] + ( 4 3 ) -> [23] + ( 4 3 2 ) -> [23] + ( 4 1 0 ) -> [95] + ( 4 2 1 0 ) -> [95] + ( 4 3 0 ) -> [95] + ( 4 3 1 ) -> [95] + ( 4 3 2 0 ) -> [95] + ( 4 3 2 1 ) -> [95] |