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

Moved some code from header to cc file

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@846 fdac6126-5c0c-442c-9429-916003d36597
parent 31023408
......@@ -94,6 +94,35 @@ void ArrayKernel::assign_connectivity(const ArrayKernel& _other)
#undef COPY_STATUS_PROPERTY
}
// --- handle -> item ---
VertexHandle ArrayKernel::handle(const Vertex& _v) const
{
return VertexHandle(&_v - &vertices_.front());
}
HalfedgeHandle ArrayKernel::handle(const Halfedge& _he) const
{
// Calculate edge belonging to given halfedge
// There are two halfedges stored per edge
// Get memory position inside edge vector and devide by size of an edge
// to get the corresponding edge for the requested halfedge
unsigned int eh = ( (char*)&_he - (char*)&edges_.front() ) / sizeof(Edge) ;
assert((&_he == &edges_[eh].halfedges_[0]) ||
(&_he == &edges_[eh].halfedges_[1]));
return ((&_he == &edges_[eh].halfedges_[0]) ?
HalfedgeHandle(eh<<1) : HalfedgeHandle((eh<<1)+1));
}
EdgeHandle ArrayKernel::handle(const Edge& _e) const
{
return EdgeHandle(&_e - &edges_.front());
}
FaceHandle ArrayKernel::handle(const Face& _f) const
{
return FaceHandle(&_f - &faces_.front());
}
unsigned int ArrayKernel::delete_isolated_vertices()
{
assert(has_vertex_status());//this function requires vertex status property
......
......@@ -109,30 +109,16 @@ public:
copies only the connectivity, i.e. vertices, edges, faces and their status fields.
NOTE: The geometry (the points property) is NOT copied. Poly/TriConnectivity
override(and hide) that function to provide connectivity consistence.*/
void assign_connectivity(const ArrayKernel& _other);
void assign_connectivity(const ArrayKernel& _other);
// --- handle -> item ---
VertexHandle handle(const Vertex& _v) const
{return VertexHandle(&_v - &vertices_.front()); }
HalfedgeHandle handle(const Halfedge& _he) const
{
// Calculate edge belonging to given halfedge
// There are two halfedges stored per edge
// Get memory position inside edge vector and devide by size of an edge
// to get the corresponding edge for the requested halfedge
unsigned int eh = ( (char*)&_he - (char*)&edges_.front() ) / sizeof(Edge) ;
assert((&_he == &edges_[eh].halfedges_[0]) ||
(&_he == &edges_[eh].halfedges_[1]));
return ((&_he == &edges_[eh].halfedges_[0]) ?
HalfedgeHandle(eh<<1) : HalfedgeHandle((eh<<1)+1));
}
VertexHandle handle(const Vertex& _v) const;
HalfedgeHandle handle(const Halfedge& _he) const;
EdgeHandle handle(const Edge& _e) const
{ return EdgeHandle(&_e - &edges_.front()); }
EdgeHandle handle(const Edge& _e) const;
FaceHandle handle(const Face& _f) const
{ return FaceHandle(&_f - &faces_.front()); }
FaceHandle handle(const Face& _f) const;
#define SIGNED(x) signed( (x) )
//checks handle validity - useful for debugging
......
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