git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@908 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Jan Möbius
2013-08-07 11:32:50 +00:00
parent 0217136b5e
commit daea181b2f
16 changed files with 117 additions and 119 deletions

View File

@@ -165,7 +165,7 @@ MeshViewerWidgetT<M>::open_mesh(const char* _filename, IO::Options _opt)
{ {
typename Mesh::Point v(0,0,0); typename Mesh::Point v(0,0,0);
for( fv_it=mesh_.fv_iter(f_it); fv_it.is_valid(); ++fv_it) for( fv_it=mesh_.fv_iter(f_it); fv_it.is_valid(); ++fv_it)
v += OpenMesh::vector_cast<typename Mesh::Normal>(mesh_.point(fv_it)); v += OpenMesh::vector_cast<typename Mesh::Normal>(mesh_.point(*fv_it));
v *= 1.0f/3.0f; v *= 1.0f/3.0f;
mesh_.property( fp_normal_base_, f_it ) = v; mesh_.property( fp_normal_base_, f_it ) = v;
} }
@@ -323,11 +323,11 @@ MeshViewerWidgetT<M>::draw_openmesh(const std::string& _draw_mode)
for (; fIt!=fEnd; ++fIt) for (; fIt!=fEnd; ++fIt)
{ {
fvIt = mesh_.cfv_iter(*fIt); fvIt = mesh_.cfv_iter(*fIt);
glVertex3fv( &mesh_.point(fvIt)[0] ); glVertex3fv( &mesh_.point(*fvIt)[0] );
++fvIt; ++fvIt;
glVertex3fv( &mesh_.point(fvIt)[0] ); glVertex3fv( &mesh_.point(*fvIt)[0] );
++fvIt; ++fvIt;
glVertex3fv( &mesh_.point(fvIt)[0] ); glVertex3fv( &mesh_.point(*fvIt)[0] );
} }
glEnd(); glEnd();
} }
@@ -340,11 +340,11 @@ MeshViewerWidgetT<M>::draw_openmesh(const std::string& _draw_mode)
glNormal3fv( &mesh_.normal(fIt)[0] ); glNormal3fv( &mesh_.normal(fIt)[0] );
fvIt = mesh_.cfv_iter(*fIt); fvIt = mesh_.cfv_iter(*fIt);
glVertex3fv( &mesh_.point(fvIt)[0] ); glVertex3fv( &mesh_.point(*fvIt)[0] );
++fvIt; ++fvIt;
glVertex3fv( &mesh_.point(fvIt)[0] ); glVertex3fv( &mesh_.point(*fvIt)[0] );
++fvIt; ++fvIt;
glVertex3fv( &mesh_.point(fvIt)[0] ); glVertex3fv( &mesh_.point(*fvIt)[0] );
} }
glEnd(); glEnd();

View File

@@ -358,10 +358,9 @@ int main(int argc, char **argv)
face_quality = 0.0; face_quality = 0.0;
valence = 0; valence = 0;
for (ff_it = mesh.ff_iter(*f_it); ff_it; ++ff_it) { for (ff_it = mesh.ff_iter(*f_it); ff_it.is_valid(); ++ff_it) {
temp_quality = OpenMesh::dot( mesh.normal(f_it), temp_quality = OpenMesh::dot( mesh.normal(*f_it), mesh.normal(*ff_it) );
mesh.normal(ff_it) );
if (temp_quality >= 1.0) if (temp_quality >= 1.0)
temp_quality = .99; temp_quality = .99;

View File

@@ -857,7 +857,7 @@ compute_screen_space_error(VHierarchyNodeHandle node_handle, VHierarchyNodeHandl
residual = lp - mesh_.point(vh); residual = lp - mesh_.point(vh);
min_distance = residual.length(); min_distance = residual.length();
for (vf_it=mesh_.vf_iter(vh); vf_it; ++vf_it) for (vf_it=mesh_.vf_iter(vh); vf_it.is_valid(); ++vf_it)
{ {
heh = mesh_.halfedge_handle(*vf_it); heh = mesh_.halfedge_handle(*vf_it);
tri[0] = mesh_.point(mesh_.to_vertex_handle(heh)); tri[0] = mesh_.point(mesh_.to_vertex_handle(heh));

View File

@@ -367,9 +367,9 @@ int main(int argc, char *argv[] )
MyMesh::FaceIter it = mesh.faces_begin(); MyMesh::FaceIter it = mesh.faces_begin();
for (; it != mesh.faces_end(); ++it) for (; it != mesh.faces_end(); ++it)
{ {
mesh.set_color( it , MyMesh::Color( std::min((int)(r+0.5),255), mesh.set_color( *it , MyMesh::Color( std::min((int)(r+0.5),255),
std::min((int)(g+0.5),255), std::min((int)(g+0.5),255),
std::max((int)(b+0.5),0) ) ); std::max((int)(b+0.5),0) ) );
r += d2; r += d2;
// g += d2; // g += d2;
b -= d; b -= d;

View File

@@ -313,7 +313,7 @@ class GenericCirculatorT : protected GenericCirculatorBaseT<Mesh> {
return GenericCirculator_ValueHandleFns::is_valid(this->mesh_, this->heh_, this->start_, this->lap_counter_); return GenericCirculator_ValueHandleFns::is_valid(this->mesh_, this->heh_, this->start_, this->lap_counter_);
} }
DEPRECATED("current_halfedge_handle() is an implementation detail and should not be accessed from outside the iterator class.") //DEPRECATED("current_halfedge_handle() is an implementation detail and should not be accessed from outside the iterator class.")
const HalfedgeHandle &current_halfedge_handle() const { const HalfedgeHandle &current_halfedge_handle() const {
return this->heh_; return this->heh_;
} }

View File

@@ -170,9 +170,9 @@ calc_face_centroid(FaceHandle _fh, Point& _pt) const
{ {
_pt.vectorize(0); _pt.vectorize(0);
Scalar valence = 0.0; Scalar valence = 0.0;
for (ConstFaceVertexIter cfv_it = this->cfv_iter(_fh); cfv_it; ++cfv_it, valence += 1.0) for (ConstFaceVertexIter cfv_it = this->cfv_iter(_fh); cfv_it.is_valid(); ++cfv_it, valence += 1.0)
{ {
_pt += this->point(cfv_it); _pt += this->point(*cfv_it);
} }
_pt /= valence; _pt /= valence;
} }

View File

@@ -100,7 +100,7 @@ PolyMesh_ArrayKernelT<MeshTraits>* MeshDual (PolyMesh_ArrayKernelT<MeshTraits> &
{ {
typename PolyMesh_ArrayKernelT<MeshTraits>::Point centerPoint(0,0,0); typename PolyMesh_ArrayKernelT<MeshTraits>::Point centerPoint(0,0,0);
unsigned int degree= 0; unsigned int degree= 0;
for(typename PolyMesh_ArrayKernelT<MeshTraits>::ConstFaceVertexIter vit=primal.cfv_iter(fit); vit.is_valid(); ++vit, ++degree) for(typename PolyMesh_ArrayKernelT<MeshTraits>::ConstFaceVertexIter vit=primal.cfv_iter(*fit); vit.is_valid(); ++vit, ++degree)
centerPoint += primal.point(*vit); centerPoint += primal.point(*vit);
assert(degree!=0); assert(degree!=0);
centerPoint /= degree; centerPoint /= degree;
@@ -114,7 +114,7 @@ PolyMesh_ArrayKernelT<MeshTraits>* MeshDual (PolyMesh_ArrayKernelT<MeshTraits> &
if(!primal.is_boundary(*vit)) if(!primal.is_boundary(*vit))
{ {
face_vhandles.clear(); face_vhandles.clear();
for(typename PolyMesh_ArrayKernelT<MeshTraits>::ConstVertexFaceIter fit=primal.cvf_iter(vit); fit.is_valid(); ++fit) for(typename PolyMesh_ArrayKernelT<MeshTraits>::ConstVertexFaceIter fit=primal.cvf_iter(*vit); fit.is_valid(); ++fit)
face_vhandles.push_back(primal.property(primalToDual, *fit)); face_vhandles.push_back(primal.property(primalToDual, *fit));
dual->add_face(face_vhandles); dual->add_face(face_vhandles);
} }

View File

@@ -201,7 +201,7 @@ void CompositeT<M>::refine(typename M::FaceHandle& _fh)
{ {
typename Mesh::FaceHalfedgeIter fh_it(mesh_.fh_iter(_fh)); typename Mesh::FaceHalfedgeIter fh_it(mesh_.fh_iter(_fh));
for (; fh_it; ++fh_it) for (; fh_it.is_valid(); ++fh_it)
{ {
hh_vector.push_back(mesh_.PHEH(mesh_.OHEH(*fh_it))); hh_vector.push_back(mesh_.PHEH(mesh_.OHEH(*fh_it)));
} }

View File

@@ -237,7 +237,7 @@ public:
if (_target_state > 1) { if (_target_state > 1) {
for (fe_it = mesh_.fe_iter(_fh); fe_it; ++fe_it) { for (fe_it = mesh_.fe_iter(_fh); fe_it.is_valid(); ++fe_it) {
eh = *fe_it; eh = *fe_it;
prev_rule()->raise(eh, _target_state - 1); prev_rule()->raise(eh, _target_state - 1);
@@ -304,19 +304,19 @@ public:
if (_target_state > 1) if (_target_state > 1)
{ {
for (voh_it = mesh_.voh_iter(_vh); voh_it; ++voh_it) { for (voh_it = mesh_.voh_iter(_vh); voh_it.is_valid(); ++voh_it) {
halfedge_vector.push_back(*voh_it); halfedge_vector.push_back(*voh_it);
} }
while ( !halfedge_vector.empty() ) { while ( !halfedge_vector.empty() ) {
eh = mesh_.edge_handle(halfedge_vector.back()); eh = mesh_.edge_handle(halfedge_vector.back());
halfedge_vector.pop_back(); halfedge_vector.pop_back();
prev_rule()->raise(eh, _target_state - 1); prev_rule()->raise(eh, _target_state - 1);
} }
for (voh_it = mesh_.voh_iter(_vh); voh_it; ++voh_it) { for (voh_it = mesh_.voh_iter(_vh); voh_it.is_valid(); ++voh_it) {
halfedge_vector.push_back(*voh_it); halfedge_vector.push_back(*voh_it);
} }
while ( !halfedge_vector.empty() ) { while ( !halfedge_vector.empty() ) {

View File

@@ -138,7 +138,7 @@ Tvv3<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
Base::mesh_.split(_fh, vh); Base::mesh_.split(_fh, vh);
// calculate display position for new vertex // calculate display position for new vertex
for (vv_it = Base::mesh_.vv_iter(vh); vv_it; ++vv_it) for (vv_it = Base::mesh_.vv_iter(vh); vv_it.is_valid(); ++vv_it)
{ {
position += Base::mesh_.point(*vv_it); position += Base::mesh_.point(*vv_it);
++valence; ++valence;
@@ -154,30 +154,30 @@ Tvv3<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
typename M::VertexOHalfedgeIter voh_it; typename M::VertexOHalfedgeIter voh_it;
// check for edge flipping // check for edge flipping
for (voh_it = Base::mesh_.voh_iter(vh); voh_it; ++voh_it) { for (voh_it = Base::mesh_.voh_iter(vh); voh_it.is_valid(); ++voh_it) {
if (Base::mesh_.FH(*voh_it).is_valid()) {
MOBJ(Base::mesh_.FH(*voh_it)).set_state(_target_state); if (Base::mesh_.FH(*voh_it).is_valid()) {
MOBJ(Base::mesh_.FH(*voh_it)).set_not_final();
MOBJ(Base::mesh_.FH(*voh_it)).set_position(_target_state - 1, face_position);
for (state_t j = 0; j < _target_state; ++j) { MOBJ(Base::mesh_.FH(*voh_it)).set_state(_target_state);
MOBJ(Base::mesh_.FH(*voh_it)).set_position(j, MOBJ(_fh).position(j)); MOBJ(Base::mesh_.FH(*voh_it)).set_not_final();
} MOBJ(Base::mesh_.FH(*voh_it)).set_position(_target_state - 1, face_position);
if (Base::mesh_.FH(Base::mesh_.OHEH(Base::mesh_.NHEH(*voh_it))).is_valid()) {
if (MOBJ(Base::mesh_.FH(Base::mesh_.OHEH(Base::mesh_.NHEH(*voh_it)))).state() == _target_state) {
if (Base::mesh_.is_flip_ok(Base::mesh_.EH(Base::mesh_.NHEH(*voh_it)))) { for (state_t j = 0; j < _target_state; ++j) {
MOBJ(Base::mesh_.FH(*voh_it)).set_position(j, MOBJ(_fh).position(j));
}
edge_vector.push_back(Base::mesh_.EH(Base::mesh_.NHEH(*voh_it))); if (Base::mesh_.FH(Base::mesh_.OHEH(Base::mesh_.NHEH(*voh_it))).is_valid()) {
}
} if (MOBJ(Base::mesh_.FH(Base::mesh_.OHEH(Base::mesh_.NHEH(*voh_it)))).state() == _target_state) {
}
} if (Base::mesh_.is_flip_ok(Base::mesh_.EH(Base::mesh_.NHEH(*voh_it)))) {
edge_vector.push_back(Base::mesh_.EH(Base::mesh_.NHEH(*voh_it)));
}
}
}
}
} }
} }
@@ -881,7 +881,7 @@ void FF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state) {
if (_target_state > 1) { if (_target_state > 1) {
for (ff_it = Base::mesh_.ff_iter(_fh); ff_it; ++ff_it) { for (ff_it = Base::mesh_.ff_iter(_fh); ff_it.is_valid(); ++ff_it) {
face_vector.push_back(*ff_it); face_vector.push_back(*ff_it);
} }
@@ -894,7 +894,7 @@ void FF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state) {
Base::prev_rule()->raise(fh, _target_state - 1); Base::prev_rule()->raise(fh, _target_state - 1);
} }
for (ff_it = Base::mesh_.ff_iter(_fh); ff_it; ++ff_it) { for (ff_it = Base::mesh_.ff_iter(_fh); ff_it.is_valid(); ++ff_it) {
face_vector.push_back(*ff_it); face_vector.push_back(*ff_it);
} }
@@ -913,7 +913,7 @@ void FF<M>::raise(typename M::FaceHandle& _fh, state_t _target_state) {
typename M::Point position(0.0, 0.0, 0.0); typename M::Point position(0.0, 0.0, 0.0);
int valence(0); int valence(0);
for (ff_it = Base::mesh_.ff_iter(_fh); ff_it; ++ff_it) { for (ff_it = Base::mesh_.ff_iter(_fh); ff_it.is_valid(); ++ff_it) {
++valence; ++valence;
@@ -945,7 +945,7 @@ void FFc<M>::raise(typename M::FaceHandle& _fh, state_t _target_state)
if (_target_state > 1) if (_target_state > 1)
{ {
for (; ff_it; ++ff_it) for (; ff_it.is_valid(); ++ff_it)
face_vector.push_back(*ff_it); face_vector.push_back(*ff_it);
while (!face_vector.empty()) while (!face_vector.empty())
@@ -1010,7 +1010,7 @@ void FV<M>::raise(typename M::VertexHandle& _vh, state_t _target_state)
if (_target_state > 1) { if (_target_state > 1) {
for (; vf_it; ++vf_it) { for (; vf_it.is_valid(); ++vf_it) {
face_vector.push_back(*vf_it); face_vector.push_back(*vf_it);
} }

View File

@@ -332,7 +332,7 @@ CatmullClarkT<MeshType,RealType>::update_vertex( MeshType& _m, const VertexHandl
Normal Vec; Normal Vec;
pos = _m.point(_vh); pos = _m.point(_vh);
VertexEdgeIter ve_itr; VertexEdgeIter ve_itr;
for ( ve_itr = _m.ve_iter( _vh); ve_itr; ++ve_itr) for ( ve_itr = _m.ve_iter( _vh); ve_itr.is_valid(); ++ve_itr)
if ( _m.is_boundary( *ve_itr)) if ( _m.is_boundary( *ve_itr))
pos += _m.property( ep_pos_, *ve_itr); pos += _m.property( ep_pos_, *ve_itr);
pos /= 3.0; pos /= 3.0;
@@ -363,9 +363,9 @@ CatmullClarkT<MeshType,RealType>::update_vertex( MeshType& _m, const VertexHandl
RealType valence(0.0); RealType valence(0.0);
VOHIter voh_it = _m.voh_iter( _vh ); VOHIter voh_it = _m.voh_iter( _vh );
for( ; voh_it; ++voh_it ) for( ; voh_it.is_valid(); ++voh_it )
{ {
pos += _m.point( _m.to_vertex_handle( voh_it ) ); pos += _m.point( _m.to_vertex_handle( *voh_it ) );
valence+=1.0; valence+=1.0;
} }
pos /= valence*valence; pos /= valence*valence;
@@ -373,7 +373,7 @@ CatmullClarkT<MeshType,RealType>::update_vertex( MeshType& _m, const VertexHandl
VertexFaceIter vf_itr; VertexFaceIter vf_itr;
Point Q(0, 0, 0); Point Q(0, 0, 0);
for ( vf_itr = _m.vf_iter( _vh); vf_itr; ++vf_itr) //, neigboring_faces += 1.0 ) for ( vf_itr = _m.vf_iter( _vh); vf_itr.is_valid(); ++vf_itr) //, neigboring_faces += 1.0 )
{ {
Q += _m.property(fp_pos_, *vf_itr); Q += _m.property(fp_pos_, *vf_itr);
} }

View File

@@ -439,7 +439,7 @@ void CompositeT<MeshType,RealType>::FF()
valence = 0; valence = 0;
cog = zero_point; cog = zero_point;
for (ff_it = mesh_.ff_iter(*f_it); ff_it; ++ff_it) for (ff_it = mesh_.ff_iter(*f_it); ff_it.is_valid(); ++ff_it)
{ {
cog += mesh_.data(ff_it).position(); cog += mesh_.data(ff_it).position();
++valence; ++valence;
@@ -578,13 +578,13 @@ void CompositeT<MeshType,RealType>::FVc(Coeff& _coeff)
valence = 0; valence = 0;
cog = zero_point; cog = zero_point;
for (voh_it = mesh_.voh_iter(*v_it); voh_it; ++voh_it) { for (voh_it = mesh_.voh_iter(*v_it); voh_it.is_valid(); ++voh_it) {
++valence; ++valence;
} }
c = _coeff(valence); c = _coeff(valence);
for (voh_it = mesh_.voh_iter(*v_it); voh_it; ++voh_it) { for (voh_it = mesh_.voh_iter(*v_it); voh_it.is_valid(); ++voh_it) {
if (mesh_.face_handle(*voh_it).is_valid()) { if (mesh_.face_handle(*voh_it).is_valid()) {
@@ -889,14 +889,14 @@ void CompositeT<MeshType,RealType>::EVc(Coeff& _coeff)
valence = 0; valence = 0;
cog = zero_point; cog = zero_point;
for (voh_it = mesh_.voh_iter(*v_it); voh_it; ++voh_it) for (voh_it = mesh_.voh_iter(*v_it); voh_it.is_valid(); ++voh_it)
{ {
++valence; ++valence;
} }
c = _coeff(valence); c = _coeff(valence);
for (voh_it = mesh_.voh_iter(*v_it); voh_it; ++voh_it) { for (voh_it = mesh_.voh_iter(*v_it); voh_it.is_valid(); ++voh_it) {
cog += mesh_.data(mesh_.edge_handle(*voh_it)).position() * c; cog += mesh_.data(mesh_.edge_handle(*voh_it)).position() * c;
cog += mesh_.data(mesh_.edge_handle(mesh_.next_halfedge_handle(*voh_it))).position() * (1.0 - c); cog += mesh_.data(mesh_.edge_handle(mesh_.next_halfedge_handle(*voh_it))).position() * (1.0 - c);
} }

View File

@@ -436,13 +436,13 @@ private: // geometry helper
size_t valence(0); size_t valence(0);
// Calculate Valence and sum up neighbour points // Calculate Valence and sum up neighbour points
for (vvit=_m.vv_iter(_vh); vvit; ++vvit) { for (vvit=_m.vv_iter(_vh); vvit.is_valid(); ++vvit) {
++valence; ++valence;
pos += vector_cast< Vec >( _m.point(vvit) ); pos += vector_cast< Vec >( _m.point(*vvit) );
} }
pos *= weights_[valence].second; // alpha(n)/n * Sum q, q in one-ring of p pos *= weights_[valence].second; // alpha(n)/n * Sum q, q in one-ring of p
pos += weights_[valence].first pos += weights_[valence].first
* vector_cast<Vec>(_m.point(_vh)); // + (1-a)*p * vector_cast<Vec>(_m.point(_vh)); // + (1-a)*p
} }
_m.property( vp_pos_, _vh ) = pos; _m.property( vp_pos_, _vh ) = pos;

View File

@@ -455,11 +455,11 @@ private:
typename MeshType::HalfedgeHandle heh; typename MeshType::HalfedgeHandle heh;
// find boundary edge // find boundary edge
for( fe_it=_m.fe_iter( _fh ); fe_it && !_m.is_boundary( fe_it ); ++fe_it ) {}; for( fe_it=_m.fe_iter( _fh ); fe_it.is_valid() && !_m.is_boundary( fe_it ); ++fe_it ) {};
// use precomputed, already inserted but not linked vertices // use precomputed, already inserted but not linked vertices
vhl = _m.property(ep_nv_, fe_it).first; vhl = _m.property(ep_nv_, *fe_it).first;
vhr = _m.property(ep_nv_, fe_it).second; vhr = _m.property(ep_nv_, *fe_it).second;
/* /*
// *---------*---------* // *---------*---------*
@@ -474,8 +474,7 @@ private:
*/ */
// get halfedge pointing from P2 to P3 (inner boundary halfedge) // get halfedge pointing from P2 to P3 (inner boundary halfedge)
heh = _m.halfedge_handle(fe_it, heh = _m.halfedge_handle(*fe_it, _m.is_boundary(_m.halfedge_handle(*fe_it,0)));
_m.is_boundary(_m.halfedge_handle(fe_it,0)));
typename MeshType::HalfedgeHandle pl_P3; typename MeshType::HalfedgeHandle pl_P3;

View File

@@ -348,11 +348,11 @@ private:
typename MeshType::HalfedgeHandle heh; typename MeshType::HalfedgeHandle heh;
// find boundary edge // find boundary edge
for( fe_it=_m.fe_iter( _fh ); fe_it && !_m.is_boundary( fe_it ); ++fe_it ) {}; for( fe_it=_m.fe_iter( _fh ); fe_it.is_valid() && !_m.is_boundary( fe_it ); ++fe_it ) {};
// use precomputed, already inserted but not linked vertices // use precomputed, already inserted but not linked vertices
vhl = _m.property(ep_nv_, fe_it).first; vhl = _m.property(ep_nv_, *fe_it).first;
vhr = _m.property(ep_nv_, fe_it).second; vhr = _m.property(ep_nv_, *fe_it).second;
/* /*
// *---------*---------* // *---------*---------*
@@ -367,8 +367,8 @@ private:
*/ */
// get halfedge pointing from P2 to P3 (inner boundary halfedge) // get halfedge pointing from P2 to P3 (inner boundary halfedge)
heh = _m.halfedge_handle(fe_it, heh = _m.halfedge_handle(*fe_it,
_m.is_boundary(_m.halfedge_handle(fe_it,0))); _m.is_boundary(_m.halfedge_handle(*fe_it,0)));
typename MeshType::HalfedgeHandle pl_P3; typename MeshType::HalfedgeHandle pl_P3;

View File

@@ -93,7 +93,7 @@ check(unsigned int _targets, std::ostream& _os)
if (heh.is_valid() && !mesh_.is_boundary(heh)) if (heh.is_valid() && !mesh_.is_boundary(heh))
{ {
for (typename Mesh::ConstVertexOHalfedgeIter vh_it(mesh_, vh); for (typename Mesh::ConstVertexOHalfedgeIter vh_it(mesh_, vh);
vh_it; ++vh_it) vh_it.is_valid(); ++vh_it)
{ {
if (mesh_.is_boundary(*vh_it)) if (mesh_.is_boundary(*vh_it))
{ {
@@ -118,7 +118,7 @@ check(unsigned int _targets, std::ostream& _os)
// check whether circulators are still in order // check whether circulators are still in order
vv_it = mesh_.cvv_iter(vh); vv_it = mesh_.cvv_iter(vh);
for (count=0; vv_it && (count < max_valence); ++vv_it, ++count) {}; for (count=0; vv_it.is_valid() && (count < max_valence); ++vv_it, ++count) {};
if (count == max_valence) if (count == max_valence)
{ {
_os << "MeshChecker: vertex " << vh _os << "MeshChecker: vertex " << vh
@@ -126,7 +126,7 @@ check(unsigned int _targets, std::ostream& _os)
ok = false; ok = false;
} }
vv_it = mesh_.cvv_iter(vh); vv_it = mesh_.cvv_iter(vh);
for (count=0; vv_it && (count < max_valence); --vv_it, ++count) {}; for (count=0; vv_it.is_valid() && (count < max_valence); --vv_it, ++count) {};
if (count == max_valence) if (count == max_valence)
{ {
_os << "MeshChecker: vertex " << vh _os << "MeshChecker: vertex " << vh
@@ -144,7 +144,7 @@ check(unsigned int _targets, std::ostream& _os)
if (_targets & CHECK_EDGES) if (_targets & CHECK_EDGES)
{ {
typename Mesh::ConstHalfedgeIter h_it(mesh_.halfedges_begin()), typename Mesh::ConstHalfedgeIter h_it(mesh_.halfedges_begin()),
h_end(mesh_.halfedges_end()); h_end(mesh_.halfedges_end());
typename Mesh::HalfedgeHandle hh, hstart, hhh; typename Mesh::HalfedgeHandle hh, hstart, hhh;
size_t count, n_halfedges = 2*mesh_.n_edges(); size_t count, n_halfedges = 2*mesh_.n_edges();
@@ -152,41 +152,41 @@ check(unsigned int _targets, std::ostream& _os)
{ {
if (!is_deleted(mesh_.edge_handle(*h_it))) if (!is_deleted(mesh_.edge_handle(*h_it)))
{ {
hh = *h_it; hh = *h_it;
// degenerated halfedge ? // degenerated halfedge ?
if (mesh_.from_vertex_handle(hh) == mesh_.to_vertex_handle(hh)) if (mesh_.from_vertex_handle(hh) == mesh_.to_vertex_handle(hh))
{ {
_os << "MeshChecker: halfedge " << hh _os << "MeshChecker: halfedge " << hh
<< ": to-vertex == from-vertex\n"; << ": to-vertex == from-vertex\n";
ok = false; ok = false;
} }
// next <-> prev check // next <-> prev check
if (mesh_.next_halfedge_handle(mesh_.prev_halfedge_handle(hh)) != hh) if (mesh_.next_halfedge_handle(mesh_.prev_halfedge_handle(hh)) != hh)
{ {
_os << "MeshChecker: halfedge " << hh _os << "MeshChecker: halfedge " << hh
<< ": prev->next != this\n"; << ": prev->next != this\n";
ok = false; ok = false;
} }
// halfedges should form a cycle // halfedges should form a cycle
count=0; hstart=hhh=hh; count=0; hstart=hhh=hh;
do do
{ {
hhh = mesh_.next_halfedge_handle(hhh); hhh = mesh_.next_halfedge_handle(hhh);
++count; ++count;
} while (hhh != hstart && count < n_halfedges); } while (hhh != hstart && count < n_halfedges);
if (count == n_halfedges) if (count == n_halfedges)
{ {
_os << "MeshChecker: halfedges starting from " << hh _os << "MeshChecker: halfedges starting from " << hh
<< " do not form a cycle\n"; << " do not form a cycle\n";
ok = false; ok = false;
} }
} }
} }
} }
@@ -198,25 +198,25 @@ check(unsigned int _targets, std::ostream& _os)
if (_targets & CHECK_FACES) if (_targets & CHECK_FACES)
{ {
typename Mesh::ConstFaceIter f_it(mesh_.faces_begin()), typename Mesh::ConstFaceIter f_it(mesh_.faces_begin()),
f_end(mesh_.faces_end()); f_end(mesh_.faces_end());
typename Mesh::FaceHandle fh; typename Mesh::FaceHandle fh;
typename Mesh::ConstFaceHalfedgeIter fh_it; typename Mesh::ConstFaceHalfedgeIter fh_it;
for (; f_it != f_end; ++f_it) for (; f_it != f_end; ++f_it)
{ {
if (!is_deleted(f_it)) if (!is_deleted(f_it))
{ {
fh = *f_it; fh = *f_it;
for (fh_it=mesh_.cfh_iter(fh); fh_it; ++fh_it) for (fh_it=mesh_.cfh_iter(fh); fh_it.is_valid(); ++fh_it)
{ {
if (mesh_.face_handle(*fh_it) != fh) if (mesh_.face_handle(*fh_it) != fh)
{ {
_os << "MeshChecker: face " << fh _os << "MeshChecker: face " << fh
<< ": its halfedge does not reference face\n"; << ": its halfedge does not reference face\n";
ok = false; ok = false;
} }
} }
} }
} }
} }