本文整理汇总了C++中PointBuffer::copyPointFast方法的典型用法代码示例。如果您正苦于以下问题:C++ PointBuffer::copyPointFast方法的具体用法?C++ PointBuffer::copyPointFast怎么用?C++ PointBuffer::copyPointFast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointBuffer
的用法示例。
在下文中一共展示了PointBuffer::copyPointFast方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getIndex
// BUG: this duplicates the code above
boost::uint32_t Cache::readBufferImpl(PointBuffer& data)
{
const boost::uint32_t cacheBlockSize = m_filter.getCacheBlockSize();
const boost::uint64_t currentPointIndex = getIndex();
// for now, we only read from the cache if they are asking for one point
// (this avoids the problem of an N-point request needing more than one
// cached block to satisfy it)
if (data.getCapacity() != 1)
{
const boost::uint32_t numRead = getPrevIterator().read(data);
// if they asked for a full block and we got a full block,
// and the block we got is properly aligned and not already cached,
// then let's cache it!
const bool isCacheable = (data.getCapacity() == cacheBlockSize) &&
(numRead == cacheBlockSize) &&
(currentPointIndex % cacheBlockSize == 0);
if (isCacheable && (m_filter.lookupInCache(currentPointIndex) == NULL))
{
m_filter.addToCache(currentPointIndex, data);
}
m_filter.updateStats(numRead, data.getCapacity());
return numRead;
}
// they asked for just one point -- first, check Mister Cache
const PointBuffer* block = m_filter.lookupInCache(currentPointIndex);
if (block != NULL)
{
// A hit! A palpable hit!
data.copyPointFast(0, currentPointIndex % cacheBlockSize, *block);
m_filter.updateStats(0, 1);
return 1;
}
// Not in the cache, so do a normal read :-(
const boost::uint32_t numRead = getPrevIterator().read(data);
m_filter.updateStats(numRead, numRead);
return numRead;
}
示例2: x
// append all points from src buffer to end of dst buffer, based on the our bounds
boost::uint32_t Crop::processBuffer(PointBuffer& dstData, const PointBuffer& srcData) const
{
const Schema& schema = dstData.getSchema();
const Bounds<double>& bounds = this->getBounds();
boost::uint32_t numSrcPoints = srcData.getNumPoints();
boost::uint32_t dstIndex = dstData.getNumPoints();
boost::uint32_t numPointsAdded = 0;
boost::optional<Dimension const&> dimX = schema.getDimension("X");
boost::optional<Dimension const&> dimY = schema.getDimension("Y");
boost::optional<Dimension const&> dimZ = schema.getDimension("Z");
for (boost::uint32_t srcIndex=0; srcIndex<numSrcPoints; srcIndex++)
{
// need to scale the values
double x(0.0);
double y(0.0);
double z(0.0);
if (dimX->getInterpretation() == dimension::SignedInteger )
{
boost::int32_t xi = srcData.getField<boost::int32_t>(*dimX, srcIndex);
boost::int32_t yi = srcData.getField<boost::int32_t>(*dimY, srcIndex);
boost::int32_t zi = srcData.getField<boost::int32_t>(*dimZ, srcIndex);
x = dimX->applyScaling(xi);
y = dimY->applyScaling(yi);
z = dimZ->applyScaling(zi);
}
else if (dimX->getInterpretation() == dimension::UnsignedInteger)
{
boost::uint32_t xi = srcData.getField<boost::uint32_t>(*dimX, srcIndex);
boost::uint32_t yi = srcData.getField<boost::uint32_t>(*dimY, srcIndex);
boost::uint32_t zi = srcData.getField<boost::uint32_t>(*dimZ, srcIndex);
x = dimX->applyScaling(xi);
y = dimY->applyScaling(yi);
z = dimZ->applyScaling(zi);
} else
{
x = srcData.getField<double>(*dimX, srcIndex);
y = srcData.getField<double>(*dimY, srcIndex);
z = srcData.getField<double>(*dimZ, srcIndex);
}
Vector<double> point(x,y,z);
if (bounds.contains(point))
{
dstData.copyPointFast(dstIndex, srcIndex, srcData);
dstData.setNumPoints(dstIndex+1);
++dstIndex;
++numPointsAdded;
}
}
assert(dstIndex <= dstData.getCapacity());
return numPointsAdded;
}