This commit is contained in:
Maxime Gimeno 2017-07-12 15:11:45 +02:00
parent a2fa153afe
commit 42c22fe74f
2 changed files with 31 additions and 8 deletions

View File

@ -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;
}

View File

@ -23,6 +23,8 @@
#define CGAL_OUTPUT_SURFACE_FACETS_TO_FACEGRAPH_H
#include <CGAL/license/Surface_mesher.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <map>
//! Gets reconstructed surface out of a SurfaceMeshComplex_2InTriangulation_3 object.
//!
@ -39,6 +41,7 @@ template<class C2T3, class FaceGraph>
void c2t3_to_facegraph(const C2T3& c2t3, FaceGraph& graph)
{
typedef typename boost::property_map<FaceGraph, boost::vertex_point_t>::type VertexPointMap;
typedef typename boost::property_traits<VertexPointMap>::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<Vertex_handle, int> V;
//int inum = 0;
int inum = 0;
//add vertices
std::vector<typename boost::graph_traits<FaceGraph>::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<Facet>::const_iterator fit =