diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp index b5e51867dab..7332a3b9a55 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Surface_reconstruction_plugin.cpp @@ -925,12 +925,21 @@ void Polyhedron_demo_surface_reconstruction_plugin::automatic_reconstruction } std::cerr << "Poisson reconstruction... "; - time.restart(); - - Polyhedron* pRemesh = poisson_reconstruct_polyhedron(*points, 20, - 100 * (std::max)(noise_size, aniso_size), - (std::max)(noise_size, aniso_size), - QString ("Eigen - built-in CG"), false, false); + time.restart(); + Polyhedron* pRemesh = NULL; + SMesh* smRemesh = NULL; + if(mw->property("is_polyhedron_mode").toBool()) + pRemesh = poisson_reconstruct_polyhedron(*points, + 20, + 100 * (std::max)(noise_size, aniso_size), + (std::max)(noise_size, aniso_size), + QString ("Eigen - built-in CG"), false, false); + else + smRemesh = poisson_reconstruct_sm(*points, + 20, + 100 * (std::max)(noise_size, aniso_size), + (std::max)(noise_size, aniso_size), + QString ("Eigen - built-in CG"), false, false); if(pRemesh) { // Add polyhedron to scene @@ -939,6 +948,15 @@ void Polyhedron_demo_surface_reconstruction_plugin::automatic_reconstruction reco_item->setColor(Qt::lightGray); scene->addItem(reco_item); } + else if(smRemesh) + { + // Add polyhedron to scene + Scene_surface_mesh_item* reco_item = new Scene_surface_mesh_item(smRemesh); + reco_item->setName(tr("%1 (poisson)").arg(pts_item->name())); + reco_item->setColor(Qt::lightGray); + scene->addItem(reco_item); + } + std::cerr << "ok (" << time.elapsed() << " ms)" << std::endl; } diff --git a/Surface_mesher/include/CGAL/IO/output_surface_facets_to_facegraph.h b/Surface_mesher/include/CGAL/IO/output_surface_facets_to_facegraph.h index 7036e07fe1d..d64a4daa3ad 100644 --- a/Surface_mesher/include/CGAL/IO/output_surface_facets_to_facegraph.h +++ b/Surface_mesher/include/CGAL/IO/output_surface_facets_to_facegraph.h @@ -23,6 +23,8 @@ #define CGAL_OUTPUT_SURFACE_FACETS_TO_FACEGRAPH_H #include +#include +#include //! Gets reconstructed surface out of a SurfaceMeshComplex_2InTriangulation_3 object. //! @@ -39,6 +41,7 @@ template void c2t3_to_facegraph(const C2T3& c2t3, FaceGraph& graph) { typedef typename boost::property_map::type VertexPointMap; + typedef typename boost::property_traits::value_type Point_3; typedef typename C2T3::Triangulation Tr; typedef typename Tr::Vertex_handle Vertex_handle; typedef typename Tr::Vertex_iterator Vertex_iterator; @@ -115,7 +118,8 @@ void c2t3_to_facegraph(const C2T3& c2t3, FaceGraph& graph) //used to set indices of vertices std::map V; - //int inum = 0; + int inum = 0; + //add vertices std::vector::vertex_descriptor> vertices; @@ -128,11 +132,12 @@ void c2t3_to_facegraph(const C2T3& c2t3, FaceGraph& graph) vertices.push_back(v); put(vpmap, v, - typename Tr::Point_3( + Point_3( vit->point().x(), vit->point().y(), vit->point().z()) ); + V.insert(std::make_pair(vit, inum++)); } //add faces for(typename std::set::const_iterator fit =