Commit 883091c8 authored by Jan Möbius's avatar Jan Möbius

Use shared pointers in smoother

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9702 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f1eb26c9
......@@ -44,10 +44,10 @@
SmootherObject::SmootherObject(TriMesh* _mesh){
smoother = new OpenMesh::Smoother::JacobiLaplaceSmootherT< TriMesh >( *_mesh );
smoother_ = std::tr1::shared_ptr< SmootherType >( new SmootherType( *_mesh ) );
}
SmootherObject::~SmootherObject(){
delete smoother;
}
......@@ -46,12 +46,23 @@
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#ifndef WIN32
#include <tr1/memory>
#endif
class SmootherObject : public PerObjectData
{
public:
typedef OpenMesh::Smoother::JacobiLaplaceSmootherT< TriMesh > SmootherType;
SmootherObject(TriMesh* _mesh);
~SmootherObject();
OpenMesh::Smoother::JacobiLaplaceSmootherT< TriMesh >* smoother;
SmootherType* smoother() { return smoother_.get(); };
private:
std::tr1::shared_ptr< SmootherType > smoother_;
};
......@@ -166,17 +166,17 @@ slot_smooth()
double absoluteError = value.toDouble(&ok);
if ( ok )
data->smoother->set_absolute_local_error( absoluteError );
data->smoother()->set_absolute_local_error( absoluteError );
else
emit log(LOGWARN , "Unable to read distance error from LineEdit");
jobDescription += ",max_error: " + QString::number(absoluteError);
}
data->smoother->initialize(component,continuity );
data->smoother->skip_features(tool_->respectFeatures->isChecked());
data->smoother()->initialize(component,continuity );
data->smoother()->skip_features(tool_->respectFeatures->isChecked());
data->smoother->smooth( tool_->sB_iter->value() );
data->smoother()->smooth( tool_->sB_iter->value() );
jobDescription += ") " + QString::number(tool_->sB_iter->value()) + " iterations";
......@@ -263,14 +263,14 @@ void SmootherPlugin::smooth(int _objectId , int _iterations , QString _direction
}
if ( _maxDistance > 0.0) {
data->smoother->set_absolute_local_error( _maxDistance );
data->smoother()->set_absolute_local_error( _maxDistance );
jobDescription += ",max_error: " + QString::number(_maxDistance);
} else
data->smoother->set_absolute_local_error( FLT_MAX );
data->smoother()->set_absolute_local_error( FLT_MAX );
data->smoother->initialize(component,continuity);
data->smoother()->initialize(component,continuity);
data->smoother->smooth( _iterations );
data->smoother()->smooth( _iterations );
TriMesh* mesh = PluginFunctions::triMesh(object);
jobDescription += ") " + QString::number(_iterations) + " iterations";
......
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