Commit 21ff0a37 authored by Matthias Möller's avatar Matthias Möller
Browse files

OM3 iterators

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@17215 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f5cc5c79
...@@ -146,15 +146,15 @@ void SmootherPlugin::simpleLaplace(int _iterations) { ...@@ -146,15 +146,15 @@ void SmootherPlugin::simpleLaplace(int _iterations) {
// Copy original positions to backup ( in Vertex property ) // Copy original positions to backup ( in Vertex property )
TriMesh::VertexIter v_it, v_end=mesh->vertices_end(); TriMesh::VertexIter v_it, v_end=mesh->vertices_end();
for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it) { for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it) {
mesh->property( origPositions, v_it ) = mesh->point(v_it); mesh->property( origPositions, *v_it ) = mesh->point(*v_it);
// See if at least one vertex has been selected // See if at least one vertex has been selected
selectionExists |= mesh->status(v_it).selected(); selectionExists |= mesh->status(*v_it).selected();
} }
// Do one smoothing step (For each point of the mesh ... ) // Do one smoothing step (For each point of the mesh ... )
for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it) { for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it) {
if(selectionExists && mesh->status(v_it).selected() == false) { if(selectionExists && mesh->status(*v_it).selected() == false) {
continue; continue;
} }
...@@ -164,14 +164,14 @@ void SmootherPlugin::simpleLaplace(int _iterations) { ...@@ -164,14 +164,14 @@ void SmootherPlugin::simpleLaplace(int _iterations) {
bool skip = false; bool skip = false;
// ( .. for each Outoing halfedge .. ) // ( .. for each Outoing halfedge .. )
TriMesh::VertexOHalfedgeIter voh_it(*mesh,v_it); TriMesh::VertexOHalfedgeIter voh_it(*mesh,*v_it);
for ( ; voh_it; ++voh_it ) { for ( ; voh_it.is_valid(); ++voh_it ) {
// .. add the (original) position of the Neighbour ( end of the outgoing halfedge ) // .. add the (original) position of the Neighbour ( end of the outgoing halfedge )
point += mesh->property( origPositions, mesh->to_vertex_handle(voh_it) ); point += mesh->property( origPositions, mesh->to_vertex_handle(*voh_it) );
// Check if the current Halfedge is a boundary halfedge // Check if the current Halfedge is a boundary halfedge
// If it is, abort and keep the current vertex position // If it is, abort and keep the current vertex position
if ( mesh->is_boundary( voh_it.handle() ) ) { if ( mesh->is_boundary( *voh_it ) ) {
skip = true; skip = true;
break; break;
} }
...@@ -179,11 +179,11 @@ void SmootherPlugin::simpleLaplace(int _iterations) { ...@@ -179,11 +179,11 @@ void SmootherPlugin::simpleLaplace(int _iterations) {
} }
// Devide by the valence of the current vertex // Devide by the valence of the current vertex
point /= mesh->valence( v_it ); point /= mesh->valence( *v_it );
if ( ! skip ) { if ( ! skip ) {
// Set new position for the mesh if its not on the boundary // Set new position for the mesh if its not on the boundary
mesh->point(v_it) = point; mesh->point(*v_it) = point;
} }
} }
...@@ -215,15 +215,15 @@ void SmootherPlugin::simpleLaplace(int _iterations) { ...@@ -215,15 +215,15 @@ void SmootherPlugin::simpleLaplace(int _iterations) {
// Copy original positions to backup ( in Vertex property ) // Copy original positions to backup ( in Vertex property )
PolyMesh::VertexIter v_it, v_end=mesh->vertices_end(); PolyMesh::VertexIter v_it, v_end=mesh->vertices_end();
for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it) { for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it) {
mesh->property( origPositions, v_it ) = mesh->point(v_it); mesh->property( origPositions, *v_it ) = mesh->point(*v_it);
// See if at least one vertex has been selected // See if at least one vertex has been selected
selectionExists |= mesh->status(v_it).selected(); selectionExists |= mesh->status(*v_it).selected();
} }
// Do one smoothing step (For each point of the mesh ... ) // Do one smoothing step (For each point of the mesh ... )
for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it) { for (v_it=mesh->vertices_begin(); v_it!=v_end; ++v_it) {
if(selectionExists && mesh->status(v_it).selected() == false) { if(selectionExists && mesh->status(*v_it).selected() == false) {
continue; continue;
} }
...@@ -233,14 +233,14 @@ void SmootherPlugin::simpleLaplace(int _iterations) { ...@@ -233,14 +233,14 @@ void SmootherPlugin::simpleLaplace(int _iterations) {
bool skip = false; bool skip = false;
// ( .. for each Outoing halfedge .. ) // ( .. for each Outoing halfedge .. )
PolyMesh::VertexOHalfedgeIter voh_it(*mesh,v_it); PolyMesh::VertexOHalfedgeIter voh_it(*mesh,*v_it);
for ( ; voh_it; ++voh_it ) { for ( ; voh_it.is_valid(); ++voh_it ) {
// .. add the (original) position of the Neighbour ( end of the outgoing halfedge ) // .. add the (original) position of the Neighbour ( end of the outgoing halfedge )
point += mesh->property( origPositions, mesh->to_vertex_handle(voh_it) ); point += mesh->property( origPositions, mesh->to_vertex_handle(*voh_it) );
// Check if the current Halfedge is a boundary halfedge // Check if the current Halfedge is a boundary halfedge
// If it is, abort and keep the current vertex position // If it is, abort and keep the current vertex position
if ( mesh->is_boundary( voh_it.handle() ) ) { if ( mesh->is_boundary( *voh_it ) ) {
skip = true; skip = true;
break; break;
} }
...@@ -248,11 +248,11 @@ void SmootherPlugin::simpleLaplace(int _iterations) { ...@@ -248,11 +248,11 @@ void SmootherPlugin::simpleLaplace(int _iterations) {
} }
// Devide by the valence of the current vertex // Devide by the valence of the current vertex
point /= mesh->valence( v_it ); point /= mesh->valence( *v_it );
if ( ! skip ) { if ( ! skip ) {
// Set new position for the mesh if its not on the boundary // Set new position for the mesh if its not on the boundary
mesh->point(v_it) = point; mesh->point(*v_it) = point;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment