本文整理汇总了C++中cclib::ReferenceCloud::getPointGlobalIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ ReferenceCloud::getPointGlobalIndex方法的具体用法?C++ ReferenceCloud::getPointGlobalIndex怎么用?C++ ReferenceCloud::getPointGlobalIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cclib::ReferenceCloud
的用法示例。
在下文中一共展示了ReferenceCloud::getPointGlobalIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertCellIndexToRandomColor
bool ccKdTree::convertCellIndexToRandomColor()
{
if (!m_associatedGenericCloud || !m_associatedGenericCloud->isA(CC_TYPES::POINT_CLOUD))
return false;
//get leaves
std::vector<Leaf*> leaves;
if (!getLeaves(leaves) || leaves.empty())
return false;
ccPointCloud* pc = static_cast<ccPointCloud*>(m_associatedGenericCloud);
if (!pc->resizeTheRGBTable())
return false;
//for each cell
for (size_t i=0; i<leaves.size(); ++i)
{
colorType col[3];
ccColor::Generator::Random(col);
CCLib::ReferenceCloud* subset = leaves[i]->points;
if (subset)
{
for (unsigned j=0; j<subset->size(); ++j)
pc->setPointColor(subset->getPointGlobalIndex(j),col);
}
}
pc->showColors(true);
return true;
}
示例2: doAction
//.........这里部分代码省略.........
}
visibleCells = removeHiddenPoints(theCellCenters,viewPoint,3.5);
m_app->dispToConsole(QString("[HPR] Cells: %1 - Time: %2 s").arg(theCellCenters->size()).arg(eTimer.elapsed()/1.0e3));
//warning: after this, visibleCells can't be used anymore as a
//normal cloud (as it's 'associated cloud' has been deleted).
//Only its indexes are valid! (they are corresponding to octree cells)
delete theCellCenters;
theCellCenters = 0;
}
if (visibleCells)
{
//DGM: we generate a new cloud now, instead of playing with the points visiblity! (too confusing for the user)
/*if (!cloud->isVisibilityTableInstantiated() && !cloud->resetVisibilityArray())
{
m_app->dispToConsole("Visibility array allocation failed! (Not enough memory?)",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
return;
}
ccPointCloud::VisibilityTableType* pointsVisibility = cloud->getTheVisibilityArray();
assert(pointsVisibility);
pointsVisibility->fill(POINT_HIDDEN);
//*/
CCLib::ReferenceCloud visiblePoints(theOctree->associatedCloud());
unsigned visiblePointCount = 0;
unsigned visibleCellsCount = visibleCells->size();
CCLib::DgmOctree::cellIndexesContainer cellIndexes;
if (!theOctree->getCellIndexes(static_cast<unsigned char>(octreeLevel), cellIndexes))
{
m_app->dispToConsole("Couldn't fetch the list of octree cell indexes! (Not enough memory?)",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
delete visibleCells;
return;
}
for (unsigned i=0; i<visibleCellsCount; ++i)
{
//cell index
unsigned index = visibleCells->getPointGlobalIndex(i);
//points in this cell...
CCLib::ReferenceCloud Yk(theOctree->associatedCloud());
theOctree->getPointsInCellByCellIndex(&Yk,cellIndexes[index],static_cast<unsigned char>(octreeLevel));
//...are all visible
/*unsigned count = Yk.size();
for (unsigned j=0;j<count;++j)
pointsVisibility->setValue(Yk.getPointGlobalIndex(j),POINT_VISIBLE);
visiblePointCount += count;
//*/
if (!visiblePoints.add(Yk))
{
m_app->dispToConsole("Not enough memory!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
delete visibleCells;
return;
}
}
delete visibleCells;
visibleCells = 0;
m_app->dispToConsole(QString("[HPR] Visible points: %1").arg(visiblePointCount));
if (visiblePoints.size() == cloud->size())
{
m_app->dispToConsole("No points were removed!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
}
else
{
//create cloud from visibility selection
ccPointCloud* newCloud = cloud->partialClone(&visiblePoints);
if (newCloud)
{
newCloud->setDisplay(newCloud->getDisplay());
newCloud->setVisible(true);
newCloud->setName(cloud->getName()+QString(".visible_points"));
cloud->setEnabled(false);
//add associated viewport object
cc2DViewportObject* viewportObject = new cc2DViewportObject(QString("Viewport"));
viewportObject->setParameters(params);
newCloud->addChild(viewportObject);
m_app->addToDB(newCloud);
newCloud->redrawDisplay();
}
else
{
m_app->dispToConsole("Not enough memory!",ccMainAppInterface::ERR_CONSOLE_MESSAGE);
}
}
}
//currently selected entities appearance may have changed!
m_app->refreshAll();
}