Commit b6ba729a authored by Jan Möbius's avatar Jan Möbius

Use range style in floodfil

parent 892fe3a6
......@@ -558,9 +558,8 @@ void MeshObjectSelectionPlugin::floodFillSelection(
PrimitiveType _primitiveTypes, bool _deselection) {
// reset tagged status
typename MeshT::FaceIter f_it, f_end(_mesh->faces_end());
for (f_it=_mesh->faces_begin(); f_it!=f_end; ++f_it)
_mesh->status(*f_it).set_tagged(false);
for ( auto face : _mesh->faces() )
_mesh->status(face).set_tagged(false);
std::vector<typename MeshT::FaceHandle> face_handles;
......@@ -578,44 +577,44 @@ void MeshObjectSelectionPlugin::floodFillSelection(
typename MeshT::FaceHandle fh = face_handles.back();
face_handles.pop_back();
for (typename MeshT::FaceFaceIter ff_it(*_mesh,fh) ; ff_it.is_valid() ; ++ff_it) {
for (auto ff_it : _mesh->ff_range(fh)) {
// Check if already tagged
if (_mesh->status(*ff_it).tagged())
if (_mesh->status(ff_it).tagged())
continue;
typename MeshT::Point n2 = _mesh->normal(*ff_it);
typename MeshT::Point n2 = _mesh->normal(ff_it);
double angle = acos(n1 | n2);
if (angle <= maxAngle) {
_mesh->status(*ff_it).set_tagged(true);
face_handles.push_back(*ff_it);
_mesh->status(ff_it).set_tagged(true);
face_handles.push_back(ff_it);
}
}
}
// now select all tagged primitives
for (f_it=_mesh->faces_begin(); f_it!=f_end; ++f_it) {
if (_mesh->status(*f_it).tagged()) {
for ( auto face : _mesh->faces() ) {
if (_mesh->status(face).tagged()) {
if(_primitiveTypes & vertexType_) {
for (typename MeshT::FaceVertexIter fv_it(*_mesh,*f_it) ; fv_it.is_valid(); ++fv_it)
for (typename MeshT::FaceVertexIter fv_it(*_mesh,face) ; fv_it.is_valid(); ++fv_it)
_mesh->status(*fv_it).set_selected(!_deselection);
}
if(_primitiveTypes & edgeType_) {
for (typename MeshT::FaceEdgeIter fe_it(*_mesh,*f_it) ; fe_it.is_valid(); ++fe_it)
for (typename MeshT::FaceEdgeIter fe_it(*_mesh,face) ; fe_it.is_valid(); ++fe_it)
_mesh->status(*fe_it).set_selected(!_deselection);
}
if(_primitiveTypes & halfedgeType_) {
for (typename MeshT::FaceHalfedgeIter fhe_it(*_mesh,*f_it) ; fhe_it.is_valid(); ++fhe_it)
for (typename MeshT::FaceHalfedgeIter fhe_it(*_mesh,face) ; fhe_it.is_valid(); ++fhe_it)
_mesh->status(*fhe_it).set_selected(!_deselection);
}
if(_primitiveTypes & faceType_) {
_mesh->status(*f_it).set_selected(!_deselection);
_mesh->status(face).set_selected(!_deselection);
}
}
}
......
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