diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-04-14 12:49:09 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-04-14 12:49:09 +0000 |
commit | 437ccdf9616d91534af91cd8a0090b6f32d6e65b (patch) | |
tree | 39177c3c8a1ce2f74af6aa9434cd92afcf6854af /src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp | |
parent | 8bcb704e4772e9dda428d4de27a30e74eca7ff6a (diff) |
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
Diffstat (limited to 'src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp')
-rw-r--r-- | src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp b/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp index 01497c7c..48fbb91a 100644 --- a/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp +++ b/src/Persistent_cohomology/example/alpha_complex_3d_persistence.cpp @@ -20,9 +20,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <gudhi/graph_simplicial_complex.h> #include <gudhi/Simplex_tree.h> #include <gudhi/Persistent_cohomology.h> +#include <gudhi/Points_3D_off_io.h> #include <boost/variant.hpp> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> @@ -139,20 +139,18 @@ int main(int argc, char * const argv[]) { } // Read points from file - std::string filegraph = argv[1]; - std::list<Point_3> lp; - std::ifstream is(filegraph.c_str()); - int n; - is >> n; -#ifdef DEBUG_TRACES - std::cout << "Reading " << n << " points " << std::endl; -#endif // DEBUG_TRACES - Point_3 p; - for (; n > 0; n--) { - is >> p; - lp.push_back(p); + std::string offInputFile(argv[1]); + // Read the OFF file (input file name given as parameter) and triangulate points + Gudhi::Points_3D_off_reader<Point_3> 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_3> lp = off_reader.get_point_cloud(); + // alpha shape construction from points. CGAL has a strange behavior in REGULARIZED mode. Alpha_shape_3 as(lp.begin(), lp.end(), 0, Alpha_shape_3::GENERAL); #ifdef DEBUG_TRACES |