44#include "GaussCurvature.hh"
58GaussCurvaturePlugin::GaussCurvaturePlugin()
63GaussCurvaturePlugin::~GaussCurvaturePlugin()
69void 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")));
78void 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);
124template<
typename MeshT >
125void 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;
134 for (
auto v_it : _mesh->vertices())
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 (
auto v_it : _mesh->vertices())
144 _mesh->property(gauss,v_it) = curvature::gauss_curvature(*_mesh,v_it);
Functions for calculating curvatures.
#define DATA_TRIANGLE_MESH
bool dataType(DataType _type) const
bool computeGaussCurvature(int _objectId)
Scripting slot to trigger computation of gaussian curvature.
size_t n_vertices() const override
Get number of vertices in mesh.
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.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.