diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-04-06 11:08:33 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-04-06 11:08:33 +0000 |
commit | fb22bc9ca84f5b3c55a598bf0c903a73c117e783 (patch) | |
tree | e066a8a8fa5a07e2d0faf0be096cb542295def52 /src/common/example/CGAL_points_off_reader.cpp | |
parent | 3d592b82f837219ee9ecd8e33120563edb4e76ab (diff) |
Replace Delaunay_triangulation_off_io.h and Delaunay_triangulation_off_rw.cpp with
Points_off_io.h and CGAL_points_off_reader.cpp
Adapt UT and examples for this
Adapt Alpha complex for it
Alpha complex is now inserting points in a faster way (after a spatial_sort).
Remove Alpha complex construction from a pointer on Delaunay triangulation (no more needed).
Adapt documentation to all these modifications
Forbid copy/move constructor/assignment operator on Alpha complex
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@1098 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 08a673b66451b5cb03fbdf482d696d93b35d220f
Diffstat (limited to 'src/common/example/CGAL_points_off_reader.cpp')
-rw-r--r-- | src/common/example/CGAL_points_off_reader.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/common/example/CGAL_points_off_reader.cpp b/src/common/example/CGAL_points_off_reader.cpp new file mode 100644 index 00000000..076afd5b --- /dev/null +++ b/src/common/example/CGAL_points_off_reader.cpp @@ -0,0 +1,43 @@ +#include <gudhi/Points_off_io.h> + +// For CGAL points type in dimension d +// cf. http://doc.cgal.org/latest/Kernel_d/classCGAL_1_1Point__d.html +#include <CGAL/Epick_d.h> + +#include <iostream> +#include <string> + +typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Kernel; +typedef typename Kernel::Point_d Point_d; + +void usage(int argc, char * const progName) { + std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl; + std::cerr << "Usage: " << progName << " inputFile.off" << std::endl; + exit(-1); +} + +int main(int argc, char **argv) { + if (argc != 2) usage(argc, (argv[0] - 1)); + + 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; + exit(-1); + } + + // 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 (int i = 0; i < point.dimension(); i++) + std::cout << point[i] << " "; + std::cout << "\n"; + ++n; + } + return 0; +} |