在查看CloudCompare源码过程中,有一个地方不理解:
OctreeCellCodeType predCode = (p->theCode >> bitDec); //这里theCode左移操作怎么理解呢?谢谢啊~
//---------------------------------------------------------
此变量出自:
类 class DgmOctree
成员:
cellsContainer m_thePointsAndTheirCellCodes;
//! Container of 'IndexAndCode' structures
#define unsigned long long OctreeCellCodeType;
typedef std::vector cellsContainer;
struct IndexAndCode
{
//! index
unsigned theIndex;
//! cell code
OctreeCellCodeType theCode;
……
}
//-------------------对theCode赋值是这的--------------//
it->theCode = generateTruncatedCellCode(cellPos,MAX_OCTREE_LEVEL);
generateTruncatedCellCode()
{
const unsigned char dec = MAX_OCTREE_LEVEL-level;
( PRE_COMPUTED_POS_CODES.values[cellPos.x << dec]
| (PRE_COMPUTED_POS_CODES.values[cellPos.y << dec] << 1)
| (PRE_COMPUTED_POS_CODES.values[cellPos.z << dec] << 2)
) >> GET_BIT_SHIFT(level);
}
//---------------------对theCode是这样使用的---------------//
//binary shift for cell code truncation
unsigned char bitDec = GET_BIT_SHIFT(level);
//#define GET_BIT_SHIFT(level) (3*(CCLib::DgmOctree::MAX_OCTREE_LEVEL-level));
//iterator on octree elements
cellsContainer::const_iterator p = m_thePointsAndTheirCellCodes.begin();
//we init scan with first element
OctreeCellCodeType predCode = (p->theCode >> bitDec); //这里theCode左移操作是什么作用呢?谢谢啊~
阅读(3518) | 评论(0) | 转发(0) |