51 #include "MeshRepairPlugin.hh"
53 #if QT_VERSION >= 0x050000
60 MeshRepairPlugin::MeshRepairPlugin() :
80 connect(tool_->valenceThreeButton, SIGNAL(clicked()),
this, SLOT(slotDetectFlatValence3Vertices()) );
81 connect(tool_->repairRemoveVButton, SIGNAL(clicked()),
this, SLOT(slotRemoveSelectedVal3Vertices()) );
87 connect(tool_->detectEShorterButton, SIGNAL(clicked()),
this, SLOT(slotDetectEdgesShorter()) );
88 connect(tool_->detectELargerButton, SIGNAL(clicked()),
this, SLOT(slotDetectEdgesLonger()) );
89 connect(tool_->repairCollapseEButton, SIGNAL(clicked()),
this, SLOT(slotRemoveSelectedEdges()) );
90 connect(tool_->detectCapAngle, SIGNAL(clicked()),
this, SLOT(slotDetectSkinnyTriangleByAngle()) );
91 connect(tool_->repairFlipEButton, SIGNAL(clicked()),
this, SLOT(slotRemoveSkinnyTriangleByAngle()) );
92 connect(tool_->detectFoldoverButton, SIGNAL(clicked()),
this, SLOT(slotDetectFoldover()) );
97 connect(tool_->triangleAspectButton,SIGNAL(clicked()),
this,SLOT(slotDetectTriangleAspect()));
98 connect(tool_->flipOrientation,SIGNAL(clicked()),
this,SLOT(slotFlipOrientation()));
103 connect(tool_->computeNormals,SIGNAL(clicked()),
this,SLOT(slotUpdateNormals()));
104 connect(tool_->computeVertexNormals,SIGNAL(clicked()),
this,SLOT(slotUpdateVertexNormals()));
105 connect(tool_->computeFaceNormals,SIGNAL(clicked()),
this,SLOT(slotUpdateFaceNormals()));
106 connect(tool_->computeHalfedgeNormals,SIGNAL(clicked()),
this,SLOT(slotUpdateHalfedgeNormals()));
111 connect(tool_->snapBoundaryButton, SIGNAL(clicked()),
this, SLOT(slotSnapBoundary()) );
112 connect(tool_->fixNonManifoldVerticesButton,SIGNAL(clicked()),
this,SLOT(slotFixNonManifoldVertices()));
113 connect(tool_->fixMeshButton,SIGNAL(clicked()),
this,SLOT(slotFixMesh()));
116 toolIcon_ =
new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"meshrepair-toolbox.png");
117 tool_->repairCollapseEButton->setIcon(*toolIcon_);
118 tool_->repairFlipEButton->setIcon(*toolIcon_);
119 tool_->repairRemoveVButton->setIcon(*toolIcon_);
121 emit addToolbox( tr(
"Mesh Repair") , tool_, toolIcon_);
131 removeSelectedVal3Vertices(o_it->id());
141 removeSelectedEdges(o_it->id());
151 detectSkinnyTriangleByAngle( o_it->id(), tool_->capAngleSpinbox->value(), false );
162 detectSkinnyTriangleByAngle( o_it->id(), tool_->capAngleSpinbox->value(), true );
172 detectFoldover(o_it->id(), tool_->detectFoldoverSpinbox->value());
182 detectTriangleAspect(o_it->id(), tool_->triangleAspectSpinbox->value());
192 flipOrientation(o_it->id());
203 fixMesh(o_it->id() , tool_->fixMeshBox->value() );
213 updateVertexNormals(o_it->id());
222 updateFaceNormals(o_it->id());
231 updateHalfedgeNormals(o_it->id());
240 updateNormals(o_it->id());
248 double length = tool_->edgeSpin->value();
251 selectEdgesShorterThan(o_it->id(),length);
259 double length = tool_->edgeSpin->value();
262 selectEdgesLongerThan(o_it->id(),length);
270 double angle = tool_->valenceThreeSpinbox->value();
273 detectFlatValence3Vertices(o_it->id(), angle);
282 double eps = tool_->snapBoundarySpinBox->value();
284 snapBoundary(o_it->id(), eps);
293 fixNonManifoldVertices(o_it->id());
309 emit setSlotDescription(
"removeSelectedVal3Vertices(int)",tr(
"Remove all selected valence 3 vertices"),
310 QStringList(tr(
"objectId")),
311 QStringList(tr(
"ID of an object")));
313 emit setSlotDescription(
"detectFlatValence3Vertices(int,double)",tr(
"Selects all vertices that have valence 3 and the normals of their neighboring faces have an angle less then the given angle"),
314 QString(tr(
"objectId,angle")).split(
","),
315 QString(tr(
"ID of an object;the maximal angle between the adjacent faces")).split(
";"));
321 emit setSlotDescription(
"selectEdgesShorterThan(int,double)",tr(
"Selects all edges of an object which are shorter than the given length"),
322 QString(tr(
"objectId,length")).split(
","),
323 QString(tr(
"ID of an object;All edges shorter than this length will be selected")).split(
";"));
325 emit setSlotDescription(
"selectEdgesLongerThan(int,double)",tr(
"Selects all edges of an object which are longer than the given length"),
326 QString(tr(
"objectId,length")).split(
","),
327 QString(tr(
"ID of an object;All edges longer than this length will be selected")).split(
";"));
329 emit setSlotDescription(
"removeSelectedEdges(int)",tr(
"Remove the selected edges"),
330 QStringList(tr(
"objectId")),
331 QStringList(tr(
"ID of an object")));
333 emit setSlotDescription(
"detectSkinnyTriangleByAngle(int,double,bool)",tr(
"Select or remove skinny triangles (determined by a minimum angle threshold)."),
334 QString(tr(
"objectId,angle,remove")).split(
","),
335 QString(tr(
"ID of an object;Minimum angle threshold;Remove")).split(
";"));
337 emit setSlotDescription(
"detectFoldover(int,float)",tr(
"Selects edges that are incident to folded over faces."),
338 QString(tr(
"objectId,angle")).split(
","),
339 QString(tr(
"ID of an object;Minimum threshold angle for fold-overs")).split(
";"));
345 emit setSlotDescription(
"detectTriangleAspect(int,float)",tr(
"Selects all faces that have a larger aspect ratio than the given one."),
346 QString(tr(
"objectId,aspect")).split(
","),
347 QString(tr(
"ID of an object;The minimal aspect ratio to select")).split(
";"));
349 emit setSlotDescription(
"flipOrientation(int)",tr(
"Flips the normals of all faces by changing the vertex order in each face"),
350 QStringList(tr(
"objectId")),
351 QStringList(tr(
"ID of an object")));
358 emit setSlotDescription(
"updateFaceNormals(int)",tr(
"Recompute Face normals"),
359 QStringList(tr(
"objectId")),
360 QStringList(tr(
"ID of an object")));
362 emit setSlotDescription(
"updateHalfedgeNormals(int)",tr(
"Recompute Halfedge normals"),
363 QStringList(tr(
"objectId")),
364 QStringList(tr(
"ID of an object")));
366 emit setSlotDescription(
"updateVertexNormals(int)",tr(
"Recompute Vertex normals"),
367 QStringList(tr(
"objectId")),
368 QStringList(tr(
"ID of an object")));
370 emit setSlotDescription(
"updateNormals(int)",tr(
"Recompute Face and Vertex normals"),
371 QStringList(tr(
"objectId")),
372 QStringList(tr(
"ID of an object")));
379 emit setSlotDescription(
"snapBoundary(int,double)",tr(
"Snaps selected boundary vertices if the distance is less than the given maximal distance."),
380 QString(tr(
"objectId,epsilon")).split(
","),
381 QString(tr(
"ID of an object;Max Distance")).split(
";"));
383 emit setSlotDescription(
"(int)",tr(
"Fixes non manifold vertices."),
384 QString(tr(
"objectId")).split(
","),
385 QString(tr(
"ID of an object;Non manifold vertices are splitted.")).split(
";"));
387 emit setSlotDescription(
"fixMesh(int,double)",tr(
"Fixes a mesh."),
388 QString(tr(
"objectId,distance")).split(
","),
389 QString(tr(
"ID of an object;Vertices with distance lower than epsilon will be treated as one.")).split(
";"));
393 #if QT_VERSION < 0x050000
void slotUpdateVertexNormals()
Button slot.
void slotDetectEdgesShorter()
Button Slot.
void slotRemoveSelectedVal3Vertices()
Button slot.
void slotDetectSkinnyTriangleByAngle()
Button slot.
void slotFlipOrientation()
Button slot.
const QStringList TARGET_OBJECTS("target")
Iterable object range.
void slotUpdateFaceNormals()
Button slot.
void slotFixMesh()
Button slot.
void slotUpdateHalfedgeNormals()
Button slot.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
void slotDetectFoldover()
Button slot.
void slotFixNonManifoldVertices()
Button slot.
void slotDetectTriangleAspect()
Button slot.
void slotSnapBoundary()
Button slot.
void slotRemoveSkinnyTriangleByAngle()
Button slot.
void slotDetectEdgesLonger()
Button Slot.
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
#define DATA_TRIANGLE_MESH
void slotUpdateNormals()
Button slot.
void slotRemoveSelectedEdges()
Button slot.
void slotDetectFlatValence3Vertices()
Button slot.