Developer Documentation

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
MeshRepairPlugin.hh
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39 * *
40 \*===========================================================================*/
41
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49
50 #ifndef MESHREPAIRPLUGIN_HH
51 #define MESHREPAIRPLUGIN_HH
52
53 #include <QObject>
54 #include <QMenuBar>
55
56 #include <OpenFlipper/BasePlugin/BaseInterface.hh>
57 #include <OpenFlipper/BasePlugin/LoggingInterface.hh>
58 #include <OpenFlipper/BasePlugin/ToolboxInterface.hh>
59 #include <OpenFlipper/BasePlugin/BackupInterface.hh>
60 #include <OpenFlipper/BasePlugin/ScriptInterface.hh>
61 #include <OpenFlipper/BasePlugin/RPCInterface.hh>
62 #include <OpenFlipper/common/Types.hh>
63 #include <ObjectTypes/PolyMesh/PolyMesh.hh>
64 #include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
65
66 #include "MeshRepairToolbar.hh"
67
68 class MeshRepairPlugin : public QObject, BaseInterface , ToolboxInterface, BackupInterface, LoggingInterface, ScriptInterface, RPCInterface
69 {
70 Q_OBJECT
71 Q_INTERFACES(BaseInterface)
72 Q_INTERFACES(ToolboxInterface)
73 Q_INTERFACES(BackupInterface)
74 Q_INTERFACES(LoggingInterface)
75 Q_INTERFACES(ScriptInterface)
76 Q_INTERFACES(RPCInterface)
77
78 #if QT_VERSION >= 0x050000
79 Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-MeshRepair")
80 #endif
81
82 signals:
83
84 void updateView();
85
86 // Base Interface
87 void updatedObject(int _identifier, const UpdateType& _type);
88 void setSlotDescription(QString _slotName, QString _slotDescription,
89 QStringList _parameters, QStringList _descriptions);
90
91 // Logging interface
92 void log(Logtype _type, QString _message);
93 void log(QString _message);
94
95 // ToolboxInterface
96 void addToolbox( QString _name , QWidget* _widget, QIcon* _icon );
97
98 // Backup Interface
99 void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL);
100
101 // RPC Interface
102 void pluginExists( QString _pluginName , bool& _exists ) ;
103 void functionExists( QString _pluginName , QString _functionName , bool& _exists );
104
105 // ScriptInterface
106 void scriptInfo( QString _functionName );
107
108 private slots:
109
110 void initializePlugin();
111 void pluginsInitialized();
112
113 public :
114
115 MeshRepairPlugin();
116
117 ~MeshRepairPlugin() {};
118
119 QString name() {
120 return (QString("Mesh Repair"));
121 };
122 QString description( ) {
123 return (QString("Functionality to repair meshes"));
124 };
125
126 private :
127
129 MeshRepairToolbarWidget* tool_;
130 QIcon* toolIcon_;
131
132 private slots:
133
135 void slotRemoveSelectedVal3Vertices();
136
138 void slotRemoveSelectedEdges();
139
141 void slotDetectSkinnyTriangleByAngle();
142
144 void slotRemoveSkinnyTriangleByAngle();
145
147 void slotDetectFoldover();
148
150 void slotDetectTriangleAspect();
151
153 void slotFlipOrientation();
154
156 void slotFixMesh();
157
159 void slotUpdateVertexNormals();
160
162 void slotUpdateFaceNormals();
163
165 void slotUpdateHalfedgeNormals();
166
168 void slotUpdateNormals();
169
171 void slotDetectEdgesLonger();
172
174 void slotDetectEdgesShorter();
175
177 void slotDetectFlatValence3Vertices();
178
180 void slotSnapBoundary();
181
183 void slotFixNonManifoldVertices();
184
185
186 //===========================================================================
189 //===========================================================================
190
191 public slots:
192
193 // ==================================================
194 // Vertex operations
195 // ==================================================
196
200 void detectFlatValence3Vertices(int _objectId, double _angle);
201
203 void removeSelectedVal3Vertices(int _objectId);
204
205 // ==================================================
206 // Edge operations
207 // ==================================================
208
214 void selectEdgesShorterThan(int _objectId,double _length);
215
221 void selectEdgesLongerThan(int _objectId,double _length);
222
227 void removeSelectedEdges(int _objectId);
228
235 void detectSkinnyTriangleByAngle(int _objectId, double _angle, bool _remove);
236
242 void detectFoldover(int _objectId, float _angle);
243
244
245 // ==================================================
246 // Face operations
247 // ==================================================
248
254 void detectTriangleAspect(int _objectId, float _aspect);
255
260 void flipOrientation(int _objectId);
261
262 // ==================================================
263 // Normal recomputations
264 // ==================================================
265
270 void updateFaceNormals(int _objectId);
271
276 void updateHalfedgeNormals(int _objectId);
277
282 void updateVertexNormals(int _objectId);
283
288 void updateNormals(int _objectId);
289
290 // ==================================================
291 // General
292 // ==================================================
293
303 void snapBoundary(int _objectId, double _eps);
304
309 void fixNonManifoldVertices(int _objectId);
310
320 void fixMesh(int _objectId, double _epsilon);
321
324 private:
332 void selectionEdgeLength(int _objectId, double _length, bool _larger);
333
342 template<typename MeshT>
343 void flipOrientation(MeshT& _mesh);
344
345
346 public slots:
347 QString version() { return QString("1.3"); };
348 };
349
350 #if defined(INCLUDE_TEMPLATES) && !defined(MESHREPAIRPLUGINT_CC)
351 #define MESHREPAIRPLUGIN_TEMPLATES
352 #include "MeshRepairPluginT.cc"
353 #endif
354
355 #endif //MESHREPAIRPLUGIN_HH
MeshRepairPlugin::updateNormals
void updateNormals(int _objectId)
Recomputes the face and vertex normals of an object.
Definition: NormalFixing.cc:148
MeshRepairPlugin::slotUpdateVertexNormals
void slotUpdateVertexNormals()
Button slot.
Definition: MeshRepairPlugin.cc:211
BaseInterface
Interface class from which all plugins have to be created.
Definition: BaseInterface.hh:76
MeshRepairPlugin::removeSelectedVal3Vertices
void removeSelectedVal3Vertices(int _objectId)
Remove all selected valence 3 vertices.
Definition: VertexFunctions.cc:116
MeshRepairPlugin::slotDetectEdgesShorter
void slotDetectEdgesShorter()
Button Slot.
Definition: MeshRepairPlugin.cc:247
Logtype
Logtype
Log types for Message Window.
Definition: LoggingInterface.hh:103
MeshRepairPlugin::flipOrientation
void flipOrientation(int _objectId)
Flips the normals of all selected faces by changing the vertex order.
Definition: FaceFunctions.cc:106
MeshRepairPlugin::updateVertexNormals
void updateVertexNormals(int _objectId)
Recomputes the vertex normals of an object.
Definition: NormalFixing.cc:121
BackupInterface.hh
TriangleMesh.hh
MeshRepairPlugin::snapBoundary
void snapBoundary(int _objectId, double _eps)
Snaps selected vertices at boundaries.
Definition: GeneralMeshFixing.cc:61
UpdateType
Update type class.
Definition: UpdateType.hh:70
UPDATE_ALL
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
MeshRepairPlugin::detectTriangleAspect
void detectTriangleAspect(int _objectId, float _aspect)
Detect triangles with aspect ratio greater than _aspect and select them.
Definition: FaceFunctions.cc:60
MeshRepairPlugin
Definition: MeshRepairPlugin.hh:68
MeshRepairPlugin::removeSelectedEdges
void removeSelectedEdges(int _objectId)
Removes all selected edges.
Definition: EdgeFunctions.cc:147
MeshRepairPlugin::slotRemoveSelectedVal3Vertices
void slotRemoveSelectedVal3Vertices()
Button slot.
Definition: MeshRepairPlugin.cc:128
MeshRepairPlugin::fixMesh
void fixMesh(int _objectId, double _epsilon)
Fix a mesh.
Definition: GeneralMeshFixing.cc:116
LoggingInterface.hh
MeshRepairPlugin::updateHalfedgeNormals
void updateHalfedgeNormals(int _objectId)
Recomputes the halfedge normals of an object.
Definition: NormalFixing.cc:89
LoggingInterface
Interface for all Plugins which do logging to the logging window of the framework.
Definition: LoggingInterface.hh:123
MeshRepairPlugin::detectFlatValence3Vertices
void detectFlatValence3Vertices(int _objectId, double _angle)
Detect valence 3 vertices with faces that lie in the plane of their adjacent triangles.
Definition: VertexFunctions.cc:60
MeshRepairPlugin::slotDetectSkinnyTriangleByAngle
void slotDetectSkinnyTriangleByAngle()
Button slot.
Definition: MeshRepairPlugin.cc:148
MeshRepairPlugin::slotFlipOrientation
void slotFlipOrientation()
Button slot.
Definition: MeshRepairPlugin.cc:189
MeshRepairPlugin::slotUpdateFaceNormals
void slotUpdateFaceNormals()
Button slot.
Definition: MeshRepairPlugin.cc:220
RPCInterface
Interface to call functions across plugins.
Definition: RPCInterface.hh:71
MeshRepairPlugin::slotFixMesh
void slotFixMesh()
Button slot.
Definition: MeshRepairPlugin.cc:199
MeshRepairPlugin::selectEdgesLongerThan
void selectEdgesLongerThan(int _objectId, double _length)
Selects all edges of an object which are larger than the given length.
Definition: EdgeFunctions.cc:67
MeshRepairPlugin::slotUpdateHalfedgeNormals
void slotUpdateHalfedgeNormals()
Button slot.
Definition: MeshRepairPlugin.cc:229
MeshRepairPlugin::name
QString name()
Return a name for the plugin.
Definition: MeshRepairPlugin.hh:119
MeshRepairPlugin::detectSkinnyTriangleByAngle
void detectSkinnyTriangleByAngle(int _objectId, double _angle, bool _remove)
Detect/Remove edges where neighboring faces form angle > _angle degrees.
Definition: EdgeFunctions.cc:200
MeshRepairPlugin::tool_
MeshRepairToolbarWidget * tool_
Widget for Toolbox.
Definition: MeshRepairPlugin.hh:124
MeshRepairPlugin::description
QString description()
Return a description of what the plugin is doing.
Definition: MeshRepairPlugin.hh:122
ScriptInterface
Interface for all Plugins which provide scriptable Functions.
Definition: ScriptInterface.hh:67
RPCInterface.hh
MeshRepairPlugin::slotDetectFoldover
void slotDetectFoldover()
Button slot.
Definition: MeshRepairPlugin.cc:169
PolyMesh.hh
MeshRepairPlugin::slotFixNonManifoldVertices
void slotFixNonManifoldVertices()
Button slot.
Definition: MeshRepairPlugin.cc:290
MeshRepairPlugin::updateFaceNormals
void updateFaceNormals(int _objectId)
Recomputes the face normals of an object.
Definition: NormalFixing.cc:60
MeshRepairPlugin::slotDetectTriangleAspect
void slotDetectTriangleAspect()
Button slot.
Definition: MeshRepairPlugin.cc:179
MeshRepairPlugin::slotSnapBoundary
void slotSnapBoundary()
Button slot.
Definition: MeshRepairPlugin.cc:280
MeshRepairPlugin::slotRemoveSkinnyTriangleByAngle
void slotRemoveSkinnyTriangleByAngle()
Button slot.
Definition: MeshRepairPlugin.cc:158
BackupInterface
Interface class for backup handling.
Definition: BackupInterface.hh:75
ScriptInterface.hh
BaseInterface.hh
MeshRepairPlugin::slotDetectEdgesLonger
void slotDetectEdgesLonger()
Button Slot.
Definition: MeshRepairPlugin.cc:258
ToolboxInterface
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
Definition: ToolboxInterface.hh:85
MeshRepairPlugin::pluginsInitialized
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
Definition: MeshRepairPlugin.cc:303
Types.hh
MeshRepairPlugin::selectEdgesShorterThan
void selectEdgesShorterThan(int _objectId, double _length)
Selects all edges of an object which are shorter than the given length.
Definition: EdgeFunctions.cc:59
MeshRepairPlugin::selectionEdgeLength
void selectionEdgeLength(int _objectId, double _length, bool _larger)
select edges based on length
Definition: EdgeFunctions.cc:76
MeshRepairPlugin::slotUpdateNormals
void slotUpdateNormals()
Button slot.
Definition: MeshRepairPlugin.cc:238
ToolboxInterface.hh
MeshRepairPlugin::slotRemoveSelectedEdges
void slotRemoveSelectedEdges()
Button slot.
Definition: MeshRepairPlugin.cc:138
MeshRepairPlugin::detectFoldover
void detectFoldover(int _objectId, float _angle)
Detect folded-over configurations by the dihedral angle.
Definition: EdgeFunctions.cc:263
MeshRepairPlugin::slotDetectFlatValence3Vertices
void slotDetectFlatValence3Vertices()
Button slot.
Definition: MeshRepairPlugin.cc:269
MeshRepairPlugin::fixNonManifoldVertices
void fixNonManifoldVertices(int _objectId)
remove non-manifold vertices by duplicating them
Definition: GeneralMeshFixing.cc:88
MeshRepairToolbarWidget
Definition: MeshRepairToolbar.hh:59