42 #include "MeshRepairPlugin.hh" 47 MeshRepairPlugin::MeshRepairPlugin() :
67 connect(tool_->valenceThreeButton, SIGNAL(clicked()),
this, SLOT(slotDetectFlatValence3Vertices()) );
68 connect(tool_->repairRemoveVButton, SIGNAL(clicked()),
this, SLOT(slotRemoveSelectedVal3Vertices()) );
74 connect(tool_->detectEShorterButton, SIGNAL(clicked()),
this, SLOT(slotDetectEdgesShorter()) );
75 connect(tool_->detectELargerButton, SIGNAL(clicked()),
this, SLOT(slotDetectEdgesLonger()) );
76 connect(tool_->repairCollapseEButton, SIGNAL(clicked()),
this, SLOT(slotRemoveSelectedEdges()) );
77 connect(tool_->detectCapAngle, SIGNAL(clicked()),
this, SLOT(slotDetectSkinnyTriangleByAngle()) );
78 connect(tool_->repairFlipEButton, SIGNAL(clicked()),
this, SLOT(slotRemoveSkinnyTriangleByAngle()) );
79 connect(tool_->detectFoldoverButton, SIGNAL(clicked()),
this, SLOT(slotDetectFoldover()) );
84 connect(tool_->triangleAspectButton,SIGNAL(clicked()),
this,SLOT(slotDetectTriangleAspect()));
85 connect(tool_->flipOrientation,SIGNAL(clicked()),
this,SLOT(slotFlipOrientation()));
90 connect(tool_->computeNormals,SIGNAL(clicked()),
this,SLOT(slotUpdateNormals()));
91 connect(tool_->computeVertexNormals,SIGNAL(clicked()),
this,SLOT(slotUpdateVertexNormals()));
92 connect(tool_->computeFaceNormals,SIGNAL(clicked()),
this,SLOT(slotUpdateFaceNormals()));
93 connect(tool_->computeHalfedgeNormals,SIGNAL(clicked()),
this,SLOT(slotUpdateHalfedgeNormals()));
98 connect(tool_->snapBoundaryButton, SIGNAL(clicked()),
this, SLOT(slotSnapBoundary()) );
99 connect(tool_->fixNonManifoldVerticesButton,SIGNAL(clicked()),
this,SLOT(slotFixNonManifoldVertices()));
100 connect(tool_->fixMeshButton,SIGNAL(clicked()),
this,SLOT(slotFixMesh()));
103 toolIcon_ =
new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+
"meshrepair-toolbox.png");
104 tool_->repairCollapseEButton->setIcon(*toolIcon_);
105 tool_->repairFlipEButton->setIcon(*toolIcon_);
106 tool_->repairRemoveVButton->setIcon(*toolIcon_);
108 emit addToolbox( tr(
"Mesh Repair") , tool_, toolIcon_);
118 removeSelectedVal3Vertices(o_it->id());
128 removeSelectedEdges(o_it->id());
138 detectSkinnyTriangleByAngle( o_it->id(), tool_->capAngleSpinbox->value(), false );
149 detectSkinnyTriangleByAngle( o_it->id(), tool_->capAngleSpinbox->value(), true );
159 detectFoldover(o_it->id(), tool_->detectFoldoverSpinbox->value());
169 detectTriangleAspect(o_it->id(), tool_->triangleAspectSpinbox->value());
179 flipOrientation(o_it->id());
190 fixMesh(o_it->id() , tool_->fixMeshBox->value() );
200 updateVertexNormals(o_it->id());
209 updateFaceNormals(o_it->id());
218 updateHalfedgeNormals(o_it->id());
227 updateNormals(o_it->id());
235 double length = tool_->edgeSpin->value();
238 selectEdgesShorterThan(o_it->id(),length);
246 double length = tool_->edgeSpin->value();
249 selectEdgesLongerThan(o_it->id(),length);
257 double angle = tool_->valenceThreeSpinbox->value();
260 detectFlatValence3Vertices(o_it->id(), angle);
269 double eps = tool_->snapBoundarySpinBox->value();
271 snapBoundary(o_it->id(), eps);
280 fixNonManifoldVertices(o_it->id());
296 emit setSlotDescription(
"removeSelectedVal3Vertices(int)",tr(
"Remove all selected valence 3 vertices"),
297 QStringList(tr(
"objectId")),
298 QStringList(tr(
"ID of an object")));
300 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"),
301 QString(tr(
"objectId,angle")).split(
","),
302 QString(tr(
"ID of an object;the maximal angle between the adjacent faces")).split(
";"));
308 emit setSlotDescription(
"selectEdgesShorterThan(int,double)",tr(
"Selects all edges of an object which are shorter than the given length"),
309 QString(tr(
"objectId,length")).split(
","),
310 QString(tr(
"ID of an object;All edges shorter than this length will be selected")).split(
";"));
312 emit setSlotDescription(
"selectEdgesLongerThan(int,double)",tr(
"Selects all edges of an object which are longer than the given length"),
313 QString(tr(
"objectId,length")).split(
","),
314 QString(tr(
"ID of an object;All edges longer than this length will be selected")).split(
";"));
316 emit setSlotDescription(
"removeSelectedEdges(int)",tr(
"Remove the selected edges"),
317 QStringList(tr(
"objectId")),
318 QStringList(tr(
"ID of an object")));
320 emit setSlotDescription(
"detectSkinnyTriangleByAngle(int,double,bool)",tr(
"Select or remove skinny triangles (determined by a minimum angle threshold)."),
321 QString(tr(
"objectId,angle,remove")).split(
","),
322 QString(tr(
"ID of an object;Minimum angle threshold;Remove")).split(
";"));
324 emit setSlotDescription(
"detectFoldover(int,float)",tr(
"Selects edges that are incident to folded over faces."),
325 QString(tr(
"objectId,angle")).split(
","),
326 QString(tr(
"ID of an object;Minimum threshold angle for fold-overs")).split(
";"));
332 emit setSlotDescription(
"detectTriangleAspect(int,float)",tr(
"Selects all faces that have a larger aspect ratio than the given one."),
333 QString(tr(
"objectId,aspect")).split(
","),
334 QString(tr(
"ID of an object;The minimal aspect ratio to select")).split(
";"));
336 emit setSlotDescription(
"flipOrientation(int)",tr(
"Flips the normals of all faces by changing the vertex order in each face"),
337 QStringList(tr(
"objectId")),
338 QStringList(tr(
"ID of an object")));
345 emit setSlotDescription(
"updateFaceNormals(int)",tr(
"Recompute Face normals"),
346 QStringList(tr(
"objectId")),
347 QStringList(tr(
"ID of an object")));
349 emit setSlotDescription(
"updateHalfedgeNormals(int)",tr(
"Recompute Halfedge normals"),
350 QStringList(tr(
"objectId")),
351 QStringList(tr(
"ID of an object")));
353 emit setSlotDescription(
"updateVertexNormals(int)",tr(
"Recompute Vertex normals"),
354 QStringList(tr(
"objectId")),
355 QStringList(tr(
"ID of an object")));
357 emit setSlotDescription(
"updateNormals(int)",tr(
"Recompute Face and Vertex normals"),
358 QStringList(tr(
"objectId")),
359 QStringList(tr(
"ID of an object")));
366 emit setSlotDescription(
"snapBoundary(int,double)",tr(
"Snaps selected boundary vertices if the distance is less than the given maximal distance."),
367 QString(tr(
"objectId,epsilon")).split(
","),
368 QString(tr(
"ID of an object;Max Distance")).split(
";"));
370 emit setSlotDescription(
"(int)",tr(
"Fixes non manifold vertices."),
371 QString(tr(
"objectId")).split(
","),
372 QString(tr(
"ID of an object;Non manifold vertices are splitted.")).split(
";"));
374 emit setSlotDescription(
"fixMesh(int,double)",tr(
"Fixes a mesh."),
375 QString(tr(
"objectId,distance")).split(
","),
376 QString(tr(
"ID of an object;Vertices with distance lower than epsilon will be treated as one.")).split(
";"));
void slotUpdateHalfedgeNormals()
Button slot.
#define DATA_TRIANGLE_MESH
void slotDetectEdgesShorter()
Button Slot.
void slotFlipOrientation()
Button slot.
void slotRemoveSelectedEdges()
Button slot.
void pluginsInitialized()
Initialization of the plugin when it is loaded by the core.
void slotRemoveSkinnyTriangleByAngle()
Button slot.
void slotUpdateFaceNormals()
Button slot.
void slotDetectTriangleAspect()
Button slot.
void slotDetectSkinnyTriangleByAngle()
Button slot.
void slotSnapBoundary()
Button slot.
const QStringList TARGET_OBJECTS("target")
Iterable object range.
void slotDetectFlatValence3Vertices()
Button slot.
ObjectRange objects(IteratorRestriction _restriction, DataType _dataType)
Iterable object range.
void slotUpdateVertexNormals()
Button slot.
void slotDetectEdgesLonger()
Button Slot.
void slotDetectFoldover()
Button slot.
void slotUpdateNormals()
Button slot.
void slotFixNonManifoldVertices()
Button slot.
void slotRemoveSelectedVal3Vertices()
Button slot.
void slotFixMesh()
Button slot.