本文整理汇总了C++中cclib::ReferenceCloud::setPointScalarValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ReferenceCloud::setPointScalarValue方法的具体用法?C++ ReferenceCloud::setPointScalarValue怎么用?C++ ReferenceCloud::setPointScalarValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cclib::ReferenceCloud
的用法示例。
在下文中一共展示了ReferenceCloud::setPointScalarValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertCellIndexToSF
bool ccKdTree::convertCellIndexToSF()
{
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);
const char c_defaultSFName[] = "Kd-tree indexes";
int sfIdx = pc->getScalarFieldIndexByName(c_defaultSFName);
if (sfIdx < 0)
sfIdx = pc->addScalarField(c_defaultSFName);
if (sfIdx < 0)
{
ccLog::Error("Not enough memory!");
return false;
}
pc->setCurrentScalarField(sfIdx);
//for each cell
for (size_t i=0; i<leaves.size(); ++i)
{
CCLib::ReferenceCloud* subset = leaves[i]->points;
if (subset)
{
for (unsigned j=0; j<subset->size(); ++j)
subset->setPointScalarValue(j,(ScalarType)i);
}
}
pc->getScalarField(sfIdx)->computeMinAndMax();
pc->setCurrentDisplayedScalarField(sfIdx);
pc->showSF(true);
return true;
}
示例2: FuseCells
//.........这里部分代码省略.........
{
bestIt = it;
bestError = error;
if (bestFused)
delete bestFused;
bestFused = fused;
bestNormal = CCVector3(planeEquation);
fused = 0;
if (closestFirst)
break; //if we have found a good candidate, we stop here (closest first ;)
}
++it;
}
if (fused)
{
delete fused;
fused = 0;
}
}
//we have a (best) candidate for this pass?
if (bestIt != candidates.end())
{
assert(bestFused && bestError >= 0.0);
if (currentPointSet != currentCell->points)
delete currentPointSet;
currentPointSet = bestFused;
{
//update infos
CCLib::Neighbourhood N(currentPointSet);
//currentCentroid = *N.getGravityCenter(); //if we update it, the search will naturally shift along one dimension!
//currentNormal = bestNormal; //same thing here for normals
}
bestIt->leaf->userData = currentCell->userData;
//bestIt->leaf->userData = macroIndex++; //FIXME TEST
//we will test this cell's neighbors as well
cellsToTest.push_back(bestIt->leaf);
if (progressCb && !nProgress.oneStep()) //process canceled by user
{
//premature end!
candidates.clear();
cellsToTest.clear();
cancelled = true;
break;
}
QApplication::processEvents();
//we also remove it from the candidates list
candidates.erase(bestIt);
}
if (skipCount == candidates.size() && cellsToTest.empty())
{
//only far leaves remain...
candidates.clear();
}
}
} //no more candidates or cells to test
//end of the fusion process for the current leaf
if (currentPointSet != currentCell->points)
delete currentPointSet;
currentPointSet = 0;
if (cancelled)
break;
}
}
//convert fused indexes to SF
if (!cancelled)
{
pc->enableScalarField();
for (size_t i=0; i<leaves.size(); ++i)
{
CCLib::ReferenceCloud* subset = leaves[i]->points;
if (subset)
{
ScalarType scalar = (ScalarType)leaves[i]->userData;
if (leaves[i]->userData <= 0) //for unfused cells, we create new individual groups
scalar = static_cast<ScalarType>(macroIndex++);
//scalar = NAN_VALUE; //FIXME TEST
for (unsigned j=0; j<subset->size(); ++j)
subset->setPointScalarValue(j,scalar);
}
}
//pc->setCurrentDisplayedScalarField(sfIdx);
}
return !cancelled;
}