Add inversion of normals

This commit is contained in:
Andreas Fabri 2010-06-11 13:55:14 +00:00
parent 86ed389470
commit 55caf376ab
2 changed files with 221 additions and 178 deletions

View File

@ -1,7 +1,8 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class> <class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" > <widget class="QMainWindow" name="MainWindow">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
@ -9,18 +10,19 @@
<height>578</height> <height>578</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<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>
@ -28,140 +30,144 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="infoLabel" /> <widget class="QLabel" name="infoLabel"/>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QMenuBar" name="menubar" > <widget class="QMenuBar" name="menubar">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<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">
<property name="title" > <property name="title">
<string>&amp;File</string> <string>&amp;File</string>
</property> </property>
<addaction name="actionFileOpen" /> <addaction name="actionFileOpen"/>
<addaction name="actionFileClose" /> <addaction name="actionFileClose"/>
<addaction name="actionFileCloseAll" /> <addaction name="actionFileCloseAll"/>
<addaction name="actionSaveAs" /> <addaction name="actionSaveAs"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionQuit" /> <addaction name="actionQuit"/>
</widget> </widget>
<widget class="QMenu" name="menuEdit" > <widget class="QMenu" name="menuEdit">
<property name="title" > <property name="title">
<string>&amp;Edit</string> <string>&amp;Edit</string>
</property> </property>
<addaction name="actionShowHide" /> <addaction name="actionShowHide"/>
<addaction name="actionDuplicate" /> <addaction name="actionDuplicate"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionDeleteSelection" /> <addaction name="actionDeleteSelection"/>
<addaction name="actionResetSelection" /> <addaction name="actionResetSelection"/>
<addaction name="separator" /> <addaction name="separator"/>
<addaction name="actionConvertToPointSet" /> <addaction name="actionConvertToPointSet"/>
</widget> </widget>
<widget class="QMenu" name="menuView" > <widget class="QMenu" name="menuView">
<property name="title" > <property name="title">
<string>&amp;View</string> <string>&amp;View</string>
</property> </property>
<widget class="QMenu" name="menuDockWindows" > <widget class="QMenu" name="menuDockWindows">
<property name="title" > <property name="title">
<string>Dock windows</string> <string>Dock windows</string>
</property> </property>
<addaction name="dummyAction" /> <addaction name="dummyAction"/>
</widget> </widget>
<addaction name="actionAntiAliasing" /> <addaction name="actionAntiAliasing"/>
<addaction name="actionDraw_two_sides" /> <addaction name="actionDraw_two_sides"/>
<addaction name="menuDockWindows" /> <addaction name="menuDockWindows"/>
</widget> </widget>
<widget class="QMenu" name="menuAnalysis" > <widget class="QMenu" name="menuAnalysis">
<property name="title" > <property name="title">
<string>Analysis</string> <string>Analysis</string>
</property> </property>
<addaction name="actionAverageSpacing" /> <addaction name="actionAverageSpacing"/>
<addaction name="actionRadiusFromDensity" /> <addaction name="actionRadiusFromDensity"/>
</widget> </widget>
<widget class="QMenu" name="menuProcessing" > <widget class="QMenu" name="menuProcessing">
<property name="title" > <property name="title">
<string>Processing</string> <string>Processing</string>
</property> </property>
<addaction name="actionSimplify" /> <addaction name="actionSimplify"/>
<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">
<string>Reconstruction</string> <string>Reconstruction</string>
</property> </property>
<addaction name="actionPoissonReconstruction" /> <addaction name="actionPoissonReconstruction"/>
<addaction name="actionAPSSReconstruction" /> <addaction name="actionAPSSReconstruction"/>
<addaction name="actionInsideOut" /> <addaction name="actionInsideOut"/>
</widget> </widget>
<addaction name="menuFile" /> <addaction name="menuFile"/>
<addaction name="menuEdit" /> <addaction name="menuEdit"/>
<addaction name="menuAnalysis" /> <addaction name="menuAnalysis"/>
<addaction name="menuProcessing" /> <addaction name="menuProcessing"/>
<addaction name="menuReconstruction" /> <addaction name="menuReconstruction"/>
<addaction name="menuView" /> <addaction name="menuView"/>
</widget> </widget>
<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>
</property> </property>
<attribute name="dockWidgetArea" > <attribute name="dockWidgetArea">
<number>1</number> <number>1</number>
</attribute> </attribute>
<widget class="QWidget" name="dockWidgetContent" > <widget class="QWidget" name="dockWidgetContent">
<layout class="QGridLayout" > <layout class="QGridLayout">
<item row="0" column="0" > <item row="0" column="0">
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<item> <item>
<layout class="QHBoxLayout" > <layout class="QHBoxLayout">
<item> <item>
<widget class="QToolButton" name="addButton" > <widget class="QToolButton" name="addButton">
<property name="text" > <property name="text">
<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>
<item> <item>
<widget class="QToolButton" name="removeButton" > <widget class="QToolButton" name="removeButton">
<property name="text" > <property name="text">
<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>
<item> <item>
<widget class="QToolButton" name="duplicateButton" > <widget class="QToolButton" name="duplicateButton">
<property name="text" > <property name="text">
<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>
<item> <item>
<spacer> <spacer>
<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>
@ -172,14 +178,14 @@
</layout> </layout>
</item> </item>
<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>
</property> </property>
<property name="indentation" > <property name="indentation">
<number>0</number> <number>0</number>
</property> </property>
</widget> </widget>
@ -189,21 +195,21 @@
</layout> </layout>
</widget> </widget>
</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>
</property> </property>
<attribute name="dockWidgetArea" > <attribute name="dockWidgetArea">
<number>8</number> <number>8</number>
</attribute> </attribute>
<widget class="QWidget" name="dockWidgetContents" > <widget class="QWidget" name="dockWidgetContents">
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<item> <item>
<widget class="QTextEdit" name="consoleTextEdit" > <widget class="QTextEdit" name="consoleTextEdit">
<property name="readOnly" > <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
@ -211,195 +217,203 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
<action name="actionQuit" > <action name="actionQuit">
<property name="text" > <property name="text">
<string>&amp;Quit</string> <string>&amp;Quit</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+Q</string> <string>Ctrl+Q</string>
</property> </property>
</action> </action>
<action name="actionSimplify" > <action name="actionSimplify">
<property name="text" > <property name="text">
<string>&amp;Simplification</string> <string>&amp;Simplification</string>
</property> </property>
</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>&amp;Open...</string> <string>&amp;Open...</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+O</string> <string>Ctrl+O</string>
</property> </property>
</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>&amp;Close</string> <string>&amp;Close</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+W</string> <string>Ctrl+W</string>
</property> </property>
</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>&amp;Duplicate</string> <string>&amp;Duplicate</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+D</string> <string>Ctrl+D</string>
</property> </property>
</action> </action>
<action name="actionAntiAliasing" > <action name="actionAntiAliasing">
<property name="checkable" > <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Antialiasing</string> <string>&amp;Antialiasing</string>
</property> </property>
</action> </action>
<action name="dummyAction" > <action name="dummyAction">
<property name="text" > <property name="text">
<string>n/a</string> <string>n/a</string>
</property> </property>
</action> </action>
<action name="actionFileCloseAll" > <action name="actionFileCloseAll">
<property name="text" > <property name="text">
<string>&amp;Close All</string> <string>&amp;Close All</string>
</property> </property>
</action> </action>
<action name="actionOptions" > <action name="actionOptions">
<property name="text" > <property name="text">
<string>&amp;Options...</string> <string>&amp;Options...</string>
</property> </property>
</action> </action>
<action name="actionSaveAs" > <action name="actionSaveAs">
<property name="text" > <property name="text">
<string>Save &amp;as...</string> <string>Save &amp;as...</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+Alt+S</string> <string>Ctrl+Alt+S</string>
</property> </property>
</action> </action>
<action name="actionSave" > <action name="actionSave">
<property name="text" > <property name="text">
<string>&amp;Save</string> <string>&amp;Save</string>
</property> </property>
</action> </action>
<action name="actionSaveAll" > <action name="actionSaveAll">
<property name="text" > <property name="text">
<string>Save a&amp;ll</string> <string>Save a&amp;ll</string>
</property> </property>
</action> </action>
<action name="actionMergeAll" > <action name="actionMergeAll">
<property name="text" > <property name="text">
<string>Mer&amp;ge all</string> <string>Mer&amp;ge all</string>
</property> </property>
</action> </action>
<action name="actionMerge" > <action name="actionMerge">
<property name="text" > <property name="text">
<string>&amp;Merge</string> <string>&amp;Merge</string>
</property> </property>
</action> </action>
<action name="actionSelectAll" > <action name="actionSelectAll">
<property name="text" > <property name="text">
<string>Select &amp;all</string> <string>Select &amp;all</string>
</property> </property>
</action> </action>
<action name="actionSelectNone" > <action name="actionSelectNone">
<property name="text" > <property name="text">
<string>Select &amp;none</string> <string>Select &amp;none</string>
</property> </property>
</action> </action>
<action name="actionSelectInvert" > <action name="actionSelectInvert">
<property name="text" > <property name="text">
<string>&amp;Invert selection</string> <string>&amp;Invert selection</string>
</property> </property>
</action> </action>
<action name="actionShowHide" > <action name="actionShowHide">
<property name="text" > <property name="text">
<string>Show/Hide</string> <string>Show/Hide</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Ctrl+Space</string> <string>Ctrl+Space</string>
</property> </property>
</action> </action>
<action name="actionInsideOut" > <action name="actionInsideOut">
<property name="text" > <property name="text">
<string>Inside-out</string> <string>Inside-out</string>
</property> </property>
</action> </action>
<action name="actionAPSSReconstruction" > <action name="actionAPSSReconstruction">
<property name="text" > <property name="text">
<string>APSS Reconstruction</string> <string>APSS Reconstruction</string>
</property> </property>
</action> </action>
<action name="actionRadiusFromDensity" > <action name="actionRadiusFromDensity">
<property name="text" > <property name="text">
<string>Point radius from density</string> <string>Point radius from density</string>
</property> </property>
</action> </action>
<action name="actionOutlierRemoval" > <action name="actionOutlierRemoval">
<property name="text" > <property name="text">
<string>Outlier removal</string> <string>Outlier removal</string>
</property> </property>
</action> </action>
<action name="actionJetSmoothing" > <action name="actionJetSmoothing">
<property name="text" > <property name="text">
<string>Jet smoothing</string> <string>Jet smoothing</string>
</property> </property>
</action> </action>
<action name="actionNormalEstimation" > <action name="actionNormalEstimation">
<property name="text" > <property name="text">
<string>Normal estimation</string> <string>Normal estimation</string>
</property> </property>
</action> </action>
<action name="actionDraw_two_sides" > <action name="actionDraw_two_sides">
<property name="checkable" > <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="text" > <property name="text">
<string>Draw two sides</string> <string>Draw two sides</string>
</property> </property>
</action> </action>
<action name="actionConvertToPointSet" > <action name="actionConvertToPointSet">
<property name="text" > <property name="text">
<string>Convert to Point Set</string> <string>Convert to Point Set</string>
</property> </property>
<property name="toolTip" > <property name="toolTip">
<string>Convert Mesh to Point Set</string> <string>Convert Mesh to Point Set</string>
</property> </property>
</action> </action>
<action name="actionDeleteSelection" > <action name="actionDeleteSelection">
<property name="text" > <property name="text">
<string>Delete Selection</string> <string>Delete Selection</string>
</property> </property>
<property name="shortcut" > <property name="shortcut">
<string>Del</string> <string>Del</string>
</property> </property>
</action> </action>
<action name="actionResetSelection" > <action name="actionResetSelection">
<property name="text" > <property name="text">
<string>Reset Selection</string> <string>Reset Selection</string>
</property> </property>
</action> </action>
<action name="actionPoissonReconstruction" > <action name="actionPoissonReconstruction">
<property name="text" > <property name="text">
<string>Poisson reconstruction</string> <string>Poisson reconstruction</string>
</property> </property>
</action> </action>
<action name="actionAverageSpacing" > <action name="actionAverageSpacing">
<property name="text" > <property name="text">
<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>
@ -409,7 +423,7 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="Point_set_demo.qrc" /> <include location="Point_set_demo.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -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();