Developer Documentation
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 #ifndef MESHREPAIRPLUGIN_HH
45 #define MESHREPAIRPLUGIN_HH
46 
47 #include <QObject>
48 #include <QMenuBar>
49 
60 
61 #include "MeshRepairToolbar.hh"
62 
64 {
65  Q_OBJECT
66  Q_INTERFACES(BaseInterface)
67  Q_INTERFACES(ToolboxInterface)
68  Q_INTERFACES(BackupInterface)
69  Q_INTERFACES(LoggingInterface)
70  Q_INTERFACES(ScriptInterface)
71  Q_INTERFACES(RPCInterface)
72  Q_INTERFACES(PythonInterface)
73 
74  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-MeshRepair")
75 
76 signals:
77 
78  void updateView();
79 
80  // Base Interface
81  void updatedObject(int _identifier, const UpdateType& _type);
82  void setSlotDescription(QString _slotName, QString _slotDescription,
83  QStringList _parameters, QStringList _descriptions);
84 
85  // Logging interface
86  void log(Logtype _type, QString _message);
87  void log(QString _message);
88 
89  // ToolboxInterface
90  void addToolbox( QString _name , QWidget* _widget, QIcon* _icon );
91 
92  // Backup Interface
93  void createBackup( int _objectid, QString _name, UpdateType _type = UPDATE_ALL);
94 
95  // RPC Interface
96  void pluginExists( QString _pluginName , bool& _exists ) ;
97  void functionExists( QString _pluginName , QString _functionName , bool& _exists );
98 
99  // ScriptInterface
100  void scriptInfo( QString _functionName );
101 
102 private slots:
103 
104  void initializePlugin();
105  void pluginsInitialized();
106 
107 public :
108 
110 
111  ~MeshRepairPlugin() {};
112 
113  QString name() {
114  return (QString("MeshRepair"));
115  };
116  QString description( ) {
117  return (QString("Functionality to repair meshes"));
118  };
119 
120 private :
121 
124  QIcon* toolIcon_;
125 
126 private slots:
127 
130 
133 
136 
139 
141  void slotDetectFoldover();
142 
145 
147  void slotFlipOrientation();
148 
150  void slotFixMesh();
151 
154 
156  void slotUpdateFaceNormals();
157 
160 
162  void slotUpdateNormals();
163 
165  void slotDetectEdgesLonger();
166 
168  void slotDetectEdgesShorter();
169 
172 
174  void slotSnapBoundary();
175 
178 
179 
180  //===========================================================================
183  //===========================================================================
184 
185 public slots:
186 
187  // ==================================================
188  // Vertex operations
189  // ==================================================
190 
194  void detectFlatValence3Vertices(int _objectId, double _angle);
195 
197  void removeSelectedVal3Vertices(int _objectId);
198 
199  // ==================================================
200  // Edge operations
201  // ==================================================
202 
208  void selectEdgesShorterThan(int _objectId,double _length);
209 
215  void selectEdgesLongerThan(int _objectId,double _length);
216 
221  void removeSelectedEdges(int _objectId);
222 
229  void detectSkinnyTriangleByAngle(int _objectId, double _angle, bool _remove);
230 
236  void detectFoldover(int _objectId, float _angle);
237 
238 
239  // ==================================================
240  // Face operations
241  // ==================================================
242 
248  void detectTriangleAspect(int _objectId, float _aspect);
249 
254  void flipOrientation(int _objectId);
255 
256  // ==================================================
257  // Normal recomputations
258  // ==================================================
259 
264  void updateFaceNormals(int _objectId);
265 
270  void updateHalfedgeNormals(int _objectId);
271 
276  void updateVertexNormals(int _objectId);
277 
282  void updateNormals(int _objectId);
283 
284  // ==================================================
285  // General
286  // ==================================================
287 
297  void snapBoundary(int _objectId, double _eps);
298 
303  void fixNonManifoldVertices(int _objectId);
304 
314  void fixMesh(int _objectId, double _epsilon);
315 
318 private:
326  void selectionEdgeLength(int _objectId, double _length, bool _larger);
327 
336  template<typename MeshT>
337  void flipOrientation(MeshT& _mesh);
338 
339 
340 public slots:
341  QString version() { return QString("1.3"); };
342 };
343 
344 #if defined(INCLUDE_TEMPLATES) && !defined(MESHREPAIRPLUGINT_CC)
345 #define MESHREPAIRPLUGIN_TEMPLATES
346 #include "MeshRepairPluginT_impl.hh"
347 #endif
348 
349 #endif //MESHREPAIRPLUGIN_HH
void slotUpdateHalfedgeNormals()
Button slot.
void detectSkinnyTriangleByAngle(int _objectId, double _angle, bool _remove)
Detect/Remove edges where neighboring faces form angle > _angle degrees.
void updateNormals(int _objectId)
Recomputes the face and vertex normals of an object.
MeshRepairToolbarWidget * tool_
Widget for Toolbox.
Interface class for exporting functions to python.
void slotDetectEdgesShorter()
Button Slot.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
void slotFlipOrientation()
Button slot.
Plugins can add its own toolbox to the main widget&#39;s toolbox area by using this interface.
void slotRemoveSelectedEdges()
Button slot.
void fixMesh(int _objectId, double _epsilon)
Fix a mesh.
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
Logtype
Log types for Message Window.
void slotRemoveSkinnyTriangleByAngle()
Button slot.
void selectEdgesLongerThan(int _objectId, double _length)
Selects all edges of an object which are larger than the given length.
Interface for all Plugins which do logging to the logging window of the framework.
void slotUpdateFaceNormals()
Button slot.
void slotDetectTriangleAspect()
Button slot.
void slotDetectSkinnyTriangleByAngle()
Button slot.
void updateVertexNormals(int _objectId)
Recomputes the vertex normals of an object.
void selectEdgesShorterThan(int _objectId, double _length)
Selects all edges of an object which are shorter than the given length.
void selectionEdgeLength(int _objectId, double _length, bool _larger)
select edges based on length
Interface to call functions across plugins.
Definition: RPCInterface.hh:61
void removeSelectedEdges(int _objectId)
Removes all selected edges.
QString name()
Return a name for the plugin.
Update type class.
Definition: UpdateType.hh:59
QString description()
Return a description of what the plugin is doing.
void slotSnapBoundary()
Button slot.
void slotDetectFlatValence3Vertices()
Button slot.
void slotUpdateVertexNormals()
Button slot.
void flipOrientation(int _objectId)
Flips the normals of all selected faces by changing the vertex order.
void fixNonManifoldVertices(int _objectId)
remove non-manifold vertices by duplicating them
void updateHalfedgeNormals(int _objectId)
Recomputes the halfedge normals of an object.
Definition: NormalFixing.cc:82
void slotDetectEdgesLonger()
Button Slot.
void snapBoundary(int _objectId, double _eps)
Snaps selected vertices at boundaries.
void slotDetectFoldover()
Button slot.
Interface for all Plugins which provide scriptable Functions.
void detectFlatValence3Vertices(int _objectId, double _angle)
Detect valence 3 vertices with faces that lie in the plane of their adjacent triangles.
void detectFoldover(int _objectId, float _angle)
Detect folded-over configurations by the dihedral angle.
void slotUpdateNormals()
Button slot.
void detectTriangleAspect(int _objectId, float _aspect)
Detect triangles with aspect ratio greater than _aspect and select them.
void removeSelectedVal3Vertices(int _objectId)
Remove all selected valence 3 vertices.
void updateFaceNormals(int _objectId)
Recomputes the face normals of an object.
Definition: NormalFixing.cc:53
Interface class from which all plugins have to be created.
Interface class for backup handling.
void slotFixNonManifoldVertices()
Button slot.
void slotRemoveSelectedVal3Vertices()
Button slot.
void slotFixMesh()
Button slot.