mirror of https://github.com/CGAL/cgal
Remove modifications to Mesh_simplification_plugin.cpp
This commit is contained in:
parent
5e630f5c48
commit
a3e715cbb7
|
|
@ -16,10 +16,6 @@ qt5_wrap_ui( mesh_simplificationUI_FILES Mesh_simplification_dialog.ui)
|
|||
polyhedron_demo_plugin(mesh_simplification_plugin Mesh_simplification_plugin ${mesh_simplificationUI_FILES})
|
||||
target_link_libraries(mesh_simplification_plugin scene_polyhedron_item scene_polyhedron_selection_item)
|
||||
|
||||
polyhedron_demo_plugin(mesh_simplification_sm_plugin Mesh_simplification_plugin ${mesh_simplificationUI_FILES})
|
||||
target_link_libraries(mesh_simplification_sm_plugin scene_surface_mesh_item scene_surface_mesh_selection_item)
|
||||
target_compile_definitions(mesh_simplification_sm_plugin PUBLIC "-DUSE_SURFACE_MESH" )
|
||||
|
||||
|
||||
qt5_wrap_ui( remeshingUI_FILES Remeshing_dialog.ui)
|
||||
polyhedron_demo_plugin(remeshing_plugin Remeshing_plugin Remeshing_plugin_cgal_code.cpp Mesher_base.cpp ${remeshingUI_FILES})
|
||||
|
|
|
|||
|
|
@ -1,13 +1,8 @@
|
|||
#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
|
||||
|
||||
#ifdef USE_SURFACE_MESH
|
||||
#include "Scene_surface_mesh_item.h"
|
||||
#else
|
||||
#include "Scene_polyhedron_item.h"
|
||||
#include "Polyhedron_type.h"
|
||||
#endif
|
||||
|
||||
#include "Scene_polyhedron_selection_item.h"
|
||||
#include "Polyhedron_type.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
|
|
@ -15,6 +10,7 @@
|
|||
#include <QTime>
|
||||
#include <QAction>
|
||||
|
||||
#include <CGAL/Surface_mesh_simplification/HalfedgeGraph_Polyhedron_3.h>
|
||||
#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h>
|
||||
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Edge_length_stop_predicate.h>
|
||||
|
|
@ -23,18 +19,10 @@
|
|||
|
||||
#include "ui_Mesh_simplification_dialog.h"
|
||||
|
||||
#ifdef USE_SURFACE_MESH
|
||||
typedef Scene_surface_mesh_item Scene_face_graph_item;
|
||||
#else
|
||||
typedef Scene_polyhedron_item Scene_face_graph_item;
|
||||
#endif
|
||||
|
||||
typedef Scene_face_graph_item::FaceGraph Face_graph;
|
||||
|
||||
class Custom_stop_predicate
|
||||
{
|
||||
bool m_and;
|
||||
CGAL::Surface_mesh_simplification::Count_stop_predicate<Face_graph> m_count_stop;
|
||||
CGAL::Surface_mesh_simplification::Count_stop_predicate<Polyhedron> m_count_stop;
|
||||
CGAL::Surface_mesh_simplification::Edge_length_stop_predicate<double> m_length_stop;
|
||||
|
||||
public:
|
||||
|
|
@ -92,7 +80,7 @@ public:
|
|||
|
||||
}
|
||||
bool applicable(QAction*) const {
|
||||
return qobject_cast<Scene_face_graph_item*>(scene->item(scene->mainSelectionIndex()))
|
||||
return qobject_cast<Scene_polyhedron_item*>(scene->item(scene->mainSelectionIndex()))
|
||||
|| qobject_cast<Scene_polyhedron_selection_item*>(scene->item(scene->mainSelectionIndex()));
|
||||
}
|
||||
public Q_SLOTS:
|
||||
|
|
@ -108,15 +96,15 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered()
|
|||
{
|
||||
const CGAL::Three::Scene_interface::Item_id index = scene->mainSelectionIndex();
|
||||
|
||||
Scene_face_graph_item* poly_item =
|
||||
qobject_cast<Scene_face_graph_item*>(scene->item(index));
|
||||
Scene_polyhedron_item* poly_item =
|
||||
qobject_cast<Scene_polyhedron_item*>(scene->item(index));
|
||||
|
||||
Scene_polyhedron_selection_item* selection_item =
|
||||
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
|
||||
|
||||
if (poly_item || selection_item)
|
||||
{
|
||||
Face_graph& pmesh = (poly_item != NULL)
|
||||
Polyhedron& pmesh = (poly_item != NULL)
|
||||
? *poly_item->polyhedron()
|
||||
: *selection_item->polyhedron();
|
||||
|
||||
|
|
@ -137,8 +125,8 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered()
|
|||
+ (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) +
|
||||
(bbox.zmax()-bbox.zmin())*(bbox.zmax()-bbox.zmin()));
|
||||
|
||||
ui.m_nb_edges->setValue ((int)(num_halfedges(pmesh) / 4));
|
||||
ui.m_nb_edges->setMaximum ((int)(num_halfedges(pmesh)));
|
||||
ui.m_nb_edges->setValue ((int)(pmesh.size_of_halfedges () / 4));
|
||||
ui.m_nb_edges->setMaximum ((int)(pmesh.size_of_halfedges ()));
|
||||
ui.m_edge_length->setValue (diago_length * 0.05);
|
||||
|
||||
// check user cancellation
|
||||
|
|
@ -165,7 +153,7 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered()
|
|||
{
|
||||
CGAL::Surface_mesh_simplification::Constrained_placement
|
||||
<CGAL::Surface_mesh_simplification::LindstromTurk_placement
|
||||
<Face_graph>,
|
||||
<Polyhedron>,
|
||||
Scene_polyhedron_selection_item::Is_constrained_map
|
||||
<Scene_polyhedron_selection_item::Selection_set_edge> >
|
||||
placement (selection_item->constrained_edges_pmap());
|
||||
|
|
@ -183,7 +171,7 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered()
|
|||
}
|
||||
|
||||
std::cout << "ok (" << time.elapsed() << " ms, "
|
||||
<< num_edges(pmesh) << " edges)" << std::endl;
|
||||
<< pmesh.size_of_halfedges() / 2 << " edges)" << std::endl;
|
||||
|
||||
// update scene
|
||||
if (poly_item != NULL)
|
||||
|
|
|
|||
Loading…
Reference in New Issue