50 #include "GaussCurvature.hh" 54 #if QT_VERSION >= 0x050000 68 GaussCurvaturePlugin::GaussCurvaturePlugin()
73 GaussCurvaturePlugin::~GaussCurvaturePlugin()
79 void GaussCurvaturePlugin::pluginsInitialized()
81 emit addTexture(
"Gaussian Curvature" ,
"gauss_curvature.png" , 1 );
82 emit setTextureMode(
"Gaussian Curvature",
"clamp=true,clamp_min=-1,clamp_max=1,center=true");
84 emit setSlotDescription(tr(
"computeGaussCurvature(int)"), tr(
"Compute the gaussian curvature on a mesh. The curvature will be stored on the mesh on the vertex property called \"Gaussian Curvature\""),
85 QStringList(tr(
"ObjectId")), QStringList(tr(
"Id of the mesh")));
88 void GaussCurvaturePlugin::slotUpdateTexture( QString _textureName ,
int _identifier )
90 if ( _textureName !=
"Gaussian Curvature")
100 computeGaussianCurvature(mesh);
105 computeGaussianCurvature(mesh);
108 emit updatedTextures(
"Gaussian Curvature",_identifier);
120 computeGaussianCurvature(mesh);
126 computeGaussianCurvature(mesh);
134 template<
typename MeshT >
135 void GaussCurvaturePlugin::computeGaussianCurvature( MeshT* _mesh) {
138 if(!_mesh->get_property_handle( gauss,
"Gaussian Curvature"))
139 _mesh->add_property( gauss,
"Gaussian Curvature" );
142 std::vector< typename MeshT::VertexHandle > handles;
143 handles.reserve(_mesh->n_vertices());
144 for (
typename MeshT::VertexIter v_it = _mesh->vertices_begin() ; v_it != _mesh->vertices_end(); ++v_it)
145 handles.push_back( *v_it );
148 #pragma omp parallel for 149 for (
int i = 0 ; i < (int)handles.size(); ++i )
150 _mesh->property(gauss,handles[i]) = curvature::gauss_curvature(*_mesh,handles[i]);
153 for (
typename MeshT::VertexIter v_it = _mesh->vertices_begin() ; v_it != _mesh->vertices_end(); ++v_it)
154 _mesh->property(gauss,*v_it) = curvature::gauss_curvature(*_mesh,*v_it);
159 #if QT_VERSION < 0x050000
bool getObject(int _identifier, BSplineCurveObject *&_object)
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
bool dataType(DataType _type) const
Functions for calculating curvatures.
bool computeGaussCurvature(int _objectId)
Scripting slot to trigger computation of gaussian curvature.
#define DATA_TRIANGLE_MESH
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.