summaryrefslogtreecommitdiff
path: root/src/Alpha_complex/example
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
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')
-rw-r--r--src/Alpha_complex/example/Alpha_complex_from_off.cpp16
-rw-r--r--src/Alpha_complex/example/Alpha_complex_from_points.cpp36
-rw-r--r--src/Alpha_complex/example/CMakeLists.txt4
-rw-r--r--src/Alpha_complex/example/alphaoffreader_for_doc_32.txt22
-rw-r--r--src/Alpha_complex/example/alphaoffreader_for_doc_60.txt (renamed from src/Alpha_complex/example/alphaoffreader_for_doc.txt)0
5 files changed, 54 insertions, 24 deletions
diff --git a/src/Alpha_complex/example/Alpha_complex_from_off.cpp b/src/Alpha_complex/example/Alpha_complex_from_off.cpp
index cd6f5a4b..4f381892 100644
--- a/src/Alpha_complex/example/Alpha_complex_from_off.cpp
+++ b/src/Alpha_complex/example/Alpha_complex_from_off.cpp
@@ -1,8 +1,6 @@
#include <iostream>
#include <string>
-// to construct a Delaunay_triangulation from a OFF file
-#include <gudhi/Delaunay_triangulation_off_io.h>
#include <gudhi/Alpha_complex.h>
void usage(char * const progName) {
@@ -35,14 +33,12 @@ int main(int argc, char **argv) {
std::cout << "Iterator on alpha complex simplices in the filtration order, with [filtration value]:" << std::endl;
for (auto f_simplex : alpha_complex_from_file.filtration_simplex_range()) {
- //if (alpha_complex_from_file.filtration(f_simplex) <= alpha_complex_from_file.filtration()) {
- std::cout << " ( ";
- for (auto vertex : alpha_complex_from_file.simplex_vertex_range(f_simplex)) {
- std::cout << vertex << " ";
- }
- std::cout << ") -> " << "[" << alpha_complex_from_file.filtration(f_simplex) << "] ";
- std::cout << std::endl;
- //}
+ std::cout << " ( ";
+ for (auto vertex : alpha_complex_from_file.simplex_vertex_range(f_simplex)) {
+ std::cout << vertex << " ";
+ }
+ std::cout << ") -> " << "[" << alpha_complex_from_file.filtration(f_simplex) << "] ";
+ std::cout << std::endl;
}
return 0;
}
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
diff --git a/src/Alpha_complex/example/CMakeLists.txt b/src/Alpha_complex/example/CMakeLists.txt
index 10b87f04..33ff6805 100644
--- a/src/Alpha_complex/example/CMakeLists.txt
+++ b/src/Alpha_complex/example/CMakeLists.txt
@@ -27,10 +27,6 @@ if(CGAL_FOUND)
if (EIGEN3_FOUND)
message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.")
include( ${EIGEN3_USE_FILE} )
- if (CMAKE_BUILD_TYPE MATCHES Debug)
- # For programs to be more verbose
- add_definitions(-DDEBUG_TRACES)
- endif()
add_executable ( alphaoffreader Alpha_complex_from_off.cpp )
target_link_libraries(alphaoffreader ${Boost_SYSTEM_LIBRARY} ${CGAL_LIBRARY})
diff --git a/src/Alpha_complex/example/alphaoffreader_for_doc_32.txt b/src/Alpha_complex/example/alphaoffreader_for_doc_32.txt
new file mode 100644
index 00000000..553431a9
--- /dev/null
+++ b/src/Alpha_complex/example/alphaoffreader_for_doc_32.txt
@@ -0,0 +1,22 @@
+Alpha complex is of dimension 2 - 20 simplices - 7 vertices.
+Iterator on alpha complex simplices in the filtration order, with [filtration value]:
+ ( 0 ) -> [0]
+ ( 1 ) -> [0]
+ ( 2 ) -> [0]
+ ( 3 ) -> [0]
+ ( 4 ) -> [0]
+ ( 5 ) -> [0]
+ ( 6 ) -> [0]
+ ( 5 4 ) -> [6.25]
+ ( 4 1 ) -> [20]
+ ( 4 2 ) -> [8.5]
+ ( 6 2 ) -> [9.25]
+ ( 6 5 ) -> [10]
+ ( 6 4 ) -> [11.25]
+ ( 6 5 4 ) -> [12.5]
+ ( 6 4 2 ) -> [12.9959]
+ ( 3 0 ) -> [13.25]
+ ( 4 1 ) -> [20]
+ ( 1 0 ) -> [22.7367]
+ ( 3 1 0 ) -> [22.7367]
+ ( 5 0 ) -> [30.25]
diff --git a/src/Alpha_complex/example/alphaoffreader_for_doc.txt b/src/Alpha_complex/example/alphaoffreader_for_doc_60.txt
index 71f29a00..71f29a00 100644
--- a/src/Alpha_complex/example/alphaoffreader_for_doc.txt
+++ b/src/Alpha_complex/example/alphaoffreader_for_doc_60.txt