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