diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-09-27 07:44:40 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-09-27 07:44:40 +0000 |
commit | 2f0d4a7a06f8fde904b75b27c3836e362f549707 (patch) | |
tree | e1522803404837c461756715629cf9647eef9317 /src/common/example/example_vector_double_points_off_reader.cpp | |
parent | 9ffc108705ace9910cabc79225d984fe1d15b794 (diff) | |
parent | a138c9ed4fb9770a3612ff4ee0f914942bbe9724 (diff) |
Merge last trunk modifications
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneck_integration@1568 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 14c192615a0b9b79121a8395e721978b72272536
Diffstat (limited to 'src/common/example/example_vector_double_points_off_reader.cpp')
-rw-r--r-- | src/common/example/example_vector_double_points_off_reader.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/common/example/example_vector_double_points_off_reader.cpp b/src/common/example/example_vector_double_points_off_reader.cpp new file mode 100644 index 00000000..8aecb26e --- /dev/null +++ b/src/common/example/example_vector_double_points_off_reader.cpp @@ -0,0 +1,41 @@ +#include <gudhi/Points_off_io.h> + +#include <iostream> +#include <string> +#include <vector> + +using Point_d = std::vector<double>; + +void usage(char * const progName) { + std::cerr << "Usage: " << progName << " inputFile.off" << 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]); + } + + std::string offInputFile(argv[1]); + // Read the OFF file (input file name given as parameter) and triangulate points + Gudhi::Points_off_reader<Point_d> off_reader(offInputFile); + // Check the read operation was correct + if (!off_reader.is_valid()) { + std::cerr << "Unable to read file " << offInputFile << std::endl; + usage(argv[0]); + } + + // Retrieve the triangulation + std::vector<Point_d> point_cloud = off_reader.get_point_cloud(); + + int n {0}; + for (auto point : point_cloud) { + std::cout << "Point[" << n << "] = "; + for (std::size_t i {0}; i < point.size(); i++) + std::cout << point[i] << " "; + std::cout << "\n"; + ++n; + } + return 0; +} |