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

Moved code from header to cc file

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@847 fdac6126-5c0c-442c-9429-916003d36597
parent b1c20679
......@@ -123,6 +123,30 @@ FaceHandle ArrayKernel::handle(const Face& _f) const
return FaceHandle(&_f - &faces_.front());
}
#define SIGNED(x) signed( (x) )
bool ArrayKernel::is_valid_handle(VertexHandle _vh) const
{
return 0 <= _vh.idx() && _vh.idx() < SIGNED(n_vertices());
}
bool ArrayKernel::is_valid_handle(HalfedgeHandle _heh) const
{
return 0 <= _heh.idx() && _heh.idx() < SIGNED(n_edges()*2);
}
bool ArrayKernel::is_valid_handle(EdgeHandle _eh) const
{
return 0 <= _eh.idx() && _eh.idx() < SIGNED(n_edges());
}
bool ArrayKernel::is_valid_handle(FaceHandle _fh) const
{
return 0 <= _fh.idx() && _fh.idx() < SIGNED(n_faces());
}
#undef SIGNED
unsigned int ArrayKernel::delete_isolated_vertices()
{
assert(has_vertex_status());//this function requires vertex status property
......
......@@ -120,19 +120,19 @@ public:
FaceHandle handle(const Face& _f) const;
#define SIGNED(x) signed( (x) )
//checks handle validity - useful for debugging
bool is_valid_handle(VertexHandle _vh) const
{ return 0 <= _vh.idx() && _vh.idx() < SIGNED(n_vertices()); }
bool is_valid_handle(HalfedgeHandle _heh) const
{ return 0 <= _heh.idx() && _heh.idx() < SIGNED(n_edges()*2); }
///checks handle validity - useful for debugging
bool is_valid_handle(VertexHandle _vh) const;
bool is_valid_handle(EdgeHandle _eh) const
{ return 0 <= _eh.idx() && _eh.idx() < SIGNED(n_edges()); }
///checks handle validity - useful for debugging
bool is_valid_handle(HalfedgeHandle _heh) const;
///checks handle validity - useful for debugging
bool is_valid_handle(EdgeHandle _eh) const;
///checks handle validity - useful for debugging
bool is_valid_handle(FaceHandle _fh) const;
bool is_valid_handle(FaceHandle _fh) const
{ return 0 <= _fh.idx() && _fh.idx() < SIGNED(n_faces()); }
// --- item -> handle ---
const Vertex& vertex(VertexHandle _vh) const
......@@ -183,8 +183,6 @@ public:
return faces_[_fh.idx()];
}
#undef SIGNED
// --- get i'th items ---
VertexHandle vertex_handle(unsigned int _i) const
......
......@@ -596,6 +596,102 @@ void PolyConnectivity::delete_face(FaceHandle _fh, bool _delete_isolated_vertice
adjust_outgoing_halfedge(*v_it);
}
//-----------------------------------------------------------------------------
PolyConnectivity::VertexIter PolyConnectivity::vertices_begin()
{
return VertexIter(*this, VertexHandle(0));
}
//-----------------------------------------------------------------------------
PolyConnectivity::ConstVertexIter PolyConnectivity::vertices_begin() const
{
return ConstVertexIter(*this, VertexHandle(0));
}
//-----------------------------------------------------------------------------
PolyConnectivity::VertexIter PolyConnectivity::vertices_end()
{
return VertexIter(*this, VertexHandle(n_vertices()));
}
//-----------------------------------------------------------------------------
PolyConnectivity::ConstVertexIter PolyConnectivity::vertices_end() const
{
return ConstVertexIter(*this, VertexHandle(n_vertices()));
}
//-----------------------------------------------------------------------------
PolyConnectivity::HalfedgeIter PolyConnectivity::halfedges_begin()
{
return HalfedgeIter(*this, HalfedgeHandle(0));
}
//-----------------------------------------------------------------------------
PolyConnectivity::ConstHalfedgeIter PolyConnectivity::halfedges_begin() const
{
return ConstHalfedgeIter(*this, HalfedgeHandle(0));
}
//-----------------------------------------------------------------------------
PolyConnectivity::HalfedgeIter PolyConnectivity::halfedges_end()
{
return HalfedgeIter(*this, HalfedgeHandle(n_halfedges()));
}
//-----------------------------------------------------------------------------
PolyConnectivity::ConstHalfedgeIter PolyConnectivity::halfedges_end() const
{
return ConstHalfedgeIter(*this, HalfedgeHandle(n_halfedges()));
}
//-----------------------------------------------------------------------------
PolyConnectivity::EdgeIter PolyConnectivity::edges_begin()
{
return EdgeIter(*this, EdgeHandle(0));
}
//-----------------------------------------------------------------------------
PolyConnectivity::ConstEdgeIter PolyConnectivity::edges_begin() const
{
return ConstEdgeIter(*this, EdgeHandle(0));
}
//-----------------------------------------------------------------------------
PolyConnectivity::EdgeIter PolyConnectivity::edges_end()
{
return EdgeIter(*this, EdgeHandle(n_edges()));
}
//-----------------------------------------------------------------------------
PolyConnectivity::ConstEdgeIter PolyConnectivity::edges_end() const
{
return ConstEdgeIter(*this, EdgeHandle(n_edges()));
}
//-----------------------------------------------------------------------------
PolyConnectivity::FaceIter PolyConnectivity::faces_begin()
{
return FaceIter(*this, FaceHandle(0));
}
//-----------------------------------------------------------------------------
PolyConnectivity::ConstFaceIter PolyConnectivity::faces_begin() const
{
return ConstFaceIter(*this, FaceHandle(0));
}
//-----------------------------------------------------------------------------
PolyConnectivity::FaceIter PolyConnectivity::faces_end()
{
return FaceIter(*this, FaceHandle(n_faces()));
}
//-----------------------------------------------------------------------------
PolyConnectivity::ConstFaceIter PolyConnectivity::faces_end() const
{
return ConstFaceIter(*this, FaceHandle(n_faces()));
}
//-----------------------------------------------------------------------------
void PolyConnectivity::collapse(HalfedgeHandle _hh)
{
......
......@@ -271,56 +271,40 @@ public:
//@{
/// Begin iterator for vertices
VertexIter vertices_begin()
{ return VertexIter(*this, VertexHandle(0)); }
VertexIter vertices_begin();
/// Const begin iterator for vertices
ConstVertexIter vertices_begin() const
{ return ConstVertexIter(*this, VertexHandle(0)); }
ConstVertexIter vertices_begin() const;
/// End iterator for vertices
VertexIter vertices_end()
{ return VertexIter(*this, VertexHandle(n_vertices())); }
VertexIter vertices_end();
/// Const end iterator for vertices
ConstVertexIter vertices_end() const
{ return ConstVertexIter(*this, VertexHandle(n_vertices())); }
ConstVertexIter vertices_end() const;
/// Begin iterator for halfedges
HalfedgeIter halfedges_begin()
{ return HalfedgeIter(*this, HalfedgeHandle(0)); }
HalfedgeIter halfedges_begin();
/// Const begin iterator for halfedges
ConstHalfedgeIter halfedges_begin() const
{ return ConstHalfedgeIter(*this, HalfedgeHandle(0)); }
ConstHalfedgeIter halfedges_begin() const;
/// End iterator for halfedges
HalfedgeIter halfedges_end()
{ return HalfedgeIter(*this, HalfedgeHandle(n_halfedges())); }
HalfedgeIter halfedges_end();
/// Const end iterator for halfedges
ConstHalfedgeIter halfedges_end() const
{ return ConstHalfedgeIter(*this, HalfedgeHandle(n_halfedges())); }
ConstHalfedgeIter halfedges_end() const;
/// Begin iterator for edges
EdgeIter edges_begin()
{ return EdgeIter(*this, EdgeHandle(0)); }
EdgeIter edges_begin();
/// Const begin iterator for edges
ConstEdgeIter edges_begin() const
{ return ConstEdgeIter(*this, EdgeHandle(0)); }
ConstEdgeIter edges_begin() const;
/// End iterator for edges
EdgeIter edges_end()
{ return EdgeIter(*this, EdgeHandle(n_edges())); }
EdgeIter edges_end();
/// Const end iterator for edges
ConstEdgeIter edges_end() const
{ return ConstEdgeIter(*this, EdgeHandle(n_edges())); }
ConstEdgeIter edges_end() const;
/// Begin iterator for faces
FaceIter faces_begin()
{ return FaceIter(*this, FaceHandle(0)); }
FaceIter faces_begin();
/// Const begin iterator for faces
ConstFaceIter faces_begin() const
{ return ConstFaceIter(*this, FaceHandle(0)); }
ConstFaceIter faces_begin() const;
/// End iterator for faces
FaceIter faces_end()
{ return FaceIter(*this, FaceHandle(n_faces())); }
FaceIter faces_end();
/// Const end iterator for faces
ConstFaceIter faces_end() const
{ return ConstFaceIter(*this, FaceHandle(n_faces())); }
ConstFaceIter faces_end() const;
template<typename CONTAINER_TYPE, typename ITER_TYPE, ITER_TYPE (CONTAINER_TYPE::*begin_fn)(), ITER_TYPE (CONTAINER_TYPE::*end_fn)()>
class EntityRange {
......
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