mirror of https://github.com/CGAL/cgal
Add an action to the Repair_plugin that extracts NM vertices into a point_set_item.
This commit is contained in:
parent
3083341e48
commit
6891cf82f8
|
|
@ -95,7 +95,7 @@ target_link_libraries(surface_intersection_plugin PUBLIC scene_surface_mesh_item
|
|||
|
||||
qt5_wrap_ui( repairUI_FILES RemoveNeedlesDialog.ui)
|
||||
polyhedron_demo_plugin(repair_polyhedron_plugin Repair_polyhedron_plugin ${repairUI_FILES} KEYWORDS PMP)
|
||||
target_link_libraries(repair_polyhedron_plugin PUBLIC scene_surface_mesh_item)
|
||||
target_link_libraries(repair_polyhedron_plugin PUBLIC scene_points_with_normal_item scene_surface_mesh_item)
|
||||
|
||||
qt5_wrap_ui( isotropicRemeshingUI_FILES Isotropic_remeshing_dialog.ui)
|
||||
polyhedron_demo_plugin(isotropic_remeshing_plugin Isotropic_remeshing_plugin ${isotropicRemeshingUI_FILES} KEYWORDS PMP)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <QtCore/qglobal.h>
|
||||
|
||||
#include "Scene_surface_mesh_item.h"
|
||||
#include "Scene_points_with_normal_item.h"
|
||||
#include <CGAL/Three/Scene_interface.h>
|
||||
#include <CGAL/Three/Polyhedron_demo_plugin_interface.h>
|
||||
#include <CGAL/Three/Polyhedron_demo_plugin_helper.h>
|
||||
|
|
@ -47,6 +48,7 @@ public:
|
|||
actionRemoveSelfIntersections = new QAction(tr("Remove Self-Intersections"), mw);
|
||||
actionStitchCloseBorderHalfedges = new QAction(tr("Stitch Close Border Halfedges"), mw);
|
||||
actionDuplicateNMVertices = new QAction(tr("Duplicate Non-Manifold Vertices"), mw);
|
||||
actionExtractNMVertices = new QAction(tr("Extract Non-Manifold Vertices"), mw);
|
||||
actionMergeDuplicatedVerticesOnBoundaryCycles = new QAction(tr("Merge Duplicated Vertices on Boundary Cycles"), mw);
|
||||
actionAutorefine = new QAction(tr("Autorefine Mesh"), mw);
|
||||
actionAutorefineAndRMSelfIntersections = new QAction(tr("Autorefine and Remove Self-Intersections"), mw);
|
||||
|
|
@ -57,6 +59,7 @@ public:
|
|||
actionRemoveSelfIntersections->setObjectName("actionRemoveSelfIntersections");
|
||||
actionStitchCloseBorderHalfedges->setObjectName("actionStitchCloseBorderHalfedges");
|
||||
actionDuplicateNMVertices->setObjectName("actionDuplicateNMVertices");
|
||||
actionExtractNMVertices->setObjectName("actionExtractNMVertices");
|
||||
actionMergeDuplicatedVerticesOnBoundaryCycles->setObjectName("actionMergeDuplicatedVerticesOnBoundaryCycles");
|
||||
actionAutorefine->setObjectName("actionAutorefine");
|
||||
actionAutorefineAndRMSelfIntersections->setObjectName("actionAutorefineAndRMSelfIntersections");
|
||||
|
|
@ -67,6 +70,7 @@ public:
|
|||
actionRemoveSelfIntersections->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental");
|
||||
actionRemoveIsolatedVertices->setProperty("subMenuName", "Polygon Mesh Processing/Repair");
|
||||
actionDuplicateNMVertices->setProperty("subMenuName", "Polygon Mesh Processing/Repair");
|
||||
actionExtractNMVertices->setProperty("subMenuName", "Polygon Mesh Processing/Repair");
|
||||
actionMergeDuplicatedVerticesOnBoundaryCycles->setProperty("subMenuName", "Polygon Mesh Processing/Repair");
|
||||
actionAutorefine->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental");
|
||||
actionAutorefineAndRMSelfIntersections->setProperty("subMenuName", "Polygon Mesh Processing/Repair/Experimental");
|
||||
|
|
@ -82,6 +86,7 @@ public:
|
|||
<< actionRemoveSelfIntersections
|
||||
<< actionStitchCloseBorderHalfedges
|
||||
<< actionDuplicateNMVertices
|
||||
<< actionExtractNMVertices
|
||||
<< actionMergeDuplicatedVerticesOnBoundaryCycles
|
||||
<< actionAutorefine
|
||||
<< actionAutorefineAndRMSelfIntersections
|
||||
|
|
@ -104,6 +109,8 @@ public:
|
|||
template <typename Item>
|
||||
void on_actionDuplicateNMVertices_triggered(Scene_interface::Item_id index);
|
||||
template <typename Item>
|
||||
void on_actionExtractNMVertices_triggered(Scene_interface::Item_id index);
|
||||
template <typename Item>
|
||||
void on_actionMergeDuplicatedVerticesOnBoundaryCycles_triggered(Scene_interface::Item_id index);
|
||||
template <typename Item>
|
||||
void on_actionAutorefine_triggered(Scene_interface::Item_id index);
|
||||
|
|
@ -116,6 +123,7 @@ public Q_SLOTS:
|
|||
void on_actionRemoveSelfIntersections_triggered();
|
||||
void on_actionStitchCloseBorderHalfedges_triggered();
|
||||
void on_actionDuplicateNMVertices_triggered();
|
||||
void on_actionExtractNMVertices_triggered();
|
||||
void on_actionMergeDuplicatedVerticesOnBoundaryCycles_triggered();
|
||||
void on_actionAutorefine_triggered();
|
||||
void on_actionAutorefineAndRMSelfIntersections_triggered();
|
||||
|
|
@ -127,6 +135,7 @@ private:
|
|||
QAction* actionRemoveSelfIntersections;
|
||||
QAction* actionStitchCloseBorderHalfedges;
|
||||
QAction* actionDuplicateNMVertices;
|
||||
QAction* actionExtractNMVertices;
|
||||
QAction* actionMergeDuplicatedVerticesOnBoundaryCycles;
|
||||
QAction* actionAutorefine;
|
||||
QAction* actionAutorefineAndRMSelfIntersections;
|
||||
|
|
@ -346,6 +355,32 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionDuplicateNMVertices_trig
|
|||
}
|
||||
}
|
||||
|
||||
template <typename Item>
|
||||
void Polyhedron_demo_repair_polyhedron_plugin::on_actionExtractNMVertices_triggered(Scene_interface::Item_id index)
|
||||
{
|
||||
namespace PMP = CGAL::Polygon_mesh_processing;
|
||||
typedef typename boost::graph_traits<typename Item::Face_graph>::halfedge_descriptor halfedge_descriptor;
|
||||
|
||||
if (Item* poly_item = qobject_cast<Item*>(scene->item(index)))
|
||||
{
|
||||
std::vector<halfedge_descriptor> hds;
|
||||
PMP::non_manifold_vertices(*poly_item->face_graph(), std::back_inserter(hds));
|
||||
if(hds.empty())
|
||||
{
|
||||
CGAL::Three::Three::information(tr(" No NM vertex found."));
|
||||
return;
|
||||
}
|
||||
Scene_points_with_normal_item* pitem = new Scene_points_with_normal_item();
|
||||
pitem->setColor(Qt::red);
|
||||
pitem->setName(QString("%1 nm vertices").arg(poly_item->name()));
|
||||
for(const auto& h : hds)
|
||||
{
|
||||
pitem->point_set()->insert(poly_item->face_graph()->point(target(h, *poly_item->face_graph())));
|
||||
}
|
||||
scene->addItem (pitem);
|
||||
}
|
||||
}
|
||||
|
||||
void Polyhedron_demo_repair_polyhedron_plugin::on_actionDuplicateNMVertices_triggered()
|
||||
{
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
|
@ -354,6 +389,14 @@ void Polyhedron_demo_repair_polyhedron_plugin::on_actionDuplicateNMVertices_trig
|
|||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void Polyhedron_demo_repair_polyhedron_plugin::on_actionExtractNMVertices_triggered()
|
||||
{
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
const Scene_interface::Item_id index = scene->mainSelectionIndex();
|
||||
on_actionExtractNMVertices_triggered<Scene_surface_mesh_item>(index);
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
template <typename Item>
|
||||
void Polyhedron_demo_repair_polyhedron_plugin::on_actionMergeDuplicatedVerticesOnBoundaryCycles_triggered(Scene_interface::Item_id index)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue