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">
|
<ui version="4.0">
|
||||||
<class>MainWindow</class>
|
<class>MainWindow</class>
|
||||||
<widget class="QMainWindow" name="MainWindow">
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
|
@ -13,14 +14,15 @@
|
||||||
<string>CGAL Point Set demo</string>
|
<string>CGAL Point Set demo</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<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>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="Viewer" native="1" name="viewer" >
|
<widget class="Viewer" name="viewer" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>1</verstretch>
|
<verstretch>1</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
|
|
@ -38,7 +40,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>636</width>
|
<width>636</width>
|
||||||
<height>27</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuFile">
|
<widget class="QMenu" name="menuFile">
|
||||||
|
|
@ -93,6 +95,7 @@
|
||||||
<addaction name="actionOutlierRemoval"/>
|
<addaction name="actionOutlierRemoval"/>
|
||||||
<addaction name="actionJetSmoothing"/>
|
<addaction name="actionJetSmoothing"/>
|
||||||
<addaction name="actionNormalEstimation"/>
|
<addaction name="actionNormalEstimation"/>
|
||||||
|
<addaction name="actionNormalInversion"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menuReconstruction">
|
<widget class="QMenu" name="menuReconstruction">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
|
|
@ -112,7 +115,7 @@
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
<widget class="QDockWidget" name="sceneDockWidget">
|
<widget class="QDockWidget" name="sceneDockWidget">
|
||||||
<property name="locale">
|
<property name="locale">
|
||||||
<locale country="UnitedStates" language="English" />
|
<locale language="English" country="UnitedStates"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Point sets and surfaces</string>
|
<string>Point sets and surfaces</string>
|
||||||
|
|
@ -132,7 +135,8 @@
|
||||||
<string>+</string>
|
<string>+</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<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>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -142,7 +146,8 @@
|
||||||
<string>-</string>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<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>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -152,7 +157,8 @@
|
||||||
<string>...</string>
|
<string>...</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<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>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -161,7 +167,7 @@
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>40</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
|
|
@ -174,7 +180,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTreeView" name="treeView">
|
<widget class="QTreeView" name="treeView">
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::NoEditTriggers|QAbstractItemView::SelectedClicked</set>
|
<set>QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
|
@ -191,7 +197,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QDockWidget" name="consoleDockWidget">
|
<widget class="QDockWidget" name="consoleDockWidget">
|
||||||
<property name="allowedAreas">
|
<property name="allowedAreas">
|
||||||
<set>Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::TopDockWidgetArea</set>
|
<set>Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::TopDockWidgetArea</set>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Console</string>
|
<string>Console</string>
|
||||||
|
|
@ -226,7 +232,8 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionFileOpen">
|
<action name="actionFileOpen">
|
||||||
<property name="icon">
|
<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>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Open...</string>
|
<string>&Open...</string>
|
||||||
|
|
@ -237,7 +244,8 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionFileClose">
|
<action name="actionFileClose">
|
||||||
<property name="icon">
|
<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>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Close</string>
|
<string>&Close</string>
|
||||||
|
|
@ -248,7 +256,8 @@
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDuplicate">
|
<action name="actionDuplicate">
|
||||||
<property name="icon">
|
<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>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Duplicate</string>
|
<string>&Duplicate</string>
|
||||||
|
|
@ -400,6 +409,11 @@
|
||||||
<string>Average spacing</string>
|
<string>Average spacing</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionNormalInversion">
|
||||||
|
<property name="text">
|
||||||
|
<string>Normal inversion</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ class PS_demo_normal_estimation_plugin :
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(Polyhedron_demo_plugin_interface)
|
Q_INTERFACES(Polyhedron_demo_plugin_interface)
|
||||||
QAction* actionNormalEstimation;
|
QAction* actionNormalEstimation;
|
||||||
|
QAction* actionNormalInversion;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
|
void init(QMainWindow* mainWindow, Scene_interface* scene_interface) {
|
||||||
|
|
@ -36,14 +37,21 @@ public:
|
||||||
connect(actionNormalEstimation, SIGNAL(triggered()),
|
connect(actionNormalEstimation, SIGNAL(triggered()),
|
||||||
this, SLOT(on_actionNormalEstimation_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 {
|
QList<QAction*> actions() const {
|
||||||
return QList<QAction*>() << actionNormalEstimation;
|
return QList<QAction*>() << actionNormalEstimation << actionNormalInversion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_actionNormalEstimation_triggered();
|
void on_actionNormalEstimation_triggered();
|
||||||
|
void on_actionNormalInversion_triggered();
|
||||||
|
|
||||||
}; // end PS_demo_smoothing_plugin
|
}; // 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(); }
|
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()
|
void PS_demo_normal_estimation_plugin::on_actionNormalEstimation_triggered()
|
||||||
{
|
{
|
||||||
const Scene_interface::Item_id index = scene->mainSelectionIndex();
|
const Scene_interface::Item_id index = scene->mainSelectionIndex();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue