44 #include "GaussCurvature.hh" 58 GaussCurvaturePlugin::GaussCurvaturePlugin()
63 GaussCurvaturePlugin::~GaussCurvaturePlugin()
69 void GaussCurvaturePlugin::pluginsInitialized()
71 emit addTexture(
"Gaussian Curvature" ,
"gauss_curvature.png" , 1 );
72 emit setTextureMode(
"Gaussian Curvature",
"clamp=true,clamp_min=-1,clamp_max=1,center=true");
74 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\""),
75 QStringList(tr(
"ObjectId")), QStringList(tr(
"Id of the mesh")));
78 void GaussCurvaturePlugin::slotUpdateTexture( QString _textureName ,
int _identifier )
80 if ( _textureName !=
"Gaussian Curvature")
90 computeGaussianCurvature(mesh);
95 computeGaussianCurvature(mesh);
98 emit updatedTextures(
"Gaussian Curvature",_identifier);
110 computeGaussianCurvature(mesh);
116 computeGaussianCurvature(mesh);
124 template<
typename MeshT >
125 void GaussCurvaturePlugin::computeGaussianCurvature( MeshT* _mesh) {
128 if(!_mesh->get_property_handle( gauss,
"Gaussian Curvature"))
129 _mesh->add_property( gauss,
"Gaussian Curvature" );
132 std::vector< typename MeshT::VertexHandle > handles;
133 handles.reserve(_mesh->n_vertices());
134 for (
typename MeshT::VertexIter v_it = _mesh->vertices_begin() ; v_it != _mesh->vertices_end(); ++v_it)
135 handles.push_back( *v_it );
138 #pragma omp parallel for 139 for (
int i = 0 ; i < (int)handles.size(); ++i )
140 _mesh->property(gauss,handles[i]) = curvature::gauss_curvature(*_mesh,handles[i]);
143 for (
typename MeshT::VertexIter v_it = _mesh->vertices_begin() ; v_it != _mesh->vertices_end(); ++v_it)
144 _mesh->property(gauss,*v_it) = curvature::gauss_curvature(*_mesh,*v_it);
bool dataType(DataType _type) const
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
Functions for calculating curvatures.
bool computeGaussCurvature(int _objectId)
Scripting slot to trigger computation of gaussian curvature.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
#define DATA_TRIANGLE_MESH