Skip to content
Snippets Groups Projects
Commit c075e66e authored by Jan Möbius's avatar Jan Möbius
Browse files

Merge branch 'Plugin-Laplace-updated' into 'master'

new iterators and circulators

See merge request !1
parents 7ee4af85 d4aedefd
No related branches found
No related tags found
1 merge request!1new iterators and circulators
...@@ -116,22 +116,22 @@ void LaplaceLengthPlugin::computeLaplaceLength(MeshT* _mesh) { ...@@ -116,22 +116,22 @@ void LaplaceLengthPlugin::computeLaplaceLength(MeshT* _mesh) {
QElapsedTimer time; QElapsedTimer time;
time.start(); time.start();
std::vector< typename MeshT::VertexHandle > handles; std::vector< typename OpenMesh::SmartVertexHandle > handles;
handles.reserve(_mesh->n_vertices()); handles.reserve(_mesh->n_vertices());
for ( typename MeshT::VertexIter v_it = _mesh->vertices_begin() ; v_it != _mesh->vertices_end(); ++v_it) for ( auto v_it : _mesh->vertices())
handles.push_back( *v_it ); handles.push_back( v_it );
#ifdef USE_OPENMP #ifdef USE_OPENMP
#pragma omp parallel for #pragma omp parallel for
#endif #endif
for ( int i = 0 ; i < (int)handles.size(); ++i ) { for ( int i = 0 ; i < (int)handles.size(); ++i ) {
const typename MeshT::VertexHandle handle = handles[i]; const typename OpenMesh::SmartVertexHandle handle = handles[i];
ACG::Vec3d laplace(0.0,0.0,0.0); ACG::Vec3d laplace(0.0,0.0,0.0);
for ( typename MeshT::VertexVertexIter vv_it(*_mesh , handle) ; vv_it.is_valid() ; ++vv_it ) for ( auto vv_it : handle.vertices() )
laplace += _mesh->point(*vv_it) - _mesh->point(handle); laplace += _mesh->point(vv_it) - _mesh->point(handle);
laplace = 1.0 /(double)_mesh->valence(handle) * laplace; laplace = 1.0 /(double)handle.valence()* laplace;
_mesh->property(laplace_vector_property,handle) = laplace; _mesh->property(laplace_vector_property,handle) = laplace;
_mesh->property(laplace_length_property,handle) = laplace.norm(); _mesh->property(laplace_length_property,handle) = laplace.norm();
} }
...@@ -161,21 +161,21 @@ void LaplaceLengthPlugin::computeLaplaceSquaredLength(MeshT* _mesh) { ...@@ -161,21 +161,21 @@ void LaplaceLengthPlugin::computeLaplaceSquaredLength(MeshT* _mesh) {
QElapsedTimer time; QElapsedTimer time;
time.start(); time.start();
std::vector< typename MeshT::VertexHandle > handles; std::vector< typename OpenMesh::SmartVertexHandle > handles;
handles.reserve(_mesh->n_vertices()); handles.reserve(_mesh->n_vertices());
for ( typename MeshT::VertexIter v_it = _mesh->vertices_begin() ; v_it != _mesh->vertices_end(); ++v_it) for ( auto v_it : _mesh->vertices())
handles.push_back( *v_it ); handles.push_back( v_it );
#ifdef USE_OPENMP #ifdef USE_OPENMP
#pragma omp parallel for #pragma omp parallel for
#endif #endif
for ( int i = 0 ; i < (int)handles.size(); ++i ) { for ( int i = 0 ; i < (int)handles.size(); ++i ) {
const typename MeshT::VertexHandle handle = handles[i]; const typename OpenMesh::SmartVertexHandle handle = handles[i];
ACG::Vec3d laplace(0.0,0.0,0.0); ACG::Vec3d laplace(0.0,0.0,0.0);
for ( typename MeshT::VertexVertexIter vv_it(*_mesh , handle) ; vv_it.is_valid() ; ++vv_it ) for ( auto vv_it : handle.vertices() )
laplace += _mesh->property(laplace_property,*vv_it) - _mesh->property(laplace_property,handle); laplace += _mesh->property(laplace_property,vv_it) - _mesh->property(laplace_property,handle);
laplace = 1.0 /(double)_mesh->valence(handle) * laplace; laplace = 1.0 /(double)handle.valence() * laplace;
_mesh->property(laplace_squared,handle) = laplace.norm(); _mesh->property(laplace_squared,handle) = laplace.norm();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment