From 1a3400de957d088e9a2d65d14cbc03df20ef82b9 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 20 Jul 2017 14:57:38 +0200 Subject: [PATCH] Surface_meshize the Fairing_plugin --- .../Polyhedron/Plugins/PMP/CMakeLists.txt | 4 ++++ .../Polyhedron/Plugins/PMP/Fairing_plugin.cpp | 21 ++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt index 94138c77182..680d3077ccd 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/CMakeLists.txt @@ -24,6 +24,10 @@ if(EIGEN3_FOUND) polyhedron_demo_plugin(fairing_plugin Fairing_plugin ${fairingUI_FILES}) target_link_libraries(fairing_plugin scene_polyhedron_selection_item) + polyhedron_demo_plugin(fairing_sm_plugin Fairing_plugin ${fairingUI_FILES}) + target_link_libraries(fairing_sm_plugin scene_surface_mesh_selection_item) + target_compile_definitions(fairing_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" ) + polyhedron_demo_plugin(hole_filling_polyline_plugin Hole_filling_polyline_plugin) target_link_libraries(hole_filling_polyline_plugin scene_surface_mesh_item scene_polyhedron_item scene_polylines_item) else() diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp index 83f0e7a7e00..5e8194089e3 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Fairing_plugin.cpp @@ -2,10 +2,19 @@ #include #include "Messages_interface.h" -#include "Scene_polyhedron_selection_item.h" #include +#include "Scene_polyhedron_selection_item.h" #include "ui_Fairing_widget.h" + +#ifdef USE_SURFACE_MESH +#include "SMesh_type.h" +typedef Scene_surface_mesh_item Scene_facegraph_item; + +#else #include "Polyhedron_type.h" +typedef Scene_polyhedron_item Scene_facegraph_item; +#endif + #include #include @@ -25,6 +34,8 @@ #include #include +typedef Scene_facegraph_item::Face_graph FaceGraph; + using namespace CGAL::Three; class Polyhedron_demo_fairing_plugin : public QObject, @@ -35,7 +46,7 @@ class Polyhedron_demo_fairing_plugin : Q_PLUGIN_METADATA(IID "com.geometryfactory.PolyhedronDemo.PluginInterface/1.0") public: bool applicable(QAction*) const { - return qobject_cast(scene->item(scene->mainSelectionIndex())) + return qobject_cast(scene->item(scene->mainSelectionIndex())) || qobject_cast(scene->item(scene->mainSelectionIndex())); } void print_message(QString message) { messages->information(message);} @@ -85,7 +96,7 @@ public Q_SLOTS: if(weight_index == 1) CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(), selection_item->selected_vertices, - CGAL::Polygon_mesh_processing::parameters::weight_calculator(CGAL::internal::Uniform_weight_fairing(*selection_item->polyhedron())). + CGAL::Polygon_mesh_processing::parameters::weight_calculator(CGAL::internal::Uniform_weight_fairing(*selection_item->polyhedron())). fairing_continuity(continuity)); if(weight_index == 0) CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(), @@ -105,7 +116,7 @@ public Q_SLOTS: } QApplication::setOverrideCursor(Qt::WaitCursor); double alpha = ui_widget.Density_control_factor_spin_box->value(); - std::vector new_facets; + std::vector::face_descriptor> new_facets; CGAL::Polygon_mesh_processing::refine(*selection_item->polyhedron(), selection_item->selected_facets, @@ -113,7 +124,7 @@ public Q_SLOTS: CGAL::Emptyset_iterator(), CGAL::Polygon_mesh_processing::parameters::density_control_factor(alpha)); // add new facets to selection - for(std::vector::iterator it = new_facets.begin(); it != new_facets.end(); ++it) { + for(std::vector::face_descriptor>::iterator it = new_facets.begin(); it != new_facets.end(); ++it) { selection_item->selected_facets.insert(*it); } selection_item->changed_with_poly_item();