Commit f50bd41d authored by Jan Möbius's avatar Jan Möbius

Scripting function to compute mean curvature



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13588 383ad7c9-94d9-4d36-a494-682f7c89f535
parent c69b05a1
......@@ -61,10 +61,23 @@
#include <omp.h>
#endif
MeanCurvaturePlugin::MeanCurvaturePlugin()
{
}
MeanCurvaturePlugin::~MeanCurvaturePlugin()
{
}
void MeanCurvaturePlugin::pluginsInitialized()
{
emit addTexture( "Mean Curvature" , "mean_curvature.png" , 1 );
emit setTextureMode("Mean Curvature","clamp=true,center=true,repeat=false,clamp_min=-20,clamp_max=20");
emit setSlotDescription(tr("computeMeanCurvature(int)"), tr("Compute the mean curvature on a mesh. The curvature will be stored on the mesh on the vertex property called \"Mean Curvature\""),
QStringList(tr("ObjectId")), QStringList(tr("Id of the mesh")));
}
void MeanCurvaturePlugin::slotUpdateTexture( QString _textureName , int _identifier )
......@@ -91,6 +104,27 @@ void MeanCurvaturePlugin::slotUpdateTexture( QString _textureName , int _identif
emit updatedTextures("Mean Curvature",_identifier);
}
bool MeanCurvaturePlugin::computeMeanCurvature(int _objectId) {
BaseObjectData* object;
if (! PluginFunctions::getObject( _objectId , object ) ) {
return false;
}
if ( object->dataType( DATA_TRIANGLE_MESH ) ) {
TriMesh* mesh = PluginFunctions::triMesh(object);
computeMeanCurvature(mesh);
return true;
}
if ( object->dataType( DATA_POLY_MESH ) ) {
PolyMesh* mesh = PluginFunctions::polyMesh(object);
computeMeanCurvature(mesh);
return true;
}
return false;
}
template< typename MeshT >
void MeanCurvaturePlugin::computeMeanCurvature(MeshT* _mesh) {
......@@ -122,12 +156,6 @@ void MeanCurvaturePlugin::computeMeanCurvature(MeshT* _mesh) {
_mesh->property(mean,handle) = curv;
}
/*
#ifdef USE_OPENMP
std::cerr << "MeanCurvature parallel took : " << time.elapsed() << std::endl;
#else
std::cerr << "MeanCurvature sequential took : " << time.elapsed() << std::endl;
#endif*/
}
......
......@@ -61,29 +61,42 @@ class MeanCurvaturePlugin : public QObject, BaseInterface, TextureInterface
signals:
// Texture Interface
void addTexture( QString _textureName , QString _filename , uint dimension );
void updatedTextures( QString , int );
void setTextureMode(QString _textureName ,QString _mode);
// Base Interface
void setSlotDescription(QString _slotName, QString _slotDescription,
QStringList _parameters, QStringList _descriptions);
private slots:
void slotUpdateTexture( QString _textureName , int _identifier );
void pluginsInitialized();
public :
public slots:
~MeanCurvaturePlugin() {};
/** \brief Scripting slot to trigger computation of mean curvature
*
* The curvature will be stored on the mesh on the vertex property called "Mean Curvature"
*/
bool computeMeanCurvature(int _objectId);
void exit(){};
public :
template< typename MeshT >
void computeMeanCurvature(MeshT* _mesh);
MeanCurvaturePlugin();
~MeanCurvaturePlugin();
QString name() { return (QString("MeanCurvature")); };
QString description( ) { return (QString("Generates Mean Curvature information")); };
public slots:
QString version() { return QString("1.0"); };
private:
template< typename MeshT >
void computeMeanCurvature(MeshT* _mesh);
};
#endif //MEANCURVATUREPLUGIN_HH
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