mirror of https://github.com/CGAL/cgal
Add inversion of normals
This commit is contained in:
parent
86ed389470
commit
55caf376ab
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
|
|
@ -13,14 +14,15 @@
|
|||
<string>CGAL Point Set demo</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="Point_set_demo.qrc" >:/cgal/icons/resources/cgal_logo.xpm</iconset>
|
||||
<iconset resource="Point_set_demo.qrc">
|
||||
<normaloff>:/cgal/icons/resources/cgal_logo.xpm</normaloff>:/cgal/icons/resources/cgal_logo.xpm</iconset>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="Viewer" native="1" name="viewer" >
|
||||
<widget class="Viewer" name="viewer" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
|
|
@ -38,7 +40,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>636</width>
|
||||
<height>27</height>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
@ -93,6 +95,7 @@
|
|||
<addaction name="actionOutlierRemoval"/>
|
||||
<addaction name="actionJetSmoothing"/>
|
||||
<addaction name="actionNormalEstimation"/>
|
||||
<addaction name="actionNormalInversion"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuReconstruction">
|
||||
<property name="title">
|
||||
|
|
@ -112,7 +115,7 @@
|
|||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QDockWidget" name="sceneDockWidget">
|
||||
<property name="locale">
|
||||
<locale country="UnitedStates" language="English" />
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Point sets and surfaces</string>
|
||||
|
|
@ -132,7 +135,8 @@
|
|||
<string>+</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Point_set_demo.qrc" >:/cgal/icons/plus</iconset>
|
||||
<iconset resource="Point_set_demo.qrc">
|
||||
<normaloff>:/cgal/icons/plus</normaloff>:/cgal/icons/plus</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -142,7 +146,8 @@
|
|||
<string>-</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Point_set_demo.qrc" >:/cgal/icons/minus</iconset>
|
||||
<iconset resource="Point_set_demo.qrc">
|
||||
<normaloff>:/cgal/icons/minus</normaloff>:/cgal/icons/minus</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -152,7 +157,8 @@
|
|||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="Point_set_demo.qrc" >:/cgal/icons/duplicate</iconset>
|
||||
<iconset resource="Point_set_demo.qrc">
|
||||
<normaloff>:/cgal/icons/duplicate</normaloff>:/cgal/icons/duplicate</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -161,7 +167,7 @@
|
|||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
|
@ -174,7 +180,7 @@
|
|||
<item>
|
||||
<widget class="QTreeView" name="treeView">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::NoEditTriggers|QAbstractItemView::SelectedClicked</set>
|
||||
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
|
|
@ -191,7 +197,7 @@
|
|||
</widget>
|
||||
<widget class="QDockWidget" name="consoleDockWidget">
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::TopDockWidgetArea</set>
|
||||
<set>Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::TopDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Console</string>
|
||||
|
|
@ -226,7 +232,8 @@
|
|||
</action>
|
||||
<action name="actionFileOpen">
|
||||
<property name="icon">
|
||||
<iconset resource="Point_set_demo.qrc" >:/cgal/icons/plus</iconset>
|
||||
<iconset resource="Point_set_demo.qrc">
|
||||
<normaloff>:/cgal/icons/plus</normaloff>:/cgal/icons/plus</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Open...</string>
|
||||
|
|
@ -237,7 +244,8 @@
|
|||
</action>
|
||||
<action name="actionFileClose">
|
||||
<property name="icon">
|
||||
<iconset resource="Point_set_demo.qrc" >:/cgal/icons/minus</iconset>
|
||||
<iconset resource="Point_set_demo.qrc">
|
||||
<normaloff>:/cgal/icons/minus</normaloff>:/cgal/icons/minus</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Close</string>
|
||||
|
|
@ -248,7 +256,8 @@
|
|||
</action>
|
||||
<action name="actionDuplicate">
|
||||
<property name="icon">
|
||||
<iconset resource="Point_set_demo.qrc" >:/cgal/icons/duplicate</iconset>
|
||||
<iconset resource="Point_set_demo.qrc">
|
||||
<normaloff>:/cgal/icons/duplicate</normaloff>:/cgal/icons/duplicate</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Duplicate</string>
|
||||
|
|
@ -400,6 +409,11 @@
|
|||
<string>Average spacing</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNormalInversion">
|
||||
<property name="text">
|
||||
<string>Normal inversion</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class PS_demo_normal_estimation_plugin :
|
|||
Q_OBJECT
|
||||
Q_INTERFACES(Polyhedron_demo_plugin_interface)
|
||||
QAction* actionNormalEstimation;
|
||||
QAction* actionNormalInversion;
|
||||
|
||||
public:
|
||||
void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
|
||||
|
|
@ -36,14 +37,21 @@ public:
|
|||
connect(actionNormalEstimation, SIGNAL(triggered()),
|
||||
this, SLOT(on_actionNormalEstimation_triggered()));
|
||||
}
|
||||
|
||||
actionNormalInversion = this->getActionFromMainWindow(mw, "actionNormalInversion");
|
||||
if(actionNormalInversion) {
|
||||
connect(actionNormalInversion, SIGNAL(triggered()),
|
||||
this, SLOT(on_actionNormalInversion_triggered()));
|
||||
}
|
||||
}
|
||||
|
||||
QList<QAction*> actions() const {
|
||||
return QList<QAction*>() << actionNormalEstimation;
|
||||
return QList<QAction*>() << actionNormalEstimation << actionNormalInversion;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void on_actionNormalEstimation_triggered();
|
||||
void on_actionNormalInversion_triggered();
|
||||
|
||||
}; // end PS_demo_smoothing_plugin
|
||||
|
||||
|
|
@ -63,6 +71,27 @@ class Point_set_demo_normal_estimation_dialog : public QDialog, private Ui::Norm
|
|||
int orientationNbNeighbors() const { return m_inputNbNeighborsOrientation->value(); }
|
||||
};
|
||||
|
||||
|
||||
void PS_demo_normal_estimation_plugin::on_actionNormalInversion_triggered()
|
||||
{
|
||||
const Scene_interface::Item_id index = scene->mainSelectionIndex();
|
||||
|
||||
Point_set_scene_item* item =
|
||||
qobject_cast<Point_set_scene_item*>(scene->item(index));
|
||||
|
||||
if(item)
|
||||
{
|
||||
// Gets point set
|
||||
Point_set* points = item->point_set();
|
||||
if(points == NULL)
|
||||
return;
|
||||
|
||||
for(Point_set::iterator it = points->begin(); it != points->end(); ++it){
|
||||
it->normal() = -1 * it->normal();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PS_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered()
|
||||
{
|
||||
const Scene_interface::Item_id index = scene->mainSelectionIndex();
|
||||
|
|
|
|||
Loading…
Reference in New Issue