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

* Fixed Bug when getting handle from Halfedge. ( Reported by

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@211 fdac6126-5c0c-442c-9429-916003d36597
parent e88638c0
......@@ -117,7 +117,11 @@ public:
HalfedgeHandle handle(const Halfedge& _he) const
{
uint eh(((char*)&edges_.front() - (char*)&_he) % sizeof(Edge));
// 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
uint 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]) ?
......
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