Commit 9731da64 authored by David Bommes's avatar David Bommes

added computation of halfedge-normals

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13455 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b186efe5
......@@ -635,6 +635,13 @@ There is no automatic algorithm to fix these foldovers here. So you will have to
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="computeHalfedgeNormals">
<property name="text">
<string>Halfedge</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="computeFaceNormals">
<property name="toolTip">
......
......@@ -92,6 +92,7 @@ initializePlugin()
connect(tool_->computeNormals,SIGNAL(clicked()),this,SLOT(slotUpdateNormals()));
connect(tool_->computeVertexNormals,SIGNAL(clicked()),this,SLOT(slotUpdateVertexNormals()));
connect(tool_->computeFaceNormals,SIGNAL(clicked()),this,SLOT(slotUpdateFaceNormals()));
connect(tool_->computeHalfedgeNormals,SIGNAL(clicked()),this,SLOT(slotUpdateHalfedgeNormals()));
toolIcon_ = new QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"meshrepair-toolbox.png");
tool_->repairCollapseEButton->setIcon(*toolIcon_);
......@@ -194,6 +195,15 @@ void MeshRepairPlugin::slotUpdateFaceNormals() {
//-----------------------------------------------------------------------------
void MeshRepairPlugin::slotUpdateHalfedgeNormals() {
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
updateHalfedgeNormals(o_it->id());
emit updateView();
}
//-----------------------------------------------------------------------------
void MeshRepairPlugin::slotUpdateNormals(){
for ( PluginFunctions::ObjectIterator o_it(PluginFunctions::TARGET_OBJECTS,DataType( DATA_TRIANGLE_MESH | DATA_POLY_MESH ) ); o_it != PluginFunctions::objectsEnd(); ++o_it)
updateNormals(o_it->id());
......@@ -246,6 +256,10 @@ void MeshRepairPlugin::pluginsInitialized() {
QStringList(tr("objectId")),
QStringList(tr("ID of an object")));
emit setSlotDescription("updateHalfedgeNormals(int)",tr("Recompute Halfedge normals"),
QStringList(tr("objectId")),
QStringList(tr("ID of an object")));
emit setSlotDescription("updateVertexNormals(int)",tr("Recompute Vertex normals"),
QStringList(tr("objectId")),
QStringList(tr("ID of an object")));
......@@ -554,6 +568,37 @@ void MeshRepairPlugin::updateFaceNormals(int _objectId) {
}
//-----------------------------------------------------------------------------
void MeshRepairPlugin::updateHalfedgeNormals(int _objectId) {
BaseObjectData* object = 0;
PluginFunctions::getObject(_objectId,object);
if ( object == 0) {
emit log(LOGERR,tr("updateFaceNormals: Unable to get object %1. ").arg(_objectId) );
}
if ( object->dataType(DATA_TRIANGLE_MESH) ) {
TriMesh* mesh = PluginFunctions::triMesh(object);
mesh->request_halfedge_normals();
mesh->update_halfedge_normals();
emit updatedObject(_objectId, UPDATE_ALL);
emit createBackup( _objectId, "Updated Face Normals", UPDATE_ALL);
emit scriptInfo( "updateFaceNormals(" + QString::number(_objectId) + ")" );
} else if ( object->dataType(DATA_POLY_MESH) ) {
PolyMesh* mesh = PluginFunctions::polyMesh(object);
mesh->request_halfedge_normals();
mesh->update_halfedge_normals();
emit updatedObject(_objectId, UPDATE_ALL);
emit createBackup( _objectId, "Updated Face Normals", UPDATE_ALL);
emit scriptInfo( "updateFaceNormals(" + QString::number(_objectId) + ")" );
} else
emit log(LOGERR,tr("updateFaceNormals: MeshRepair only works on triangle and poly meshes!") );
}
//-----------------------------------------------------------------------------
......
......@@ -147,6 +147,9 @@ private slots:
/// Button slot
void slotUpdateFaceNormals();
/// Button slot
void slotUpdateHalfedgeNormals();
/// Button slot
void slotUpdateNormals();
......@@ -180,6 +183,9 @@ public slots:
/// Recomputes the face normals of an object
void updateFaceNormals(int _objectId);
/// Recomputes the halfedge normals of an object
void updateHalfedgeNormals(int _objectId);
/// Recomputes the vertex normals of an object
void updateVertexNormals(int _objectId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment