62 #ifndef OPENVDB_TOOLS_PARTICLES_TO_LEVELSET_HAS_BEEN_INCLUDED 63 #define OPENVDB_TOOLS_PARTICLES_TO_LEVELSET_HAS_BEEN_INCLUDED 73 #include <openvdb/thread/Threading.h> 80 #include <tbb/parallel_reduce.h> 81 #include <tbb/blocked_range.h> 85 #include <type_traits> 98 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
99 inline void particlesToSdf(
const ParticleListT&, GridT&, InterrupterT* =
nullptr);
105 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
106 inline void particlesToSdf(
const ParticleListT&, GridT&,
Real radius, InterrupterT* =
nullptr);
115 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
122 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
123 inline void particlesToMask(
const ParticleListT&, GridT&, InterrupterT* =
nullptr);
129 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
130 inline void particlesToMask(
const ParticleListT&, GridT&,
Real radius, InterrupterT* =
nullptr);
139 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT = util::NullInterrupter>
147 namespace p2ls_internal {
152 template<
typename VisibleT,
typename BlindT>
class BlindData;
157 template<
typename SdfGridT,
158 typename AttributeT = void,
159 typename InterrupterT = util::NullInterrupter>
163 using DisableT =
typename std::is_void<AttributeT>::type;
169 using AttType =
typename std::conditional<DisableT::value, size_t, AttributeT>::type;
170 using AttGridType =
typename SdfGridT::template ValueConverter<AttType>::Type;
172 static const bool OutputIsMask = std::is_same<SdfType, bool>::value;
204 void finalize(
bool prune =
false);
244 template<
typename ParticleListT>
253 template<
typename ParticleListT>
271 template<
typename ParticleListT>
272 void rasterizeTrails(
const ParticleListT& pa,
Real delta=1.0);
275 using BlindType = p2ls_internal::BlindData<SdfType, AttType>;
276 using BlindGridType =
typename SdfGridT::template ValueConverter<BlindType>::Type;
279 template<
typename ParticleListT,
typename Gr
idT>
struct Raster;
282 typename AttGridType::Ptr mAttGrid;
283 BlindGridType* mBlindGrid;
284 InterrupterT* mInterrupter;
285 Real mDx, mHalfWidth;
287 size_t mMinCount, mMaxCount;
292 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
297 mInterrupter(interrupter),
298 mDx(grid.voxelSize()[0]),
299 mHalfWidth(grid.background()/mDx),
306 if (!mSdfGrid->hasUniformVoxels()) {
309 if (!DisableT::value) {
310 mBlindGrid =
new BlindGridType(BlindType(grid.background()));
311 mBlindGrid->setTransform(mSdfGrid->transform().copy());
315 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
316 template<
typename ParticleListT>
320 if (DisableT::value) {
321 Raster<ParticleListT, SdfGridT> r(*
this, mSdfGrid, pa);
322 r.rasterizeSpheres();
324 Raster<ParticleListT, BlindGridType> r(*
this, mBlindGrid, pa);
325 r.rasterizeSpheres();
329 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
330 template<
typename ParticleListT>
334 if (DisableT::value) {
335 Raster<ParticleListT, SdfGridT> r(*
this, mSdfGrid, pa);
336 r.rasterizeSpheres(radius/mDx);
338 Raster<ParticleListT, BlindGridType> r(*
this, mBlindGrid, pa);
339 r.rasterizeSpheres(radius/mDx);
343 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
344 template<
typename ParticleListT>
348 if (DisableT::value) {
349 Raster<ParticleListT, SdfGridT> r(*
this, mSdfGrid, pa);
350 r.rasterizeTrails(delta);
352 Raster<ParticleListT, BlindGridType> r(*
this, mBlindGrid, pa);
353 r.rasterizeTrails(delta);
358 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
377 using AttTreeT =
typename AttGridType::TreeType;
378 using AttLeafT =
typename AttTreeT::LeafNodeType;
379 using BlindTreeT =
typename BlindGridType::TreeType;
380 using BlindLeafIterT =
typename BlindTreeT::LeafCIter;
381 using BlindLeafT =
typename BlindTreeT::LeafNodeType;
382 using SdfTreeT =
typename SdfGridType::TreeType;
383 using SdfLeafT =
typename SdfTreeT::LeafNodeType;
386 const BlindTreeT& blindTree = mBlindGrid->tree();
389 typename AttTreeT::Ptr attTree(
new AttTreeT(
392 mAttGrid =
typename AttGridType::Ptr(
new AttGridType(attTree));
393 mAttGrid->setTransform(mBlindGrid->transform().copy());
395 typename SdfTreeT::Ptr sdfTree;
399 sdfTree.reset(
new SdfTreeT(blindTree,
404 leafNodes.
foreach([&](AttLeafT& attLeaf,
size_t ) {
405 if (
const auto* blindLeaf = blindTree.probeConstLeaf(attLeaf.origin())) {
406 for (
auto iter = attLeaf.beginValueOn(); iter; ++iter) {
407 const auto pos = iter.pos();
408 attLeaf.setValueOnly(pos, blindLeaf->getValue(pos).blind());
413 const auto blindAcc = mBlindGrid->getConstAccessor();
414 auto iter = attTree->beginValueOn();
415 iter.setMaxDepth(AttTreeT::ValueOnIter::LEAF_DEPTH - 1);
416 for ( ; iter; ++iter) {
417 iter.modifyValue([&](
AttType& v) { v = blindAcc.getValue(iter.getCoord()).blind(); });
422 sdfTree.reset(
new SdfTreeT(blindTree, blindTree.background().visible(),
TopologyCopy()));
423 for (BlindLeafIterT n = blindTree.cbeginLeaf(); n; ++n) {
424 const BlindLeafT& leaf = *n;
425 const openvdb::Coord xyz = leaf.origin();
427 SdfLeafT* sdfLeaf = sdfTree->probeLeaf(xyz);
428 AttLeafT* attLeaf = attTree->probeLeaf(xyz);
430 typename BlindLeafT::ValueOnCIter m=leaf.cbeginValueOn();
433 const BlindType& v = leaf.getValue(k);
434 sdfLeaf->setValueOnly(k, v.visible());
435 attLeaf->setValueOnly(k, v.blind());
440 const BlindType& v = *m;
441 sdfLeaf->setValueOnly(k, v.visible());
442 attLeaf->setValueOnly(k, v.blind());
449 if (mSdfGrid->empty()) {
450 mSdfGrid->setTree(sdfTree);
453 mSdfGrid->tree().topologyUnion(*sdfTree);
467 template<
typename SdfGr
idT,
typename AttributeT,
typename InterrupterT>
468 template<
typename ParticleListT,
typename Gr
idT>
471 using DisableT =
typename std::is_void<AttributeT>::type;
473 using SdfT =
typename ParticlesToLevelSetT::SdfType;
474 using AttT =
typename ParticlesToLevelSetT::AttType;
475 using ValueT =
typename GridT::ValueType;
476 using AccessorT =
typename GridT::Accessor;
477 using TreeT =
typename GridT::TreeType;
478 using LeafNodeT =
typename TreeT::LeafNodeType;
483 DoAttrXfer = !DisableT::value;
486 Raster(ParticlesToLevelSetT& parent, GridT* grid,
const ParticleListT& particles)
488 , mParticles(particles)
490 , mMap(*(mGrid->transform().baseMap()))
495 mPointPartitioner =
new PointPartitionerT;
496 mPointPartitioner->construct(particles, mGrid->transform());
501 : mParent(other.mParent)
502 , mParticles(other.mParticles)
509 , mPointPartitioner(other.mPointPartitioner)
521 delete mPointPartitioner;
527 mMinCount = mMaxCount = 0;
528 if (mParent.mInterrupter) {
529 mParent.mInterrupter->start(
"Rasterizing particles to level set using spheres");
531 mTask = std::bind(&Raster::rasterSpheres, std::placeholders::_1, std::placeholders::_2);
533 if (mParent.mInterrupter) mParent.mInterrupter->end();
538 mMinCount = radius < mParent.mRmin ? mParticles.size() : 0;
539 mMaxCount = radius > mParent.mRmax ? mParticles.size() : 0;
540 if (mMinCount>0 || mMaxCount>0) {
541 mParent.mMinCount = mMinCount;
542 mParent.mMaxCount = mMaxCount;
544 if (mParent.mInterrupter) {
545 mParent.mInterrupter->start(
546 "Rasterizing particles to level set using const spheres");
548 mTask = std::bind(&Raster::rasterFixedSpheres,
549 std::placeholders::_1, std::placeholders::_2, radius);
551 if (mParent.mInterrupter) mParent.mInterrupter->end();
557 mMinCount = mMaxCount = 0;
558 if (mParent.mInterrupter) {
559 mParent.mInterrupter->start(
"Rasterizing particles to level set using trails");
561 mTask = std::bind(&Raster::rasterTrails,
562 std::placeholders::_1, std::placeholders::_2, delta);
564 if (mParent.mInterrupter) mParent.mInterrupter->end();
568 void operator()(
const tbb::blocked_range<size_t>& r)
572 mParent.mMinCount = mMinCount;
573 mParent.mMaxCount = mMaxCount;
577 void join(Raster& other)
584 mGrid->topologyUnion(*other.mGrid);
590 mMinCount += other.mMinCount;
591 mMaxCount += other.mMaxCount;
596 Raster& operator=(
const Raster&) {
return *
this; }
599 bool ignoreParticle(
Real R)
601 if (R < mParent.mRmin) {
605 if (R > mParent.mRmax) {
614 void rasterSpheres(
const tbb::blocked_range<size_t>& r)
616 AccessorT acc = mGrid->getAccessor();
618 const Real invDx = 1 / mParent.mDx;
624 for (
size_t n = r.begin(), N = r.end(); n < N; ++n) {
626 typename PointPartitionerT::IndexIterator iter = mPointPartitioner->indices(n);
627 for ( ; run && iter; ++iter) {
629 mParticles.getPosRad(
id, pos, rad);
630 const Real R = invDx * rad;
631 if (this->ignoreParticle(R))
continue;
632 const Vec3R P = mMap.applyInverseMap(pos);
633 this->getAtt<DisableT>(id, att);
634 run = this->makeSphere(P, R, att, acc);
642 void rasterFixedSpheres(
const tbb::blocked_range<size_t>& r,
Real R)
644 AccessorT acc = mGrid->getAccessor();
649 for (
size_t n = r.begin(), N = r.end(); n < N; ++n) {
651 for (
auto iter = mPointPartitioner->indices(n); iter; ++iter) {
653 this->getAtt<DisableT>(id, att);
654 mParticles.getPos(
id, pos);
655 const Vec3R P = mMap.applyInverseMap(pos);
656 this->makeSphere(P, R, att, acc);
664 void rasterTrails(
const tbb::blocked_range<size_t>& r,
Real delta)
666 AccessorT acc = mGrid->getAccessor();
671 const Vec3R origin = mMap.applyInverseMap(
Vec3R(0,0,0));
672 const Real Rmin = mParent.mRmin, invDx = 1 / mParent.mDx;
675 for (
size_t n = r.begin(), N = r.end(); n < N; ++n) {
677 typename PointPartitionerT::IndexIterator iter = mPointPartitioner->indices(n);
678 for ( ; run && iter; ++iter) {
680 mParticles.getPosRadVel(
id, pos, rad, vel);
681 const Real R0 = invDx * rad;
682 if (this->ignoreParticle(R0))
continue;
683 this->getAtt<DisableT>(id, att);
684 const Vec3R P0 = mMap.applyInverseMap(pos);
685 const Vec3R V = mMap.applyInverseMap(vel) - origin;
686 const Real speed = V.
length(), invSpeed = 1.0 / speed;
687 const Vec3R Nrml = -V * invSpeed;
690 while (run && d <= speed) {
691 run = this->makeSphere(P, R, att, acc);
692 P += 0.5 * delta * R * Nrml;
693 d = (P - P0).length();
694 R = R0 - (R0 - Rmin) * d * invSpeed;
705 if (mParent.mGrainSize>0) {
706 tbb::parallel_reduce(
707 tbb::blocked_range<size_t>(0, bucketCount, mParent.mGrainSize), *
this);
709 (*this)(tbb::blocked_range<size_t>(0, bucketCount));
727 template <
bool IsMaskT = OutputIsMask>
728 typename std::enable_if<!IsMaskT, bool>::type
729 makeSphere(
const Vec3R& P,
Real R,
const AttT& att, AccessorT& acc)
733 w = mParent.mHalfWidth,
741 const ValueT inside = -mGrid->background();
745 for (Coord c = lo; c.x() <= hi.x(); ++c.x()) {
748 thread::cancelGroupExecution();
752 for (c.y() = lo.y(); c.y() <= hi.y(); ++c.y()) {
754 for (c.z() = lo.z(); c.z() <= hi.z(); ++c.z()) {
756 #if defined __INTEL_COMPILER 757 _Pragma(
"warning (push)")
758 _Pragma(
"warning (disable:186)")
760 if (x2y2z2 >= max2 || (!acc.probeValue(c, v) && (v < ValueT(0))))
762 #if defined __INTEL_COMPILER 763 _Pragma(
"warning (pop)")
765 if (x2y2z2 <= min2) {
766 acc.setValueOff(c, inside);
771 const ValueT d = Merge(static_cast<SdfT>(dx*(
math::Sqrt(x2y2z2)-R)), att);
772 if (d < v) acc.setValue(c, d);
781 template <
bool IsMaskT = OutputIsMask>
782 typename std::enable_if<IsMaskT, bool>::type
783 makeSphere(
const Vec3R& p,
Real r,
const AttT& att, AccessorT& acc)
797 const std::vector<CoordBBox> padding{
798 CoordBBox(outLo.x(), outLo.y(), outLo.z(), inLo.x()-1, outHi.y(), outHi.z()),
799 CoordBBox(inHi.x()+1, outLo.y(), outLo.z(), outHi.x(), outHi.y(), outHi.z()),
800 CoordBBox(outLo.x(), outLo.y(), outLo.z(), outHi.x(), inLo.y()-1, outHi.z()),
801 CoordBBox(outLo.x(), inHi.y()+1, outLo.z(), outHi.x(), outHi.y(), outHi.z()),
802 CoordBBox(outLo.x(), outLo.y(), outLo.z(), outHi.x(), outHi.y(), inLo.z()-1),
803 CoordBBox(outLo.x(), outLo.y(), inHi.z()+1, outHi.x(), outHi.y(), outHi.z()),
805 const ValueT onValue = Merge(SdfT(1), att);
809 acc.tree().sparseFill(CoordBBox(inLo, inHi), onValue);
812 for (
const auto& bbox: padding) {
814 thread::cancelGroupExecution();
817 const Coord &bmin = bbox.min(), &bmax = bbox.max();
820 for (c = bmin, cx = c.x(); c.x() <= bmax.x(); ++c.x(), cx += 1) {
822 for (c.y() = bmin.y(), cy = c.y(); c.y() <= bmax.y(); ++c.y(), cy += 1) {
824 for (c.z() = bmin.z(), cz = c.z(); c.z() <= bmax.z(); ++c.z(), cz += 1) {
826 if (x2y2z2 < rSquared) {
827 acc.setValue(c, onValue);
836 using FuncType =
typename std::function<void (Raster*, const tbb::blocked_range<size_t>&)>;
838 template<
typename DisableType>
839 typename std::enable_if<DisableType::value>::type
840 getAtt(
size_t, AttT&)
const {}
842 template<
typename DisableType>
843 typename std::enable_if<!DisableType::value>::type
844 getAtt(
size_t n, AttT& a)
const { mParticles.getAtt(n, a); }
847 typename std::enable_if<std::is_same<T, ValueT>::value, ValueT>::type
848 Merge(T s,
const AttT&)
const {
return s; }
851 typename std::enable_if<!std::is_same<T, ValueT>::value, ValueT>::type
852 Merge(T s,
const AttT& a)
const {
return ValueT(s,a); }
854 ParticlesToLevelSetT& mParent;
855 const ParticleListT& mParticles;
858 size_t mMinCount, mMaxCount;
861 PointPartitionerT* mPointPartitioner;
869 namespace p2ls_internal {
875 template<
typename VisibleT,
typename BlindT>
879 using type = VisibleT;
880 using VisibleType = VisibleT;
881 using BlindType = BlindT;
884 explicit BlindData(VisibleT v) : mVisible(v), mBlind(zeroVal<BlindType>()) {}
885 BlindData(VisibleT v, BlindT b) : mVisible(v), mBlind(b) {}
886 BlindData(
const BlindData&) =
default;
887 BlindData& operator=(
const BlindData&) =
default;
888 const VisibleT& visible()
const {
return mVisible; }
889 const BlindT& blind()
const {
return mBlind; }
891 bool operator==(
const BlindData& rhs)
const {
return mVisible == rhs.mVisible; }
893 bool operator< (
const BlindData& rhs)
const {
return mVisible < rhs.mVisible; }
894 bool operator> (
const BlindData& rhs)
const {
return mVisible > rhs.mVisible; }
895 BlindData
operator+(
const BlindData& rhs)
const {
return BlindData(mVisible + rhs.mVisible); }
896 BlindData
operator-(
const BlindData& rhs)
const {
return BlindData(mVisible - rhs.mVisible); }
897 BlindData
operator-()
const {
return BlindData(-mVisible, mBlind); }
906 template<
typename VisibleT,
typename BlindT>
907 inline std::ostream& operator<<(std::ostream& ostr, const BlindData<VisibleT, BlindT>& rhs)
909 ostr << rhs.visible();
915 template<
typename VisibleT,
typename BlindT>
916 inline BlindData<VisibleT, BlindT>
Abs(
const BlindData<VisibleT, BlindT>& x)
918 return BlindData<VisibleT, BlindT>(
math::Abs(x.visible()), x.blind());
923 template<
typename VisibleT,
typename BlindT,
typename T>
924 inline BlindData<VisibleT, BlindT>
925 operator+(
const BlindData<VisibleT, BlindT>& x,
const T& rhs)
927 return BlindData<VisibleT, BlindT>(x.visible() +
static_cast<VisibleT
>(rhs), x.blind());
939 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT>
943 static_assert(std::is_floating_point<typename GridT::ValueType>::value,
944 "particlesToSdf requires an SDF grid with floating-point values");
948 " try Grid::setGridClass(openvdb::GRID_LEVEL_SET)");
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 "particleTrailsToSdf 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_same<bool, typename GridT::ValueType>::value,
995 "particlesToMask requires a boolean-valued grid");
1001 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT>
1005 static_assert(std::is_same<bool, typename GridT::ValueType>::value,
1006 "particlesToMask requires a boolean-valued grid");
1012 template<
typename Gr
idT,
typename ParticleListT,
typename InterrupterT>
1016 static_assert(std::is_same<bool, typename GridT::ValueType>::value,
1017 "particleTrailsToMask requires a boolean-valued grid");
1027 #endif // OPENVDB_TOOLS_PARTICLES_TO_LEVELSET_HAS_BEEN_INCLUDED 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:346
InterrupterT InterrupterType
Definition: ParticlesToLevelSet.h:164
Type Pow2(Type x)
Return x2.
Definition: Math.h:548
SdfT::Ptr rasterizeSpheres(const PointDataGridT &points, const Real radius, const Real halfband=LEVEL_SET_HALF_WIDTH, math::Transform::Ptr transform=nullptr, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
Narrow band sphere stamping with a uniform radius.
Definition: PointRasterizeSDFImpl.h:1061
Definition: ParticlesToLevelSet.h:160
static const bool OutputIsMask
Definition: ParticlesToLevelSet.h:172
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:74
Coord Abs(const Coord &xyz)
Definition: Coord.h:518
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Functions to efficiently perform various compositing operations on grids.
void setGrainSize(int grainSize)
Set the grain size used for threading.
Definition: ParticlesToLevelSet.h:240
bool operator>(const Tuple< SIZE, T0 > &t0, const Tuple< SIZE, T1 > &t1)
Definition: Tuple.h:187
Tag dispatch class that distinguishes shallow copy constructors from deep copy constructors.
Definition: Types.h:680
const Type & Max(const Type &a, const Type &b)
Return the maximum of two values.
Definition: Math.h:595
typename SdfGridT::template ValueConverter< AttType >::Type AttGridType
Definition: ParticlesToLevelSet.h:170
Index32 Index
Definition: Types.h:54
Abstract base class for maps.
Definition: Maps.h:134
bool wasInterrupted(T *i, int percent=-1)
Definition: NullInterrupter.h:49
typename SdfGridT::ValueType SdfType
Definition: ParticlesToLevelSet.h:167
void setRmin(Real Rmin)
Set the smallest radius allowed in voxel units.
Definition: ParticlesToLevelSet.h:220
Spatially partitions points using a parallel radix-based sorting algorithm.
Defined various multi-threaded utility functions for trees.
Real getHalfWidth() const
Return the half-width of the narrow band in voxel units.
Definition: ParticlesToLevelSet.h:215
bool operator==(const Vec3< T0 > &v0, const Vec3< T1 > &v1)
Equality operator, does exact floating point comparisons.
Definition: Vec3.h:474
void split(ContainerT &out, const std::string &in, const char delim)
Definition: Name.h:43
bool ignoredParticles() const
Return true if any particles were ignored due to their size.
Definition: ParticlesToLevelSet.h:228
Vec3< typename promote< T, typename Coord::ValueType >::type > operator+(const Vec3< T > &v0, const Coord &v1)
Allow a Coord to be added to or subtracted from a Vec3.
Definition: Coord.h:528
#define OPENVDB_ASSERT(X)
Definition: Assert.h:41
Propagate the signs of distance values from the active voxels in the narrow band to the inactive valu...
Real getVoxelSize() const
Return the size of a voxel in world units.
Definition: ParticlesToLevelSet.h:212
int Floor(float x)
Return the floor of x.
Definition: Math.h:848
SdfGridT SdfGridType
Definition: ParticlesToLevelSet.h:166
Definition: Exceptions.h:13
bool operator<(const Tuple< SIZE, T0 > &t0, const Tuple< SIZE, T1 > &t1)
Definition: Tuple.h:175
~ParticlesToLevelSet()
Definition: ParticlesToLevelSet.h:194
#define OPENVDB_NO_FP_EQUALITY_WARNING_END
Definition: Math.h:49
double Real
Definition: Types.h:60
OPENVDB_AX_API void run(const char *ax, openvdb::GridBase &grid, const AttributeBindings &bindings={})
Run a full AX pipeline (parse, compile and execute) on a single OpenVDB Grid.
int Ceil(float x)
Return the ceiling of x.
Definition: Math.h:856
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:554
#define OPENVDB_NO_FP_EQUALITY_WARNING_BEGIN
Definition: Math.h:48
uint32_t Index32
Definition: Types.h:52
typename std::conditional< DisableT::value, size_t, AttributeT >::type AttType
Definition: ParticlesToLevelSet.h:169
int getGrainSize() const
Return the grain size used for threading.
Definition: ParticlesToLevelSet.h:237
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:484
#define OPENVDB_LOG_WARN(message)
Log a warning message of the form 'someVar << "some text" << ...'.
Definition: logging.h:256
Real getRmin() const
Return the smallest radius allowed in voxel units.
Definition: ParticlesToLevelSet.h:218
This class manages a linear array of pointers to a given tree's leaf nodes, as well as optional auxil...
Definition: LeafManager.h:85
typename std::is_void< AttributeT >::type DisableT
Definition: ParticlesToLevelSet.h:163
AttGridType::Ptr attributeGrid()
Return a pointer to the grid containing the optional user-defined attribute.
Definition: ParticlesToLevelSet.h:209
void setRmax(Real Rmax)
Set the largest radius allowed in voxel units.
Definition: ParticlesToLevelSet.h:225
void rasterizeSpheres(const ParticleListT &pa)
Rasterize each particle as a sphere with the particle's position and radius.
Definition: ParticlesToLevelSet.h:318
Tag dispatch class that distinguishes topology copy constructors from deep copy constructors.
Definition: Types.h:683
T length() const
Length of the vector.
Definition: Vec3.h:201
A LeafManager manages a linear array of pointers to a given tree's leaf nodes, as well as optional au...
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:360
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
Real getRmax() const
Return the largest radius allowed in voxel units.
Definition: ParticlesToLevelSet.h:223
float Sqrt(float x)
Return the square root of a floating-point value.
Definition: Math.h:761
size_t getMaxCount() const
Return the number of particles that were ignored because they were larger than the maximum radius...
Definition: ParticlesToLevelSet.h:234
math::Vec3< Real > Vec3R
Definition: Types.h:72
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:218
size_t getMinCount() const
Return the number of particles that were ignored because they were smaller than the minimum radius...
Definition: ParticlesToLevelSet.h:231
Definition: Exceptions.h:63