mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 03:16:10 +00:00
Small refactoring and corrected filter class
This commit is contained in:
parent
a545b5d82b
commit
dbfcede165
@ -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<CMeshO>::CompactVertexVector(mm.cm);
|
||||
if(mm.cm.fn != mm.cm.face.size() )
|
||||
vcg::tri::Allocator<CMeshO>::CompactFaceVector(mm.cm);
|
||||
if(targetModel->cm.vn != targetModel->cm.vert.size() )
|
||||
vcg::tri::Allocator<CMeshO>::CompactVertexVector(targetModel->cm);
|
||||
if(targetModel->cm.fn != targetModel->cm.face.size() )
|
||||
vcg::tri::Allocator<CMeshO>::CompactFaceVector(targetModel->cm);
|
||||
vcg::tri::Allocator<CMeshO>::CompactVertexVector(mm.cm);
|
||||
vcg::tri::Allocator<CMeshO>::CompactFaceVector(mm.cm);
|
||||
vcg::tri::Allocator<CMeshO>::CompactVertexVector(targetModel->cm);
|
||||
vcg::tri::Allocator<CMeshO>::CompactFaceVector(targetModel->cm);
|
||||
|
||||
float percentage = par.getDynamicFloat(PercentMorph);
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user