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-11-27 17:05:22 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-11-27 17:05:22 +0000
commitc79ddda239336378d50255ef99ea6c34ceefbb47 (patch)
treef810cbc7d032f301194839b044aa0a98af9d7bcc /src/Alpha_complex/example/Alpha_complex_from_points.cpp
parentb3c3e0d75c717dbd94caf96c9ba827fb17b4d5b3 (diff)
After doc review
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@931 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 578da0e6fff453560e666e8f00147f9e10cb6de6
Diffstat (limited to 'src/Alpha_complex/example/Alpha_complex_from_points.cpp')
-rw-r--r--src/Alpha_complex/example/Alpha_complex_from_points.cpp36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/Alpha_complex/example/Alpha_complex_from_points.cpp b/src/Alpha_complex/example/Alpha_complex_from_points.cpp
index e460f177..62f594d1 100644
--- a/src/Alpha_complex/example/Alpha_complex_from_points.cpp
+++ b/src/Alpha_complex/example/Alpha_complex_from_points.cpp
@@ -6,34 +6,50 @@
#include <string>
#include <vector>
-// to construct a Delaunay_triangulation from a OFF file
-#include "gudhi/Delaunay_triangulation_off_io.h"
-#include "gudhi/Alpha_complex.h"
+#include <gudhi/Alpha_complex.h>
-typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Kernel;
+typedef CGAL::Epick_d< CGAL::Dimension_tag<2> > Kernel;
typedef Kernel::Point_d Point;
typedef std::vector<Point> Vector_of_points;
+void usage(char * const progName) {
+ std::cerr << "Usage: " << progName << " alpha_square_max_value" << std::endl;
+ std::cerr << " i.e.: " << progName << " 32.0" << std::endl;
+ exit(-1); // ----- >>
+}
+
int main(int argc, char **argv) {
+ if (argc != 2) {
+ std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl;
+ usage(argv[0]);
+ }
+
+ double alpha_square_max_value = atof(argv[1]);
+
// ----------------------------------------------------------------------------
// Init of a list of points
// ----------------------------------------------------------------------------
Vector_of_points points;
- std::vector<double> coords = { 0.0, 0.0, 0.0, 1.0 };
+ std::vector<double> coords = { 1.0, 1.0 };
+ points.push_back(Point(coords.begin(), coords.end()));
+ coords = { 7.0, 0.0 };
+ points.push_back(Point(coords.begin(), coords.end()));
+ coords = { 4.0, 6.0 };
+ points.push_back(Point(coords.begin(), coords.end()));
+ coords = { 9.0, 6.0 };
points.push_back(Point(coords.begin(), coords.end()));
- coords = { 0.0, 0.0, 1.0, 0.0 };
+ coords = { 0.0, 14.0 };
points.push_back(Point(coords.begin(), coords.end()));
- coords = { 0.0, 1.0, 0.0, 0.0 };
+ coords = { 2.0, 19.0 };
points.push_back(Point(coords.begin(), coords.end()));
- coords = { 1.0, 0.0, 0.0, 0.0 };
+ coords = { 9.0, 17.0 };
points.push_back(Point(coords.begin(), coords.end()));
// ----------------------------------------------------------------------------
// Init of an alpha complex from the list of points
// ----------------------------------------------------------------------------
- double max_alpha_square_value = 1e10;
- Gudhi::alphacomplex::Alpha_complex<Kernel> alpha_complex_from_points(points, max_alpha_square_value);
+ Gudhi::alphacomplex::Alpha_complex<Kernel> alpha_complex_from_points(points, alpha_square_max_value);
// ----------------------------------------------------------------------------
// Display information about the alpha complex