45 #include "MeanCurvature.hh" 57 MeanCurvaturePlugin::MeanCurvaturePlugin()
62 MeanCurvaturePlugin::~MeanCurvaturePlugin()
67 void MeanCurvaturePlugin::pluginsInitialized()
69 emit addTexture(
"Mean Curvature" ,
"mean_curvature.png" , 1 );
70 emit setTextureMode(
"Mean Curvature",
"clamp=true,center=true,repeat=false,clamp_min=-20,clamp_max=20");
72 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\""),
73 QStringList(tr(
"ObjectId")), QStringList(tr(
"Id of the mesh")));
76 void MeanCurvaturePlugin::slotUpdateTexture( QString _textureName ,
int _identifier )
78 if ( _textureName !=
"Mean Curvature") {
97 emit updatedTextures(
"Mean Curvature",_identifier);
121 template<
typename MeshT >
126 if(!_mesh->get_property_handle( mean,
"Mean Curvature"))
127 _mesh->add_property( mean,
"Mean Curvature" );
131 std::vector< typename MeshT::VertexHandle > handles;
132 handles.reserve(_mesh->n_vertices());
133 for (
typename MeshT::VertexIter v_it = _mesh->vertices_begin() ; v_it != _mesh->vertices_end(); ++v_it)
134 handles.push_back( *v_it );
137 #pragma omp parallel for 139 for (
int i = 0 ; i < (int)handles.size(); ++i ) {
141 const typename MeshT::VertexHandle handle = handles[i];
144 curvature::discrete_mean_curv_op<MeshT,ACG::Vec3d,double>(*_mesh,handle,curva,area);
145 double curv = curva.norm();
147 if ( (curva | _mesh->normal(handle)) <0 )
150 _mesh->property(mean,handle) = curv;
#define DATA_TRIANGLE_MESH
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
Functions for calculating curvatures.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
bool dataType(DataType _type) const
bool computeMeanCurvature(int _objectId)
Scripting slot to trigger computation of mean curvature.