53 #ifndef OPENVDB_TOOLS_PARTICLE_ATLAS_HAS_BEEN_INCLUDED 54 #define OPENVDB_TOOLS_PARTICLE_ATLAS_HAS_BEEN_INCLUDED 58 #include <openvdb/Grid.h> 59 #include <openvdb/Types.h> 60 #include <openvdb/math/Transform.h> 61 #include <openvdb/tree/Tree.h> 62 #include <openvdb/tree/LeafNode.h> 64 #include <boost/scoped_array.hpp> 65 #include <tbb/blocked_range.h> 66 #include <tbb/parallel_for.h> 67 #include <tbb/parallel_reduce.h> 105 template<
typename Po
intIndexGr
idType = Po
intIndexGr
id>
108 typedef boost::shared_ptr<ParticleAtlas>
Ptr;
109 typedef boost::shared_ptr<const ParticleAtlas>
ConstPtr;
112 typedef typename PointIndexGridType::ValueType
IndexType;
118 ParticleAtlas() : mIndexGridArray(), mMinRadiusArray(), mMaxRadiusArray() {}
125 template<
typename ParticleArrayType>
126 void construct(
const ParticleArrayType& particles,
double minVoxelSize,
size_t maxLevels = 50);
133 template<
typename ParticleArrayType>
134 static Ptr create(
const ParticleArrayType& particles,
double minVoxelSize,
size_t maxLevels = 50);
137 size_t levels()
const {
return mIndexGridArray.size(); }
139 bool empty()
const {
return mIndexGridArray.empty(); }
142 double minRadius(
size_t n)
const {
return mMinRadiusArray[n]; }
144 double maxRadius(
size_t n)
const {
return mMaxRadiusArray[n]; }
149 const PointIndexGridType&
pointIndexGrid(
size_t n)
const {
return *mIndexGridArray[n]; }
156 std::vector<PointIndexGridPtr> mIndexGridArray;
157 std::vector<double> mMinRadiusArray, mMaxRadiusArray;
172 template<
typename Po
intIndexGr
idType>
175 typedef typename PointIndexGridType::TreeType
TreeType;
189 template<
typename ParticleArrayType>
190 void worldSpaceSearchAndUpdate(
const Vec3d& center,
double radius,
const ParticleArrayType& particles);
196 template<
typename ParticleArrayType>
197 void worldSpaceSearchAndUpdate(
const BBoxd& bbox,
const ParticleArrayType& particles);
200 size_t levels()
const {
return mAtlas->levels(); }
204 void updateFromLevel(
size_t level);
214 bool test()
const {
return mRange.first < mRange.second || mIter != mRangeList.end(); }
215 operator bool()
const {
return this->test(); }
241 typedef std::pair<const IndexType*, const IndexType*> Range;
242 typedef std::deque<Range> RangeDeque;
243 typedef typename RangeDeque::const_iterator RangeDequeCIter;
244 typedef boost::scoped_array<IndexType> IndexArray;
247 boost::scoped_array<ConstAccessorPtr> mAccessorList;
251 RangeDeque mRangeList;
252 RangeDequeCIter mIter;
254 IndexArray mIndexArray;
255 size_t mIndexArraySize, mAccessorListSize;
264 namespace particle_atlas_internal {
267 template<
typename ParticleArrayT>
269 typedef typename ParticleArrayT::PosType
PosType;
273 : particleArray(&particles)
274 , minRadius(std::numeric_limits<ScalarType>::
max())
275 , maxRadius(-std::numeric_limits<ScalarType>::
max())
280 : particleArray(rhs.particleArray)
281 , minRadius(std::numeric_limits<ScalarType>::
max())
282 , maxRadius(-std::numeric_limits<ScalarType>::
max())
288 ScalarType radius, tmpMin = minRadius, tmpMax = maxRadius;
290 for (
size_t n = range.begin(), N = range.end(); n != N; ++n) {
291 particleArray->getRadius(n, radius);
296 minRadius =
std::min(minRadius, tmpMin);
297 maxRadius =
std::max(maxRadius, tmpMax);
310 template<
typename ParticleArrayT,
typename Po
intIndex>
313 typedef boost::shared_ptr<SplittableParticleArray>
Ptr;
314 typedef boost::shared_ptr<const SplittableParticleArray>
ConstPtr;
317 typedef typename ParticleArray::PosType
PosType;
321 : mIndexMap(), mParticleArray(&particles), mSize(particles.size())
327 : mIndexMap(), mParticleArray(&particles), mSize(particles.size())
329 mMinRadius = ScalarType(minR);
330 mMaxRadius = ScalarType(maxR);
335 size_t size()
const {
return mSize; }
337 void getPos(
size_t n, PosType& xyz)
const {
return mParticleArray->getPos(getGlobalIndex(n), xyz); }
338 void getRadius(
size_t n, ScalarType& radius)
const {
return mParticleArray->getRadius(getGlobalIndex(n), radius); }
343 size_t getGlobalIndex(
size_t n)
const {
return mIndexMap ? size_t(mIndexMap[n]) : n; }
347 Ptr
split(ScalarType maxRadiusLimit) {
349 if (mMaxRadius < maxRadiusLimit)
return Ptr();
351 boost::scoped_array<bool> mask(
new bool[mSize]);
353 tbb::parallel_for(tbb::blocked_range<size_t>(0, mSize),
354 MaskParticles(*
this, mask, maxRadiusLimit));
357 if (output->size() == 0)
return Ptr();
360 for (
size_t n = 0, N = mSize; n < N; ++n) {
361 newSize += size_t(!mask[n]);
364 boost::scoped_array<PointIndex> newIndexMap(
new PointIndex[newSize]);
366 setIndexMap(newIndexMap, mask,
false);
369 mIndexMap.swap(newIndexMap);
383 : mIndexMap(), mParticleArray(&other.
particleArray()), mSize(0)
385 for (
size_t n = 0, N = other.
size(); n < N; ++n) {
386 mSize += size_t(mask[n]);
391 other.setIndexMap(mIndexMap, mask,
true);
397 struct MaskParticles {
399 const boost::scoped_array<bool>& mask, ScalarType radius)
400 : particleArray(&particles)
401 , particleMask(mask.get())
402 , radiusLimit(radius)
406 void operator()(
const tbb::blocked_range<size_t>& range)
const {
407 const ScalarType maxRadius = radiusLimit;
409 for (
size_t n = range.begin(), N = range.end(); n != N; ++n) {
410 particleArray->getRadius(n, radius);
411 particleMask[n] = !(radius < maxRadius);
416 bool *
const particleMask;
417 ScalarType
const radiusLimit;
420 inline void updateExtremas() {
422 tbb::parallel_reduce(tbb::blocked_range<size_t>(0, mSize), op);
427 void setIndexMap(boost::scoped_array<PointIndex>& newIndexMap,
428 const boost::scoped_array<bool>& mask,
bool maskValue)
const 430 if (mIndexMap.get() != NULL) {
432 for (
size_t idx = 0, n = 0, N = mSize; n < N; ++n) {
433 if (mask[n] == maskValue) newIndexMap[idx++] = indices[n];
436 for (
size_t idx = 0, n = 0, N = mSize; n < N; ++n) {
437 if (mask[n] == maskValue) newIndexMap[idx++] =
PointIndex(n);
445 boost::scoped_array<PointIndex> mIndexMap;
446 ParticleArrayT
const *
const mParticleArray;
448 ScalarType mMinRadius, mMaxRadius;
452 template<
typename ParticleArrayType,
typename Po
intIndexLeafNodeType>
455 RemapIndices(
const ParticleArrayType& particles, std::vector<PointIndexLeafNodeType*> nodes)
456 : mParticles(&particles)
457 , mNodes(nodes.empty() ? NULL : &nodes.front())
461 void operator()(
const tbb::blocked_range<size_t>& range)
const {
462 typedef typename PointIndexLeafNodeType::ValueType PointIndexType;
463 for (
size_t n = range.begin(), N = range.end(); n != N; ++n) {
465 PointIndexLeafNodeType& node = *mNodes[n];
466 const size_t numIndices = node.indices().size();
468 if (numIndices > 0) {
469 PointIndexType* begin = &node.indices().front();
470 const PointIndexType* end = begin + numIndices;
472 while (begin < end) {
473 *begin = PointIndexType(mParticles->getGlobalIndex(*begin));
481 PointIndexLeafNodeType *
const *
const mNodes;
485 template<
typename ParticleArrayType,
typename IndexT>
488 typedef typename ParticleArrayType::PosType
PosType;
491 typedef std::pair<const IndexT*, const IndexT*>
Range;
496 ScalarType radius,
const ParticleArrayType& particles,
bool hasUniformRadius =
false)
501 , mParticles(&particles)
502 , mHasUniformRadius(hasUniformRadius)
504 if (mHasUniformRadius) {
505 ScalarType uniformRadius;
506 mParticles->getRadius(0, uniformRadius);
507 mRadius = mRadius + uniformRadius;
512 template <
typename LeafNodeType>
515 const size_t numIndices = leaf.indices().size();
516 if (numIndices > 0) {
517 const IndexT* begin = &leaf.indices().front();
518 filterVoxel(leaf.origin(), begin, begin + numIndices);
522 void filterVoxel(
const Coord&,
const IndexT* begin,
const IndexT* end)
526 if (mHasUniformRadius) {
528 const ScalarType searchRadiusSqr = mRadius;
530 while (begin < end) {
531 mParticles->getPos(
size_t(*begin), pos);
532 const ScalarType distSqr = (mCenter - pos).lengthSqr();
533 if (distSqr < searchRadiusSqr) {
534 mIndices.push_back(*begin);
539 while (begin < end) {
540 const size_t idx = size_t(*begin);
541 mParticles->getPos(idx, pos);
544 mParticles->getRadius(idx, radius);
546 ScalarType searchRadiusSqr = mRadius + radius;
547 searchRadiusSqr *= searchRadiusSqr;
549 const ScalarType distSqr = (mCenter - pos).lengthSqr();
551 if (distSqr < searchRadiusSqr) {
552 mIndices.push_back(*begin);
565 IndexDeque& mIndices;
566 PosType
const mCenter;
568 ParticleArrayType
const *
const mParticles;
569 bool const mHasUniformRadius;
573 template<
typename ParticleArrayType,
typename IndexT>
576 typedef typename ParticleArrayType::PosType
PosType;
579 typedef std::pair<const IndexT*, const IndexT*>
Range;
584 const BBoxd& bbox,
const ParticleArrayType& particles,
bool hasUniformRadius =
false)
587 , mBBox(PosType(bbox.
min()), PosType(bbox.
max()))
588 , mCenter(mBBox.getCenter())
589 , mParticles(&particles)
590 , mHasUniformRadius(hasUniformRadius)
591 , mUniformRadiusSqr(ScalarType(0.0))
593 if (mHasUniformRadius) {
594 mParticles->getRadius(0, mUniformRadiusSqr);
595 mUniformRadiusSqr *= mUniformRadiusSqr;
599 template <
typename LeafNodeType>
602 const size_t numIndices = leaf.indices().size();
603 if (numIndices > 0) {
604 const IndexT* begin = &leaf.indices().front();
605 filterVoxel(leaf.origin(), begin, begin + numIndices);
609 void filterVoxel(
const Coord&,
const IndexT* begin,
const IndexT* end)
613 if (mHasUniformRadius) {
614 const ScalarType radiusSqr = mUniformRadiusSqr;
616 while (begin < end) {
618 mParticles->getPos(
size_t(*begin), pos);
619 if (mBBox.isInside(pos)) {
620 mIndices.push_back(*begin++);
624 const ScalarType distSqr = pointToBBoxDistSqr(pos);
625 if (!(distSqr > radiusSqr)) {
626 mIndices.push_back(*begin);
633 while (begin < end) {
635 const size_t idx = size_t(*begin);
636 mParticles->getPos(idx, pos);
637 if (mBBox.isInside(pos)) {
638 mIndices.push_back(*begin++);
643 mParticles->getRadius(idx, radius);
644 const ScalarType distSqr = pointToBBoxDistSqr(pos);
645 if (!(distSqr > (radius * radius))) {
646 mIndices.push_back(*begin);
658 ScalarType pointToBBoxDistSqr(
const PosType& pos)
const 660 ScalarType distSqr = ScalarType(0.0);
662 for (
int i = 0; i < 3; ++i) {
664 const ScalarType a = pos[i];
666 ScalarType b = mBBox.min()[i];
668 ScalarType delta = b - a;
669 distSqr += delta * delta;
674 ScalarType delta = a - b;
675 distSqr += delta * delta;
683 IndexDeque& mIndices;
685 PosType
const mCenter;
686 ParticleArrayType
const *
const mParticles;
687 bool const mHasUniformRadius;
688 ScalarType mUniformRadiusSqr;
698 template<
typename Po
intIndexGr
idType>
699 template<
typename ParticleArrayType>
702 const ParticleArrayType& particles,
double minVoxelSize,
size_t maxLevels)
706 typedef typename SplittableParticleArray::Ptr SplittableParticleArrayPtr;
707 typedef typename ParticleArrayType::ScalarType ScalarType;
712 tbb::parallel_reduce(tbb::blocked_range<size_t>(0, particles.size()), extremas);
713 const double firstMin = extremas.
minRadius;
714 const double firstMax = extremas.
maxRadius;
715 const double firstVoxelSize =
std::max(minVoxelSize, firstMin);
717 if (!(firstMax < (firstVoxelSize *
double(2.0))) && maxLevels > 1) {
719 std::vector<SplittableParticleArrayPtr> levels;
720 levels.push_back(SplittableParticleArrayPtr(
721 new SplittableParticleArray(particles, firstMin, firstMax)));
723 std::vector<double> voxelSizeArray;
724 voxelSizeArray.push_back(firstVoxelSize);
726 for (
size_t n = 0; n < maxLevels; ++n) {
728 const double maxParticleRadius = double(levels.back()->maxRadius());
729 const double particleRadiusLimit = voxelSizeArray.back() * double(2.0);
730 if (maxParticleRadius < particleRadiusLimit)
break;
732 SplittableParticleArrayPtr newLevel = levels.back()->split(ScalarType(particleRadiusLimit));
733 if (!newLevel)
break;
735 levels.push_back(newLevel);
736 voxelSizeArray.push_back(
double(newLevel->minRadius()));
739 size_t numPoints = 0;
741 typedef typename PointIndexGridType::TreeType PointIndexTreeType;
742 typedef typename PointIndexTreeType::LeafNodeType PointIndexLeafNodeType;
744 std::vector<PointIndexLeafNodeType*> nodes;
746 for (
size_t n = 0, N = levels.size(); n < N; ++n) {
748 const SplittableParticleArray& particleArray = *levels[n];
750 numPoints += particleArray.size();
752 mMinRadiusArray.push_back(
double(particleArray.minRadius()));
753 mMaxRadiusArray.push_back(
double(particleArray.maxRadius()));
755 PointIndexGridPtr grid = createPointIndexGrid<PointIndexGridType>(particleArray, voxelSizeArray[n]);
758 grid->tree().getNodes(nodes);
760 tbb::parallel_for(tbb::blocked_range<size_t>(0, nodes.size()),
762 (particleArray, nodes));
764 mIndexGridArray.push_back(grid);
768 mMinRadiusArray.push_back(firstMin);
769 mMaxRadiusArray.push_back(firstMax);
770 mIndexGridArray.push_back(
771 createPointIndexGrid<PointIndexGridType>(particles, firstVoxelSize));
776 template<
typename Po
intIndexGr
idType>
777 template<
typename ParticleArrayType>
780 const ParticleArrayType& particles,
double minVoxelSize,
size_t maxLevels)
783 ret->construct(particles, minVoxelSize, maxLevels);
792 template<
typename Po
intIndexGr
idType>
799 , mIter(mRangeList.begin())
802 , mAccessorListSize(atlas.levels())
804 if (mAccessorListSize > 0) {
806 for (
size_t n = 0, N = mAccessorListSize; n < N; ++n) {
813 template<
typename Po
intIndexGr
idType>
817 mIter = mRangeList.begin();
818 if (!mRangeList.empty()) {
819 mRange = mRangeList.front();
820 }
else if (mIndexArray) {
821 mRange.first = mIndexArray.get();
822 mRange.second = mRange.first + mIndexArraySize;
824 mRange.first =
static_cast<IndexType*
>(NULL);
825 mRange.second =
static_cast<IndexType*
>(NULL);
830 template<
typename Po
intIndexGr
idType>
835 if (mRange.first >= mRange.second && mIter != mRangeList.end()) {
837 if (mIter != mRangeList.end()) {
839 }
else if (mIndexArray) {
840 mRange.first = mIndexArray.get();
841 mRange.second = mRange.first + mIndexArraySize;
847 template<
typename Po
intIndexGr
idType>
851 if (!this->
test())
return false;
857 template<
typename Po
intIndexGr
idType>
862 typename RangeDeque::const_iterator it =
863 mRangeList.begin(), end = mRangeList.end();
865 for ( ; it != end; ++it) {
866 count += it->second - it->first;
869 return count + mIndexArraySize;
873 template<
typename Po
intIndexGr
idType>
877 mRange.first =
static_cast<IndexType*
>(NULL);
878 mRange.second =
static_cast<IndexType*
>(NULL);
880 mIter = mRangeList.end();
886 template<
typename Po
intIndexGr
idType>
890 typedef typename PointIndexGridType::TreeType
TreeType;
891 typedef typename TreeType::LeafNodeType LeafNodeType;
895 if (mAccessorListSize > 0) {
896 const size_t levelIdx =
std::min(mAccessorListSize - 1, level);
901 std::vector<const LeafNodeType*> nodes;
902 tree.getNodes(nodes);
904 for (
size_t n = 0, N = nodes.size(); n < N; ++n) {
906 const LeafNodeType& node = *nodes[n];
907 const size_t numIndices = node.indices().size();
909 if (numIndices > 0) {
910 const IndexType* begin = &node.indices().front();
911 mRangeList.push_back(Range(begin, (begin + numIndices)));
920 template<
typename Po
intIndexGr
idType>
921 template<
typename ParticleArrayType>
924 const Vec3d& center,
double radius,
const ParticleArrayType& particles)
926 typedef typename ParticleArrayType::PosType PosType;
927 typedef typename ParticleArrayType::ScalarType ScalarType;
933 std::deque<IndexType> filteredIndices;
934 std::vector<CoordBBox> searchRegions;
936 const double iRadius = radius * double(1.0 / std::sqrt(3.0));
938 const Vec3d ibMin(center[0] - iRadius, center[1] - iRadius, center[2] - iRadius);
939 const Vec3d ibMax(center[0] + iRadius, center[1] + iRadius, center[2] + iRadius);
941 const Vec3d bMin(center[0] - radius, center[1] - radius, center[2] - radius);
942 const Vec3d bMax(center[0] + radius, center[1] + radius, center[2] + radius);
944 const PosType pos = PosType(center);
945 const ScalarType dist = ScalarType(radius);
947 for (
size_t n = 0, N = mAccessorListSize; n < N; ++n) {
952 const openvdb::math::Transform& xform = mAtlas->
pointIndexGrid(n).transform();
956 openvdb::CoordBBox inscribedRegion(
957 xform.worldToIndexCellCentered(ibMin),
958 xform.worldToIndexCellCentered(ibMax));
960 inscribedRegion.expand(-1);
965 searchRegions.clear();
967 const openvdb::CoordBBox region(
968 xform.worldToIndexCellCentered(bMin - maxRadius),
969 xform.worldToIndexCellCentered(bMax + maxRadius));
971 inscribedRegion.expand(1);
975 FilterType filter(mRangeList, filteredIndices, pos, dist, particles, uniformRadius);
977 for (
size_t i = 0, I = searchRegions.size(); i < I; ++i) {
988 template<
typename Po
intIndexGr
idType>
989 template<
typename ParticleArrayType>
992 const BBoxd& bbox,
const ParticleArrayType& particles)
994 typedef typename ParticleArrayType::PosType PosType;
995 typedef typename ParticleArrayType::ScalarType ScalarType;
1001 std::deque<IndexType> filteredIndices;
1002 std::vector<CoordBBox> searchRegions;
1004 for (
size_t n = 0, N = mAccessorListSize; n < N; ++n) {
1008 const openvdb::math::Transform& xform = mAtlas->
pointIndexGrid(n).transform();
1012 openvdb::CoordBBox inscribedRegion(
1013 xform.worldToIndexCellCentered(bbox.
min()),
1014 xform.worldToIndexCellCentered(bbox.
max()));
1016 inscribedRegion.expand(-1);
1021 searchRegions.clear();
1023 const openvdb::CoordBBox region(
1024 xform.worldToIndexCellCentered(bbox.
min() -
maxRadius),
1025 xform.worldToIndexCellCentered(bbox.
max() +
maxRadius));
1027 inscribedRegion.expand(1);
1031 FilterType filter(mRangeList, filteredIndices, bbox, particles, uniformRadius);
1033 for (
size_t i = 0, I = searchRegions.size(); i < I; ++i) {
1048 #endif // OPENVDB_TOOLS_PARTICLE_ATLAS_HAS_BEEN_INCLUDED void getRadius(size_t n, ScalarType &radius) const
Definition: ParticleAtlas.h:338
bool empty() const
true if the container size is 0, false otherwise.
Definition: ParticleAtlas.h:139
size_t levels() const
Returns the number of resolution levels.
Definition: ParticleAtlas.h:137
ComputeExtremas(ComputeExtremas &rhs, tbb::split)
Definition: ParticleAtlas.h:279
std::pair< const IndexT *, const IndexT * > Range
Definition: ParticleAtlas.h:491
PosType::value_type ScalarType
Definition: ParticleAtlas.h:270
void reset()
Reset the iterator to point to the first item.
Definition: ParticleAtlas.h:815
boost::shared_ptr< const SplittableParticleArray > ConstPtr
Definition: ParticleAtlas.h:314
ParticleArray::PosType PosType
Definition: ParticleAtlas.h:317
Space-partitioning acceleration structure for points. Partitions the points into voxels to accelerate...
SplittableParticleArray(const ParticleArrayT &particles, double minR, double maxR)
Definition: ParticleAtlas.h:326
ComputeExtremas(const ParticleArrayT &particles)
Definition: ParticleAtlas.h:272
const IndexType & operator*() const
Return a const reference to the item to which this iterator is pointing.
Definition: ParticleAtlas.h:210
void filterLeafNode(const LeafNodeType &leaf)
Definition: ParticleAtlas.h:600
boost::shared_ptr< ParticleAtlas > Ptr
Definition: ParticleAtlas.h:108
bool operator==(const Iterator &p) const
Return true if both iterators point to the same element.
Definition: ParticleAtlas.h:232
ParticleArrayType const *const mParticles
Definition: ParticleAtlas.h:480
ScalarType minRadius() const
Definition: ParticleAtlas.h:340
std::deque< IndexT > IndexDeque
Definition: ParticleAtlas.h:493
std::deque< Range > RangeDeque
Definition: ParticleAtlas.h:580
RadialRangeFilter(RangeDeque &ranges, IndexDeque &indices, const PosType &xyz, ScalarType radius, const ParticleArrayType &particles, bool hasUniformRadius=false)
Definition: ParticleAtlas.h:495
Definition: ParticleAtlas.h:268
void increment()
Advance iterator to next item.
Definition: ParticleAtlas.h:832
ParticleArrayType::PosType PosType
Definition: ParticleAtlas.h:576
size_t levels() const
Returns the total number of resolution levels.
Definition: ParticleAtlas.h:200
void filterVoxel(const Coord &, const IndexT *begin, const IndexT *end)
Definition: ParticleAtlas.h:522
void updateFromLevel(size_t level)
Clear the iterator and update it with all particles that reside at the given resolution level...
Definition: ParticleAtlas.h:888
Definition: ParticleAtlas.h:486
bool operator!=(const Iterator &p) const
Definition: ParticleAtlas.h:233
bool isApproxEqual(const Type &a, const Type &b)
Return true if a is equal to b to within the default floating-point comparison tolerance.
Definition: Math.h:370
PosType::value_type ScalarType
Definition: ParticleAtlas.h:489
Selectively extract and filter point data using a custom filter operator.
Definition: ParticleAtlas.h:453
ParticleArrayT ParticleArray
Definition: ParticleAtlas.h:315
boost::shared_ptr< const ParticleAtlas > ConstPtr
Definition: ParticleAtlas.h:109
double maxRadius(size_t n) const
Returns maximum particle radius for level n.
Definition: ParticleAtlas.h:144
#define OPENVDB_VERSION_NAME
Definition: version.h:43
PosType::value_type ScalarType
Definition: ParticleAtlas.h:577
Vec3< double > Vec3d
Definition: Vec3.h:651
bool next()
Advance iterator to next item.
Definition: ParticleAtlas.h:849
void operator()(const tbb::blocked_range< size_t > &range) const
Definition: ParticleAtlas.h:461
std::deque< Range > RangeDeque
Definition: ParticleAtlas.h:492
const ParticleArrayT & particleArray() const
Definition: ParticleAtlas.h:333
Provides accelerated range and nearest-neighbor searches for particles that are partitioned using the...
Definition: ParticleAtlas.h:173
boost::scoped_ptr< ConstAccessor > ConstAccessorPtr
Definition: ParticleAtlas.h:177
ParticleArrayT::PosType PosType
Definition: ParticleAtlas.h:269
Definition: Exceptions.h:39
ScalarType minRadius
Definition: ParticleAtlas.h:306
size_t size() const
Definition: ParticleAtlas.h:335
boost::shared_ptr< SplittableParticleArray > Ptr
Definition: ParticleAtlas.h:313
size_t size() const
Return the number of point indices in the iterator range.
Definition: ParticleAtlas.h:859
ParticleArrayT const *const particleArray
Definition: ParticleAtlas.h:305
PointIndexGridType::Ptr PointIndexGridPtr
Definition: ParticleAtlas.h:111
ScalarType maxRadius
Definition: ParticleAtlas.h:306
Definition: ParticleAtlas.h:574
ParticleArrayType::PosType PosType
Definition: ParticleAtlas.h:488
void join(const ComputeExtremas &rhs)
Definition: ParticleAtlas.h:300
void getPos(size_t n, PosType &xyz) const
Definition: ParticleAtlas.h:337
size_t getGlobalIndex(size_t n) const
Definition: ParticleAtlas.h:343
RemapIndices(const ParticleArrayType &particles, std::vector< PointIndexLeafNodeType * > nodes)
Definition: ParticleAtlas.h:455
Ptr split(ScalarType maxRadiusLimit)
Definition: ParticleAtlas.h:347
bool test() const
Return true if this iterator is not yet exhausted.
Definition: ParticleAtlas.h:214
tree::ValueAccessor< const TreeType > ConstAccessor
Definition: ParticleAtlas.h:176
std::deque< IndexT > IndexDeque
Definition: ParticleAtlas.h:581
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:450
void filterLeafNode(const LeafNodeType &leaf)
Definition: ParticleAtlas.h:513
Integer wrapper, required to distinguish PointIndexGrid and PointDataGrid from Int32Grid and Int64Gri...
Definition: Types.h:119
const PointIndexGridType & pointIndexGrid(size_t n) const
Returns the PointIndexGrid that represents the given level n.
Definition: ParticleAtlas.h:149
void filterVoxel(const Coord &, const IndexT *begin, const IndexT *end)
Definition: ParticleAtlas.h:609
Definition: ParticleAtlas.h:106
ScalarType maxRadius() const
Definition: ParticleAtlas.h:341
PointIndexGridType::ValueType IndexType
Definition: ParticleAtlas.h:112
ParticleAtlas()
Definition: ParticleAtlas.h:118
PointIndexLeafNodeType *const *const mNodes
Definition: ParticleAtlas.h:481
BBoxFilter(RangeDeque &ranges, IndexDeque &indices, const BBoxd &bbox, const ParticleArrayType &particles, bool hasUniformRadius=false)
Definition: ParticleAtlas.h:583
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71
void operator()(const tbb::blocked_range< size_t > &range)
Definition: ParticleAtlas.h:286
PointIndexGridType & pointIndexGrid(size_t n)
Returns the PointIndexGrid that represents the given level n.
Definition: ParticleAtlas.h:147
const Vec3T & min() const
Return a const reference to the minimum point of the BBox.
Definition: BBox.h:81
void worldSpaceSearchAndUpdate(const Vec3d ¢er, double radius, const ParticleArrayType &particles)
Clear the iterator and update it with the result of the given world-space radial query.
Definition: ParticleAtlas.h:923
PointIndexGridType::TreeType TreeType
Definition: ParticleAtlas.h:175
std::pair< const IndexT *, const IndexT * > Range
Definition: ParticleAtlas.h:579
const Vec3T & max() const
Return a const reference to the maximum point of the BBox.
Definition: BBox.h:84
SplittableParticleArray(const ParticleArrayT &particles)
Definition: ParticleAtlas.h:320
Definition: ParticleAtlas.h:311
double minRadius(size_t n) const
Returns minimum particle radius for level n.
Definition: ParticleAtlas.h:142
PosType::value_type ScalarType
Definition: ParticleAtlas.h:318
void operator++()
Advance iterator to next item.
Definition: ParticleAtlas.h:222