89 #ifndef OPENVDB_TOOLS_PARTICLES_TO_LEVELSET_HAS_BEEN_INCLUDED 90 #define OPENVDB_TOOLS_PARTICLES_TO_LEVELSET_HAS_BEEN_INCLUDED 92 #include <tbb/parallel_reduce.h> 93 #include <tbb/blocked_range.h> 105 #include <functional> 107 #include <type_traits> 120 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
121 inline void particlesToSdf(
const ParticleListT&, GridT&, InterrupterT* =
nullptr);
127 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
128 inline void particlesToSdf(
const ParticleListT&, GridT&,
Real radius, InterrupterT* =
nullptr);
137 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
144 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
145 inline void particlesToMask(
const ParticleListT&, GridT&, InterrupterT* =
nullptr);
151 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
152 inline void particlesToMask(
const ParticleListT&, GridT&,
Real radius, InterrupterT* =
nullptr);
161 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
168 namespace p2ls_internal {
173 template<
typename VisibleT,
typename BlindT>
class BlindData;
177 template<
typename SdfGridT,
178 typename AttributeT = void,
183 using DisableT =
typename std::is_void<AttributeT>::type;
189 using AttType =
typename std::conditional<DisableT::value, size_t, AttributeT>::type;
190 using AttGridType =
typename SdfGridT::template ValueConverter<AttType>::Type;
192 static const bool OutputIsMask = std::is_same<SdfType, bool>::value;
224 void finalize(
bool prune =
false);
264 template<
typename ParticleListT>
265 void rasterizeSpheres(
const ParticleListT& pa);
273 template<
typename ParticleListT>
274 void rasterizeSpheres(
const ParticleListT& pa,
Real radius);
291 template<
typename ParticleListT>
292 void rasterizeTrails(
const ParticleListT& pa,
Real delta=1.0);
295 using BlindType = p2ls_internal::BlindData<SdfType, AttType>;
296 using BlindGridType =
typename SdfGridT::template ValueConverter<BlindType>::Type;
299 template<
typename ParticleListT,
typename Gr
idT>
struct Raster;
301 SdfGridType* mSdfGrid;
302 typename AttGridType::Ptr mAttGrid;
303 BlindGridType* mBlindGrid;
304 InterrupterT* mInterrupter;
305 Real mDx, mHalfWidth;
307 size_t mMinCount, mMaxCount;
312 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
313 inline ParticlesToLevelSet<SdfGridT, AttributeT, InterrupterT>::
314 ParticlesToLevelSet(SdfGridT& grid, InterrupterT* interrupter) :
317 mInterrupter(interrupter),
318 mDx(grid.voxelSize()[0]),
319 mHalfWidth(grid.background()/mDx),
326 if (!mSdfGrid->hasUniformVoxels()) {
329 if (!DisableT::value) {
330 mBlindGrid =
new BlindGridType(BlindType(grid.background()));
331 mBlindGrid->setTransform(mSdfGrid->transform().copy());
335 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
336 template<
typename ParticleListT>
340 if (DisableT::value) {
341 Raster<ParticleListT, SdfGridT> r(*
this, mSdfGrid, pa);
342 r.rasterizeSpheres();
344 Raster<ParticleListT, BlindGridType> r(*
this, mBlindGrid, pa);
345 r.rasterizeSpheres();
349 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
350 template<
typename ParticleListT>
354 if (DisableT::value) {
355 Raster<ParticleListT, SdfGridT> r(*
this, mSdfGrid, pa);
356 r.rasterizeSpheres(radius/mDx);
358 Raster<ParticleListT, BlindGridType> r(*
this, mBlindGrid, pa);
359 r.rasterizeSpheres(radius/mDx);
363 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
364 template<
typename ParticleListT>
368 if (DisableT::value) {
369 Raster<ParticleListT, SdfGridT> r(*
this, mSdfGrid, pa);
370 r.rasterizeTrails(delta);
372 Raster<ParticleListT, BlindGridType> r(*
this, mBlindGrid, pa);
373 r.rasterizeTrails(delta);
378 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
397 using AttTreeT =
typename AttGridType::TreeType;
398 using AttLeafT =
typename AttTreeT::LeafNodeType;
399 using BlindTreeT =
typename BlindGridType::TreeType;
400 using BlindLeafIterT =
typename BlindTreeT::LeafCIter;
401 using BlindLeafT =
typename BlindTreeT::LeafNodeType;
402 using SdfTreeT =
typename SdfGridType::TreeType;
403 using SdfLeafT =
typename SdfTreeT::LeafNodeType;
406 const BlindTreeT& blindTree = mBlindGrid->tree();
409 typename AttTreeT::Ptr attTree(
new AttTreeT(
412 mAttGrid =
typename AttGridType::Ptr(
new AttGridType(attTree));
413 mAttGrid->setTransform(mBlindGrid->transform().copy());
415 typename SdfTreeT::Ptr sdfTree;
419 sdfTree.reset(
new SdfTreeT(blindTree,
424 leafNodes.
foreach([&](AttLeafT& attLeaf,
size_t ) {
425 if (
const auto* blindLeaf = blindTree.probeConstLeaf(attLeaf.origin())) {
426 for (
auto iter = attLeaf.beginValueOn(); iter; ++iter) {
427 const auto pos = iter.pos();
428 attLeaf.setValueOnly(pos, blindLeaf->getValue(pos).blind());
433 const auto blindAcc = mBlindGrid->getConstAccessor();
434 auto iter = attTree->beginValueOn();
435 iter.setMaxDepth(AttTreeT::ValueOnIter::LEAF_DEPTH - 1);
436 for ( ; iter; ++iter) {
437 iter.modifyValue([&](
AttType& v) { v = blindAcc.getValue(iter.getCoord()).blind(); });
442 sdfTree.reset(
new SdfTreeT(blindTree, blindTree.background().visible(),
TopologyCopy()));
443 for (BlindLeafIterT n = blindTree.cbeginLeaf(); n; ++n) {
444 const BlindLeafT& leaf = *n;
447 SdfLeafT* sdfLeaf = sdfTree->probeLeaf(xyz);
448 AttLeafT* attLeaf = attTree->probeLeaf(xyz);
450 typename BlindLeafT::ValueOnCIter m=leaf.cbeginValueOn();
453 const BlindType& v = leaf.getValue(k);
454 sdfLeaf->setValueOnly(k, v.visible());
455 attLeaf->setValueOnly(k, v.blind());
460 const BlindType& v = *m;
461 sdfLeaf->setValueOnly(k, v.visible());
462 attLeaf->setValueOnly(k, v.blind());
469 if (mSdfGrid->empty()) {
470 mSdfGrid->setTree(sdfTree);
473 mSdfGrid->tree().topologyUnion(*sdfTree);
487 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
488 template<
typename ParticleListT,
typename Gr
idT>
491 using DisableT =
typename std::is_void<AttributeT>::type;
493 using SdfT =
typename ParticlesToLevelSetT::SdfType;
494 using AttT =
typename ParticlesToLevelSetT::AttType;
495 using ValueT =
typename GridT::ValueType;
496 using AccessorT =
typename GridT::Accessor;
497 using TreeT =
typename GridT::TreeType;
498 using LeafNodeT =
typename TreeT::LeafNodeType;
503 DoAttrXfer = !DisableT::value;
506 Raster(ParticlesToLevelSetT& parent, GridT* grid,
const ParticleListT& particles)
508 , mParticles(particles)
510 , mMap(*(mGrid->transform().baseMap()))
515 mPointPartitioner =
new PointPartitionerT;
516 mPointPartitioner->construct(particles, mGrid->transform());
520 Raster(Raster& other, tbb::split)
521 : mParent(other.mParent)
522 , mParticles(other.mParticles)
529 , mPointPartitioner(other.mPointPartitioner)
541 delete mPointPartitioner;
547 mMinCount = mMaxCount = 0;
548 if (mParent.mInterrupter) {
549 mParent.mInterrupter->start(
"Rasterizing particles to level set using spheres");
551 mTask = std::bind(&Raster::rasterSpheres, std::placeholders::_1, std::placeholders::_2);
553 if (mParent.mInterrupter) mParent.mInterrupter->end();
558 mMinCount = radius < mParent.mRmin ? mParticles.size() : 0;
559 mMaxCount = radius > mParent.mRmax ? mParticles.size() : 0;
560 if (mMinCount>0 || mMaxCount>0) {
561 mParent.mMinCount = mMinCount;
562 mParent.mMaxCount = mMaxCount;
564 if (mParent.mInterrupter) {
565 mParent.mInterrupter->start(
566 "Rasterizing particles to level set using const spheres");
568 mTask = std::bind(&Raster::rasterFixedSpheres,
569 std::placeholders::_1, std::placeholders::_2, radius);
571 if (mParent.mInterrupter) mParent.mInterrupter->end();
577 mMinCount = mMaxCount = 0;
578 if (mParent.mInterrupter) {
579 mParent.mInterrupter->start(
"Rasterizing particles to level set using trails");
581 mTask = std::bind(&Raster::rasterTrails,
582 std::placeholders::_1, std::placeholders::_2, delta);
584 if (mParent.mInterrupter) mParent.mInterrupter->end();
588 void operator()(
const tbb::blocked_range<size_t>& r)
592 mParent.mMinCount = mMinCount;
593 mParent.mMaxCount = mMaxCount;
597 void join(Raster& other)
604 mGrid->topologyUnion(*other.mGrid);
610 mMinCount += other.mMinCount;
611 mMaxCount += other.mMaxCount;
616 Raster& operator=(
const Raster&) {
return *
this; }
619 bool ignoreParticle(
Real R)
621 if (R < mParent.mRmin) {
625 if (R > mParent.mRmax) {
634 void rasterSpheres(
const tbb::blocked_range<size_t>& r)
636 AccessorT acc = mGrid->getAccessor();
638 const Real invDx = 1 / mParent.mDx;
644 for (
size_t n = r.begin(), N = r.end(); n < N; ++n) {
646 typename PointPartitionerT::IndexIterator iter = mPointPartitioner->indices(n);
647 for ( ; run && iter; ++iter) {
649 mParticles.getPosRad(
id, pos, rad);
650 const Real R = invDx * rad;
651 if (this->ignoreParticle(R))
continue;
652 const Vec3R P = mMap.applyInverseMap(pos);
653 this->getAtt<DisableT>(
id, att);
654 run = this->makeSphere(P, R, att, acc);
662 void rasterFixedSpheres(
const tbb::blocked_range<size_t>& r,
Real R)
664 AccessorT acc = mGrid->getAccessor();
669 for (
size_t n = r.begin(), N = r.end(); n < N; ++n) {
671 for (
auto iter = mPointPartitioner->indices(n); iter; ++iter) {
673 this->getAtt<DisableT>(
id, att);
674 mParticles.getPos(
id, pos);
675 const Vec3R P = mMap.applyInverseMap(pos);
676 this->makeSphere(P, R, att, acc);
684 void rasterTrails(
const tbb::blocked_range<size_t>& r,
Real delta)
686 AccessorT acc = mGrid->getAccessor();
691 const Vec3R origin = mMap.applyInverseMap(
Vec3R(0,0,0));
692 const Real Rmin = mParent.mRmin, invDx = 1 / mParent.mDx;
695 for (
size_t n = r.begin(), N = r.end(); n < N; ++n) {
697 typename PointPartitionerT::IndexIterator iter = mPointPartitioner->indices(n);
698 for ( ; run && iter; ++iter) {
700 mParticles.getPosRadVel(
id, pos, rad, vel);
701 const Real R0 = invDx * rad;
702 if (this->ignoreParticle(R0))
continue;
703 this->getAtt<DisableT>(
id, att);
704 const Vec3R P0 = mMap.applyInverseMap(pos);
705 const Vec3R V = mMap.applyInverseMap(vel) - origin;
706 const Real speed = V.length(), invSpeed = 1.0 / speed;
707 const Vec3R Nrml = -V * invSpeed;
710 for (
size_t m = 0; run && d <= speed ; ++m) {
711 run = this->makeSphere(P, R, att, acc);
712 P += 0.5 * delta * R * Nrml;
713 d = (P - P0).length();
714 R = R0 - (R0 - Rmin) * d * invSpeed;
725 if (mParent.mGrainSize>0) {
726 tbb::parallel_reduce(
727 tbb::blocked_range<size_t>(0, bucketCount, mParent.mGrainSize), *
this);
729 (*this)(tbb::blocked_range<size_t>(0, bucketCount));
740 bool makeSphere(
const Vec3R& P,
Real R,
const AttT& att, AccessorT& acc)
744 return makeSphereMask(P, R, att, acc);
746 return makeNarrowBandSphere(P, R, att, acc);
765 bool makeNarrowBandSphere(
const Vec3R& P,
Real R,
const AttT& att, AccessorT& acc)
769 w = mParent.mHalfWidth,
777 const ValueT inside = -mGrid->background();
781 for (Coord c = lo; c.x() <= hi.x(); ++c.x()) {
784 tbb::task::self().cancel_group_execution();
788 for (c.y() = lo.y(); c.y() <= hi.y(); ++c.y()) {
790 for (c.z() = lo.z(); c.z() <= hi.z(); ++c.z()) {
792 if (x2y2z2 >= max2 || (!acc.probeValue(c, v) && (v < ValueT(0))))
794 if (x2y2z2 <= min2) {
795 acc.setValueOff(c, inside);
800 const ValueT d = Merge(static_cast<SdfT>(dx*(
math::Sqrt(x2y2z2)-R)), att);
801 if (d < v) acc.setValue(c, d);
810 bool makeSphereMask(
const Vec3R& p,
Real r,
const AttT& att, AccessorT& acc)
824 const std::vector<CoordBBox> padding{
825 CoordBBox(outLo.x(), outLo.y(), outLo.z(), inLo.x()-1, outHi.y(), outHi.z()),
826 CoordBBox(inHi.x()+1, outLo.y(), outLo.z(), outHi.x(), outHi.y(), outHi.z()),
827 CoordBBox(outLo.x(), outLo.y(), outLo.z(), outHi.x(), inLo.y()-1, outHi.z()),
828 CoordBBox(outLo.x(), inHi.y()+1, outLo.z(), outHi.x(), outHi.y(), outHi.z()),
829 CoordBBox(outLo.x(), outLo.y(), outLo.z(), outHi.x(), outHi.y(), inLo.z()-1),
830 CoordBBox(outLo.x(), outLo.y(), inHi.z()+1, outHi.x(), outHi.y(), outHi.z()),
832 const ValueT onValue = Merge(SdfT(1), att);
836 acc.tree().sparseFill(CoordBBox(inLo, inHi), onValue);
839 for (
const auto& bbox: padding) {
841 tbb::task::self().cancel_group_execution();
844 const Coord &bmin = bbox.min(), &bmax = bbox.max();
847 for (c = bmin, cx = c.x(); c.x() <= bmax.x(); ++c.x(), cx += 1) {
849 for (c.y() = bmin.y(), cy = c.y(); c.y() <= bmax.y(); ++c.y(), cy += 1) {
851 for (c.z() = bmin.z(), cz = c.z(); c.z() <= bmax.z(); ++c.z(), cz += 1) {
853 if (x2y2z2 < rSquared) {
854 acc.setValue(c, onValue);
863 using FuncType =
typename std::function<void (Raster*,
const tbb::blocked_range<size_t>&)>;
865 template<
typename DisableType>
866 typename std::enable_if<DisableType::value>::type
867 getAtt(
size_t, AttT&)
const {}
869 template<
typename DisableType>
870 typename std::enable_if<!DisableType::value>::type
871 getAtt(
size_t n, AttT& a)
const { mParticles.getAtt(n, a); }
874 typename std::enable_if<std::is_same<T, ValueT>::value, ValueT>::type
875 Merge(T s,
const AttT&)
const {
return s; }
878 typename std::enable_if<!std::is_same<T, ValueT>::value, ValueT>::type
879 Merge(T s,
const AttT& a)
const {
return ValueT(s,a); }
881 ParticlesToLevelSetT& mParent;
882 const ParticleListT& mParticles;
884 const math::MapBase& mMap;
885 size_t mMinCount, mMaxCount;
888 PointPartitionerT* mPointPartitioner;
895 namespace p2ls_internal {
901 template<
typename VisibleT,
typename BlindT>
905 using type = VisibleT;
906 using VisibleType = VisibleT;
907 using BlindType = BlindT;
910 explicit BlindData(VisibleT v) : mVisible(v), mBlind(
zeroVal<BlindType>()) {}
911 BlindData(VisibleT v, BlindT b) : mVisible(v), mBlind(b) {}
912 BlindData(
const BlindData&) =
default;
913 BlindData& operator=(
const BlindData&) =
default;
914 const VisibleT& visible()
const {
return mVisible; }
915 const BlindT& blind()
const {
return mBlind; }
917 bool operator==(
const BlindData& rhs)
const {
return mVisible == rhs.mVisible; }
919 bool operator< (
const BlindData& rhs)
const {
return mVisible < rhs.mVisible; }
920 bool operator> (
const BlindData& rhs)
const {
return mVisible > rhs.mVisible; }
921 BlindData
operator+(
const BlindData& rhs)
const {
return BlindData(mVisible + rhs.mVisible); }
922 BlindData
operator+(
const VisibleT& rhs)
const {
return BlindData(mVisible + rhs); }
923 BlindData
operator-(
const BlindData& rhs)
const {
return BlindData(mVisible - rhs.mVisible); }
924 BlindData
operator-()
const {
return BlindData(-mVisible, mBlind); }
933 template<
typename VisibleT,
typename BlindT>
934 inline std::ostream&
operator<<(std::ostream& ostr,
const BlindData<VisibleT, BlindT>& rhs)
936 ostr << rhs.visible();
942 template<
typename VisibleT,
typename BlindT>
943 inline BlindData<VisibleT, BlindT>
Abs(
const BlindData<VisibleT, BlindT>& x)
945 return BlindData<VisibleT, BlindT>(
math::Abs(x.visible()), x.blind());
956 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT>
960 static_assert(std::is_floating_point<typename GridT::ValueType>::value,
961 "particlesToSdf requires an SDF grid with floating-point values");
965 " try Grid::setGridClass(openvdb::GRID_LEVEL_SET)");
973 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT>
977 static_assert(std::is_floating_point<typename GridT::ValueType>::value,
978 "particlesToSdf requires an SDF grid with floating-point values");
982 " try Grid::setGridClass(openvdb::GRID_LEVEL_SET)");
990 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT>
994 static_assert(std::is_floating_point<typename GridT::ValueType>::value,
995 "particleTrailsToSdf requires an SDF grid with floating-point values");
999 " try Grid::setGridClass(openvdb::GRID_LEVEL_SET)");
1007 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT>
1011 static_assert(std::is_same<bool, typename GridT::ValueType>::value,
1012 "particlesToMask requires a boolean-valued grid");
1018 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT>
1022 static_assert(std::is_same<bool, typename GridT::ValueType>::value,
1023 "particlesToMask requires a boolean-valued grid");
1029 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT>
1033 static_assert(std::is_same<bool, typename GridT::ValueType>::value,
1034 "particleTrailsToMask requires a boolean-valued grid");
1044 #endif // OPENVDB_TOOLS_PARTICLES_TO_LEVELSET_HAS_BEEN_INCLUDED std::ostream & operator<<(std::ostream &ostr, const Metadata &metadata)
Write a Metadata to an output stream.
Definition: Metadata.h:401
math::Vec3< Real > Vec3R
Definition: Types.h:79
Definition: Exceptions.h:90
int Ceil(float x)
Return the ceiling of x.
Definition: Math.h:810
typename SdfGridT::ValueType SdfType
Definition: ParticlesToLevelSet.h:187
Index32 Index
Definition: Types.h:61
Real getVoxelSize() const
Return the size of a voxel in world units.
Definition: ParticlesToLevelSet.h:232
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
size_t getMaxCount() const
Return the number of particles that were ignored because they were larger than the maximum radius.
Definition: ParticlesToLevelSet.h:254
void setRmin(Real Rmin)
Set the smallest radius allowed in voxel units.
Definition: ParticlesToLevelSet.h:240
float Sqrt(float x)
Return the square root of a floating-point value.
Definition: Math.h:715
Functions to efficiently perform various compositing operations on grids.
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:109
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:518
bool wasInterrupted(T *i, int percent=-1)
Definition: NullInterrupter.h:76
typename SdfGridT::template ValueConverter< AttType >::Type AttGridType
Definition: ParticlesToLevelSet.h:190
void setGrainSize(int grainSize)
Set the grain size used for threading.
Definition: ParticlesToLevelSet.h:260
bool ignoredParticles() const
Return true if any particles were ignored due to their size.
Definition: ParticlesToLevelSet.h:248
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:51
static const bool OutputIsMask
Definition: ParticlesToLevelSet.h:192
int Floor(float x)
Return the floor of x.
Definition: Math.h:802
Vec3< typename promote< T, Coord::ValueType >::type > operator-(const Vec3< T > &v0, const Coord &v1)
Allow a Coord to be subtracted from a Vec3.
Definition: Coord.h:549
T zeroVal()
Return the value of type T that corresponds to zero.
Definition: Math.h:86
bool operator<(const Tuple< SIZE, T0 > &t0, const Tuple< SIZE, T1 > &t1)
Definition: Tuple.h:207
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:515
Spatially partitions points using a parallel radix-based sorting algorithm.
Defined various multi-threaded utility functions for trees.
uint32_t Index32
Definition: Types.h:59
typename std::is_void< AttributeT >::type DisableT
Definition: ParticlesToLevelSet.h:183
std::string operator+(const std::string &s, bool)
Needed to support the (zeroVal<ValueType>() + val) idiom when ValueType is std::string.
Definition: Math.h:96
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:488
typename std::conditional< DisableT::value, size_t, AttributeT >::type AttType
Definition: ParticlesToLevelSet.h:189
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:136
Real getHalfWidth() const
Return the half-width of the narrow band in voxel units.
Definition: ParticlesToLevelSet.h:235
Real getRmax() const
Return the largest radius allowed in voxel units.
Definition: ParticlesToLevelSet.h:243
AttGridType::Ptr attributeGrid()
Return a pointer to the grid containing the optional user-defined attribute.
Definition: ParticlesToLevelSet.h:229
#define OPENVDB_LOG_WARN(message)
Log a warning message of the form 'someVar << "some text" << ...'.
Definition: logging.h:280
Propagate the signs of distance values from the active voxels in the narrow band to the inactive valu...
void finalize(bool prune=false)
This method syncs up the level set and attribute grids and therefore needs to be called before any of...
Definition: ParticlesToLevelSet.h:380
void rasterizeTrails(const ParticleListT &pa, Real delta=1.0)
Rasterize each particle as a trail comprising the CSG union of spheres of decreasing radius.
Definition: ParticlesToLevelSet.h:366
Real getRmin() const
Return the smallest radius allowed in voxel units.
Definition: ParticlesToLevelSet.h:238
Definition: Exceptions.h:40
size_t getMinCount() const
Return the number of particles that were ignored because they were smaller than the minimum radius.
Definition: ParticlesToLevelSet.h:251
#define OPENVDB_NO_FP_EQUALITY_WARNING_END
Definition: Math.h:75
This class manages a linear array of pointers to a given tree's leaf nodes, as well as optional auxil...
Definition: LeafManager.h:110
const Type & Max(const Type &a, const Type &b)
Return the maximum of two values.
Definition: Math.h:549
void setRmax(Real Rmax)
Set the largest radius allowed in voxel units.
Definition: ParticlesToLevelSet.h:245
InterrupterT InterrupterType
Definition: ParticlesToLevelSet.h:184
Dummy NOOP interrupter class defining interface.
Definition: NullInterrupter.h:52
void rasterizeSpheres(const ParticleListT &pa)
Rasterize each particle as a sphere with the particle's position and radius.
Definition: ParticlesToLevelSet.h:338
#define OPENVDB_NO_FP_EQUALITY_WARNING_BEGIN
Definition: Math.h:74
Coord Abs(const Coord &xyz)
Definition: Coord.h:513
int getGrainSize() const
Return the grain size used for threading.
Definition: ParticlesToLevelSet.h:257
bool operator>(const Tuple< SIZE, T0 > &t0, const Tuple< SIZE, T1 > &t1)
Definition: Tuple.h:219
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:188
A LeafManager manages a linear array of pointers to a given tree's leaf nodes, as well as optional au...
Definition: ParticlesToLevelSet.h:180
SdfGridT SdfGridType
Definition: ParticlesToLevelSet.h:186
~ParticlesToLevelSet()
Definition: ParticlesToLevelSet.h:214
void foreach(const LeafOp &op, bool threaded=true, size_t grainSize=1)
Threaded method that applies a user-supplied functor to each leaf node in the LeafManager.
Definition: LeafManager.h:524
double Real
Definition: Types.h:67
Type Pow2(Type x)
Return x2.
Definition: Math.h:502