From 437ccdf9616d91534af91cd8a0090b6f32d6e65b Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 14 Apr 2016 12:49:09 +0000 Subject: Add of src/common/include/gudhi/Points_3D_off_io.h to read specific 3D OFF Files for CGAL Point_3 Add an example to read 3D OFF Files for CGAL Point_3 Modify alpha_complex_3d_persistence.cpp to read OFF files Add periodic_alpha_complex_3d_persistence.cpp in Persistent_cohomology examples Add info about new examples in README git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/periodic_alpha_complex_3d@1116 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6b423b598869a0f4f9c62d93c93b69efd93c0161 --- src/common/example/CGAL_points_off_reader.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/common/example/CGAL_points_off_reader.cpp') diff --git a/src/common/example/CGAL_points_off_reader.cpp b/src/common/example/CGAL_points_off_reader.cpp index 45e9f1e6..997b47c1 100644 --- a/src/common/example/CGAL_points_off_reader.cpp +++ b/src/common/example/CGAL_points_off_reader.cpp @@ -8,17 +8,19 @@ #include #include -typedef CGAL::Epick_d< CGAL::Dynamic_dimension_tag > Kernel; -typedef typename Kernel::Point_d Point_d; +using Kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >; +using Point_d = typename Kernel::Point_d; -void usage(int argc, char * const progName) { - std::cerr << "Error: Number of arguments (" << argc << ") is not correct" << std::endl; +void usage(char * const progName) { std::cerr << "Usage: " << progName << " inputFile.off" << std::endl; exit(-1); } int main(int argc, char **argv) { - if (argc != 2) usage(argc, (argv[0] - 1)); + 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 @@ -26,16 +28,16 @@ int main(int argc, char **argv) { // Check the read operation was correct if (!off_reader.is_valid()) { std::cerr << "Unable to read file " << offInputFile << std::endl; - exit(-1); + usage(argv[0]); } // Retrieve the triangulation std::vector point_cloud = off_reader.get_point_cloud(); - int n = 0; + int n {0}; for (auto point : point_cloud) { std::cout << "Point[" << n << "] = "; - for (int i = 0; i < point.dimension(); i++) + for (int i {0}; i < point.dimension(); i++) std::cout << point[i] << " "; std::cout << "\n"; ++n; -- cgit v1.2.3