Chinaunix首页 | 论坛 | 博客
  • 博客访问: 105872
  • 博文数量: 51
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 520
  • 用 户 组: 普通用户
  • 注册时间: 2015-07-07 10:17
文章分类

全部博文(51)

文章存档

2017年(2)

2016年(36)

2015年(13)

我的朋友

分类: C/C++

2016-03-11 13:43:57

在查看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) |
0

上一篇:osg::shader

下一篇:数学中的艺术家

给主人留下些什么吧!~~