本文整理汇总了C++中cclib::ScalarField::resize方法的典型用法代码示例。如果您正苦于以下问题:C++ ScalarField::resize方法的具体用法?C++ ScalarField::resize怎么用?C++ ScalarField::resize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cclib::ScalarField
的用法示例。
在下文中一共展示了ScalarField::resize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: refCloud
ccPointCloud* cc2Point5DimEditor::convertGridToCloud( const std::vector<ExportableFields>& exportedFields,
bool interpolateSF,
bool resampleInputCloud,
ccGenericPointCloud* inputCloud,
bool fillEmptyCells,
double emptyCellsHeight) const
{
if (!m_grid.isValid())
return 0;
unsigned pointsCount = (fillEmptyCells ? m_grid.width * m_grid.height : m_grid.validCellCount);
if (pointsCount == 0)
{
ccLog::Warning("[Rasterize] Empty grid!");
return 0;
}
ccPointCloud* cloudGrid = 0;
if (resampleInputCloud)
{
CCLib::ReferenceCloud refCloud(inputCloud);
if (refCloud.reserve(m_grid.nonEmptyCellCount))
{
for (unsigned j=0; j<m_grid.height; ++j)
{
for (unsigned i=0; i<m_grid.width; ++i)
{
const RasterCell& cell = m_grid.data[j][i];
if (cell.nbPoints) //non empty cell
{
refCloud.addPointIndex(cell.pointIndex);
}
}
}
assert(refCloud.size() != 0);
cloudGrid = inputCloud->isA(CC_TYPES::POINT_CLOUD) ? static_cast<ccPointCloud*>(inputCloud)->partialClone(&refCloud) : ccPointCloud::From(&refCloud,inputCloud);
cloudGrid->setPointSize(0); //to avoid display issues
//even if we have already resampled the original cloud we may have to create new points and/or scalar fields
//if (!interpolateSF && !fillEmptyCells)
// return cloudGrid;
}
else
{
ccLog::Warning("[Rasterize] Not enough memory!");
return 0;
}
}
else
{
cloudGrid = new ccPointCloud("grid");
}
assert(cloudGrid);
//shall we generate per-cell fields as well?
std::vector<CCLib::ScalarField*> exportedSFs;
if (!exportedFields.empty())
{
exportedSFs.resize(exportedFields.size(),0);
for (size_t i=0; i<exportedFields.size(); ++i)
{
int sfIndex = -1;
switch (exportedFields[i])
{
case PER_CELL_HEIGHT:
case PER_CELL_COUNT:
case PER_CELL_MIN_HEIGHT:
case PER_CELL_MAX_HEIGHT:
case PER_CELL_AVG_HEIGHT:
case PER_CELL_HEIGHT_STD_DEV:
case PER_CELL_HEIGHT_RANGE:
sfIndex = cloudGrid->addScalarField(qPrintable(GetDefaultFieldName(exportedFields[i])));
break;
default:
assert(false);
break;
}
if (sfIndex < 0)
{
ccLog::Warning("[Rasterize] Couldn't allocate scalar field(s)! Try to free some memory ...");
break;
}
exportedSFs[i] = cloudGrid->getScalarField(sfIndex);
assert(exportedSFs[i]);
}
}
//the resampled cloud already contains the points corresponding to 'filled' cells so we will only
//need to add the empty ones (if requested)
if ((!resampleInputCloud || fillEmptyCells) && !cloudGrid->reserve(pointsCount))
{
ccLog::Warning("[Rasterize] Not enough memory!");
delete cloudGrid;
return 0;
}
//vertical dimension
const unsigned char Z = getProjectionDimension();
//.........这里部分代码省略.........