* 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
This commit is contained in:
Jan Möbius
2009-09-28 12:12:08 +00:00
parent e88638c0c3
commit a56c45e2d3

View File

@@ -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]) ?