From dbfcede1652641f27700237199bb3bdb457aca53 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Wed, 17 Dec 2008 06:35:24 +0000 Subject: [PATCH] Small refactoring and corrected filter class --- .../filter_morph/filter_morph.cpp | 17 ++++++----------- .../filter_morph/filter_morph_tools.cpp | 6 ------ .../filter_morph/filter_morph_tools.h | 9 --------- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/meshlabplugins/filter_morph/filter_morph.cpp b/src/meshlabplugins/filter_morph/filter_morph.cpp index 158e2779c..b8c497f44 100644 --- a/src/meshlabplugins/filter_morph/filter_morph.cpp +++ b/src/meshlabplugins/filter_morph/filter_morph.cpp @@ -35,7 +35,7 @@ const QString FilterMorph::filterName(FilterIDType filter) { switch(filter) { - case FP_LINEAR_MORPH : return QString("Morph Mesh"); + case FP_LINEAR_MORPH : return QString("Linear Morphing Between two Meshes"); default: assert(0); } return QString("error!"); @@ -58,7 +58,7 @@ const FilterMorph::FilterClass FilterMorph::getClass(QAction *a) { case FP_LINEAR_MORPH : default : - return MeshFilterInterface::Generic; + return MeshFilterInterface::Smoothing; } } @@ -107,15 +107,10 @@ bool FilterMorph::applyFilter(QAction *filter, MeshModel &mm, FilterParameterSet return false; } - //compact the vectors if they dont match up - if(mm.cm.vn != mm.cm.vert.size() ) - vcg::tri::Allocator::CompactVertexVector(mm.cm); - if(mm.cm.fn != mm.cm.face.size() ) - vcg::tri::Allocator::CompactFaceVector(mm.cm); - if(targetModel->cm.vn != targetModel->cm.vert.size() ) - vcg::tri::Allocator::CompactVertexVector(targetModel->cm); - if(targetModel->cm.fn != targetModel->cm.face.size() ) - vcg::tri::Allocator::CompactFaceVector(targetModel->cm); + vcg::tri::Allocator::CompactVertexVector(mm.cm); + vcg::tri::Allocator::CompactFaceVector(mm.cm); + vcg::tri::Allocator::CompactVertexVector(targetModel->cm); + vcg::tri::Allocator::CompactFaceVector(targetModel->cm); float percentage = par.getDynamicFloat(PercentMorph); diff --git a/src/meshlabplugins/filter_morph/filter_morph_tools.cpp b/src/meshlabplugins/filter_morph/filter_morph_tools.cpp index cae327773..db921c589 100644 --- a/src/meshlabplugins/filter_morph/filter_morph_tools.cpp +++ b/src/meshlabplugins/filter_morph/filter_morph_tools.cpp @@ -11,12 +11,6 @@ using namespace vcg; - -MorphTools::MorphTools(QWidget *parent) -{ - parentWidget = parent; -} - void MorphTools::calculateMorph(float percentage, MeshModel *sourceMeshModel, MeshModel *destMeshModel) { //if two models are not selected return diff --git a/src/meshlabplugins/filter_morph/filter_morph_tools.h b/src/meshlabplugins/filter_morph/filter_morph_tools.h index 3e3ddc160..3e2161d42 100644 --- a/src/meshlabplugins/filter_morph/filter_morph_tools.h +++ b/src/meshlabplugins/filter_morph/filter_morph_tools.h @@ -17,20 +17,11 @@ class MorphTools : public QObject Q_OBJECT public: - - //constructor... parent widget is used to open dialogs to the user - MorphTools(QWidget *parent=0); - //calculate the morph //float percentage - how much the source should look like the target void calculateMorph(float percentage, MeshModel *sourceMeshModel, MeshModel *destMeshModel); private: - //incase we need to dispay any widgets - QWidget *parentWidget; - - inline float Abs(float x ) { return x > 0. ? x : -x; } - //given a start and end inline float calcNewPoint(float start, float end, float distanceRatio){ return start + (end-start)*distanceRatio;