summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/example/Alpha_complex_from_points.cpp
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-24 15:27:19 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-06-24 15:27:19 +0000
commit85059e058ea651d5d9e849c8462cbe5f01e4743b (patch)
tree1bfa87e647f95bf77a08ea10f83a002aa3add32c /src/Alpha_complex/example/Alpha_complex_from_points.cpp
parent621860f0873e22d28298c8ecf7cbe4ec8bfc3d88 (diff)
Alpha complex construction from a list of CGAL points
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@641 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 521269f793f9c16c2305db8c97678bea2bf95092
Diffstat (limited to 'src/Alpha_complex/example/Alpha_complex_from_points.cpp')
-rw-r--r--src/Alpha_complex/example/Alpha_complex_from_points.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/Alpha_complex/example/Alpha_complex_from_points.cpp b/src/Alpha_complex/example/Alpha_complex_from_points.cpp
new file mode 100644
index 00000000..fc0e2460
--- /dev/null
+++ b/src/Alpha_complex/example/Alpha_complex_from_points.cpp
@@ -0,0 +1,71 @@
+// to construct a Delaunay_triangulation from a OFF file
+#include "gudhi/Delaunay_triangulation_off_io.h"
+#include "gudhi/Alpha_complex.h"
+
+#include <CGAL/Delaunay_triangulation.h>
+#include <CGAL/Epick_d.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string>
+
+typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Kernel;
+typedef Kernel::Point_d Point;
+typedef std::vector<Point> Vector_of_points;
+
+int main(int argc, char **argv) {
+
+ // ----------------------------------------------------------------------------
+ // Init of a list of points
+ // ----------------------------------------------------------------------------
+ Vector_of_points points;
+ std::vector<double> coords;
+
+ coords.clear();
+ coords.push_back(0.0);
+ coords.push_back(0.0);
+ coords.push_back(0.0);
+ coords.push_back(1.0);
+ points.push_back(Point(coords.begin(), coords.end()));
+ coords.clear();
+ coords.push_back(0.0);
+ coords.push_back(0.0);
+ coords.push_back(1.0);
+ coords.push_back(0.0);
+ points.push_back(Point(coords.begin(), coords.end()));
+ coords.clear();
+ coords.push_back(0.0);
+ coords.push_back(1.0);
+ coords.push_back(0.0);
+ coords.push_back(0.0);
+ points.push_back(Point(coords.begin(), coords.end()));
+ coords.clear();
+ coords.push_back(1.0);
+ coords.push_back(0.0);
+ coords.push_back(0.0);
+ coords.push_back(0.0);
+ points.push_back(Point(coords.begin(), coords.end()));
+
+ // ----------------------------------------------------------------------------
+ // Init of an alpha complex from the list of points
+ // ----------------------------------------------------------------------------
+ Gudhi::alphacomplex::Alpha_complex alpha_complex_from_points(3, points.size(), points.begin(), points.end());
+
+ // ----------------------------------------------------------------------------
+ // Display information about the alpha complex
+ // ----------------------------------------------------------------------------
+ std::cout << "Alpha complex is of dimension " << alpha_complex_from_points.dimension() <<
+ " - " << alpha_complex_from_points.num_simplices() << " simplices - " <<
+ alpha_complex_from_points.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 : alpha_complex_from_points.filtration_simplex_range()) {
+ std::cout << " ( ";
+ for (auto vertex : alpha_complex_from_points.simplex_vertex_range(f_simplex)) {
+ std::cout << vertex << " ";
+ }
+ std::cout << ") -> " << "[" << alpha_complex_from_points.filtration(f_simplex) << "] ";
+ std::cout << std::endl;
+ }
+ return 0;
+} \ No newline at end of file