51 #include "MeanCurvature.hh"
62 #if QT_VERSION >= 0x050000
67 MeanCurvaturePlugin::MeanCurvaturePlugin()
72 MeanCurvaturePlugin::~MeanCurvaturePlugin()
77 void MeanCurvaturePlugin::pluginsInitialized()
79 emit addTexture(
"Mean Curvature" ,
"mean_curvature.png" , 1 );
80 emit setTextureMode(
"Mean Curvature",
"clamp=true,center=true,repeat=false,clamp_min=-20,clamp_max=20");
82 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\""),
83 QStringList(tr(
"ObjectId")), QStringList(tr(
"Id of the mesh")));
86 void MeanCurvaturePlugin::slotUpdateTexture( QString _textureName ,
int _identifier )
88 if ( _textureName !=
"Mean Curvature") {
107 emit updatedTextures(
"Mean Curvature",_identifier);
131 template<
typename MeshT >
136 if(!_mesh->get_property_handle( mean,
"Mean Curvature"))
137 _mesh->add_property( mean,
"Mean Curvature" );
141 std::vector< typename MeshT::VertexHandle > handles;
142 handles.reserve(_mesh->n_vertices());
143 for (
typename MeshT::VertexIter v_it = _mesh->vertices_begin() ; v_it != _mesh->vertices_end(); ++v_it)
144 handles.push_back( *v_it );
147 #pragma omp parallel for
149 for (
int i = 0 ; i < (int)handles.size(); ++i ) {
151 const typename MeshT::VertexHandle handle = handles[i];
154 curvature::discrete_mean_curv_op<MeshT,ACG::Vec3d,double>(*_mesh,handle,curva,area);
155 double curv = curva.norm();
157 if ( (curva | _mesh->normal(handle)) <0 )
160 _mesh->property(mean,handle) = curv;
165 #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
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
bool computeMeanCurvature(int _objectId)
Scripting slot to trigger computation of mean curvature.
Functions for calculating curvatures.
#define DATA_TRIANGLE_MESH