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
76signals:
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
102private slots:
103
104 void initializePlugin();
105 void pluginsInitialized();
106
107public :
108
110
112
113 QString name() {
114 return (QString("MeshRepair"));
115 };
116 QString description( ) {
117 return (QString("Functionality to repair meshes"));
118 };
119
120private :
121
124 QIcon* toolIcon_;
125
126private slots:
127
130
133
136
139
141 void slotDetectFoldover();
142
145
147 void slotFlipOrientation();
148
150 void slotFixMesh();
151
154
157
160
162 void slotUpdateNormals();
163
166
169
172
174 void slotSnapBoundary();
175
178
179
180 //===========================================================================
183 //===========================================================================
184
185public 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
318private:
326 void selectionEdgeLength(int _objectId, double _length, bool _larger);
327
336 template<typename MeshT>
337 void flipOrientation(MeshT& _mesh);
338
339
340public 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
Logtype
Log types for Message Window.
Interface class for backup handling.
Interface class from which all plugins have to be created.
Interface for all Plugins which do logging to the logging window of the framework.
void removeSelectedEdges(int _objectId)
Removes all selected edges.
void fixMesh(int _objectId, double _epsilon)
Fix a mesh.
void slotDetectFoldover()
Button slot.
void updateNormals(int _objectId)
Recomputes the face and vertex normals of an object.
void slotUpdateFaceNormals()
Button slot.
QString description()
Return a description of what the plugin is doing.
void removeSelectedVal3Vertices(int _objectId)
Remove all selected valence 3 vertices.
void slotFlipOrientation()
Button slot.
void slotSnapBoundary()
Button slot.
void updateVertexNormals(int _objectId)
Recomputes the vertex normals of an object.
void slotFixNonManifoldVertices()
Button slot.
void updateHalfedgeNormals(int _objectId)
Recomputes the halfedge normals of an object.
Definition: NormalFixing.cc:82
void slotRemoveSelectedVal3Vertices()
Button slot.
void detectSkinnyTriangleByAngle(int _objectId, double _angle, bool _remove)
Detect/Remove edges where neighboring faces form angle > _angle degrees.
void slotFixMesh()
Button slot.
void detectFlatValence3Vertices(int _objectId, double _angle)
Detect valence 3 vertices with faces that lie in the plane of their adjacent triangles.
void fixNonManifoldVertices(int _objectId)
remove non-manifold vertices by duplicating them
void slotRemoveSelectedEdges()
Button slot.
void slotDetectEdgesLonger()
Button Slot.
void updateFaceNormals(int _objectId)
Recomputes the face normals of an object.
Definition: NormalFixing.cc:53
void slotDetectFlatValence3Vertices()
Button slot.
void flipOrientation(int _objectId)
Flips the normals of all selected faces by changing the vertex order.
void slotUpdateVertexNormals()
Button slot.
MeshRepairToolbarWidget * tool_
Widget for Toolbox.
void selectEdgesLongerThan(int _objectId, double _length)
Selects all edges of an object which are larger than the given length.
void slotDetectTriangleAspect()
Button slot.
void slotUpdateNormals()
Button slot.
void slotRemoveSkinnyTriangleByAngle()
Button slot.
void detectFoldover(int _objectId, float _angle)
Detect folded-over configurations by the dihedral angle.
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
void snapBoundary(int _objectId, double _eps)
Snaps selected vertices at boundaries.
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
void detectTriangleAspect(int _objectId, float _aspect)
Detect triangles with aspect ratio greater than _aspect and select them.
void slotUpdateHalfedgeNormals()
Button slot.
QString name()
Return a name for the plugin.
void slotDetectEdgesShorter()
Button Slot.
void slotDetectSkinnyTriangleByAngle()
Button slot.
Interface class for exporting functions to python.
Interface to call functions across plugins.
Definition: RPCInterface.hh:61
Interface for all Plugins which provide scriptable Functions.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
Update type class.
Definition: UpdateType.hh:59
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.