From 8d7329f3e5ad843e553c3c5503cecc28ef2eead6 Mon Sep 17 00:00:00 2001 From: Gard Spreemann Date: Thu, 20 Apr 2017 11:10:45 +0200 Subject: GUDHI 2.0.0 as released by upstream in a tarball. --- .../common/example_CGAL_3D_points_off_reader.cpp | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 example/common/example_CGAL_3D_points_off_reader.cpp (limited to 'example/common/example_CGAL_3D_points_off_reader.cpp') diff --git a/example/common/example_CGAL_3D_points_off_reader.cpp b/example/common/example_CGAL_3D_points_off_reader.cpp new file mode 100644 index 00000000..665b7a29 --- /dev/null +++ b/example/common/example_CGAL_3D_points_off_reader.cpp @@ -0,0 +1,41 @@ +#include + +#include + +#include +#include +#include + +using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; +using Point_3 = Kernel::Point_3; + +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_3D_off_reader 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_cloud = off_reader.get_point_cloud(); + + int n {}; + for (auto point : point_cloud) { + ++n; + std::cout << "Point[" << n << "] = (" << point[0] << ", " << point[1] << ", " << point[2] << ")\n"; + } + return 0; +} -- cgit v1.2.3