HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT > Class Template Reference

#include <ParticlesToLevelSet.h>

Public Types

using DisableT = typename std::is_void< AttributeT >::type
 
using InterrupterType = InterrupterT
 
using SdfGridType = SdfGridT
 
using SdfType = typename SdfGridT::ValueType
 
using AttType = typename std::conditional< DisableT::value, size_t, AttributeT >::type
 
using AttGridType = typename SdfGridT::template ValueConverter< AttType >::Type
 

Public Member Functions

 ParticlesToLevelSet (SdfGridT &grid, InterrupterT *interrupt=nullptr)
 Constructor using an existing boolean or narrow-band level set grid. More...
 
 ~ParticlesToLevelSet ()
 
void finalize (bool prune=false)
 This method syncs up the level set and attribute grids and therefore needs to be called before any of those grids are used and after the last call to any of the rasterizer methods. More...
 
AttGridType::Ptr attributeGrid ()
 Return a pointer to the grid containing the optional user-defined attribute. More...
 
Real getVoxelSize () const
 Return the size of a voxel in world units. More...
 
Real getHalfWidth () const
 Return the half-width of the narrow band in voxel units. More...
 
Real getRmin () const
 Return the smallest radius allowed in voxel units. More...
 
void setRmin (Real Rmin)
 Set the smallest radius allowed in voxel units. More...
 
Real getRmax () const
 Return the largest radius allowed in voxel units. More...
 
void setRmax (Real Rmax)
 Set the largest radius allowed in voxel units. More...
 
bool ignoredParticles () const
 Return true if any particles were ignored due to their size. More...
 
size_t getMinCount () const
 Return the number of particles that were ignored because they were smaller than the minimum radius. More...
 
size_t getMaxCount () const
 Return the number of particles that were ignored because they were larger than the maximum radius. More...
 
int getGrainSize () const
 Return the grain size used for threading. More...
 
void setGrainSize (int grainSize)
 Set the grain size used for threading. More...
 
template<typename ParticleListT >
void rasterizeSpheres (const ParticleListT &pa)
 Rasterize each particle as a sphere with the particle's position and radius. More...
 
template<typename ParticleListT >
void rasterizeSpheres (const ParticleListT &pa, Real radius)
 Rasterize each particle as a sphere with the particle's position and a fixed radius. More...
 
template<typename ParticleListT >
void rasterizeTrails (const ParticleListT &pa, Real delta=1.0)
 Rasterize each particle as a trail comprising the CSG union of spheres of decreasing radius. More...
 

Static Public Attributes

static const bool OutputIsMask = std::is_same<SdfType, bool>::value
 

Detailed Description

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
class openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >

Definition at line 153 of file ParticlesToLevelSet.h.

Member Typedef Documentation

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::AttGridType = typename SdfGridT::template ValueConverter<AttType>::Type

Definition at line 163 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::AttType = typename std::conditional<DisableT::value, size_t, AttributeT>::type

Definition at line 162 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::DisableT = typename std::is_void<AttributeT>::type

Definition at line 156 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::InterrupterType = InterrupterT

Definition at line 157 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::SdfGridType = SdfGridT

Definition at line 159 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
using openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::SdfType = typename SdfGridT::ValueType

Definition at line 160 of file ParticlesToLevelSet.h.

Constructor & Destructor Documentation

template<typename SdfGridT , typename AttributeT , typename InterrupterT >
openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::ParticlesToLevelSet ( SdfGridT &  grid,
InterrupterT *  interrupt = nullptr 
)
inlineexplicit

Constructor using an existing boolean or narrow-band level set grid.

Parameters
gridgrid into which particles are rasterized
interruptcallback to interrupt a long-running process

If the input grid is already populated with signed distances, particles are unioned onto the existing level set surface.

The width in voxel units of the generated narrow band level set is given by 2×background/dx, where background is the background value stored in the grid and dx is the voxel size derived from the transform associated with the grid. Also note that −background corresponds to the constant value inside the generated narrow-band level set.

Note
If attribute transfer is enabled, i.e., if AttributeT is not void, attributes are generated only for voxels that overlap with particles, not for any other preexisting voxels (for which no attributes exist!).

Definition at line 287 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::~ParticlesToLevelSet ( )
inline

Definition at line 187 of file ParticlesToLevelSet.h.

Member Function Documentation

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
AttGridType::Ptr openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::attributeGrid ( )
inline

Return a pointer to the grid containing the optional user-defined attribute.

Warning
If attribute transfer is disabled (i.e., if AttributeT is void) or if finalize is not called, the pointer will be null.

Definition at line 202 of file ParticlesToLevelSet.h.

template<typename SdfGridT , typename AttributeT , typename InterrupterT >
void openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::finalize ( bool  prune = false)
inline

This method syncs up the level set and attribute grids and therefore needs to be called before any of those grids are used and after the last call to any of the rasterizer methods.

It has no effect or overhead if attribute transfer is disabled (i.e., if AttributeT is void) and prune is false.

Note
Avoid calling this method more than once, and call it only after all the particles have been rasterized.

Definition at line 353 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
int openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::getGrainSize ( ) const
inline

Return the grain size used for threading.

Definition at line 230 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
Real openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::getHalfWidth ( ) const
inline

Return the half-width of the narrow band in voxel units.

Definition at line 208 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
size_t openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::getMaxCount ( ) const
inline

Return the number of particles that were ignored because they were larger than the maximum radius.

Definition at line 227 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
size_t openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::getMinCount ( ) const
inline

Return the number of particles that were ignored because they were smaller than the minimum radius.

Definition at line 224 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
Real openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::getRmax ( ) const
inline

Return the largest radius allowed in voxel units.

Definition at line 216 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
Real openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::getRmin ( ) const
inline

Return the smallest radius allowed in voxel units.

Definition at line 211 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
Real openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::getVoxelSize ( ) const
inline

Return the size of a voxel in world units.

Definition at line 205 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
bool openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::ignoredParticles ( ) const
inline

Return true if any particles were ignored due to their size.

Definition at line 221 of file ParticlesToLevelSet.h.

template<typename SdfGridT , typename AttributeT , typename InterrupterT >
template<typename ParticleListT >
void openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::rasterizeSpheres ( const ParticleListT &  pa)
inline

Rasterize each particle as a sphere with the particle's position and radius.

For level set output, all spheres are CSG-unioned.

Definition at line 311 of file ParticlesToLevelSet.h.

template<typename SdfGridT , typename AttributeT , typename InterrupterT >
template<typename ParticleListT >
void openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::rasterizeSpheres ( const ParticleListT &  pa,
Real  radius 
)
inline

Rasterize each particle as a sphere with the particle's position and a fixed radius.

For level set output, all spheres are CSG-unioned.

Parameters
paparticles with positions
radiusfixed sphere radius in world units.

Definition at line 325 of file ParticlesToLevelSet.h.

template<typename SdfGridT , typename AttributeT , typename InterrupterT >
template<typename ParticleListT >
void openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::rasterizeTrails ( const ParticleListT &  pa,
Real  delta = 1.0 
)
inline

Rasterize each particle as a trail comprising the CSG union of spheres of decreasing radius.

Parameters
paparticles with position, radius and velocity.
deltacontrols the distance between sphere instances
Warning
Be careful not to use too small values for delta, since this can lead to excessive computation per trail (which the interrupter can't stop).
Note
The direction of a trail is opposite to that of the velocity vector, and its length is given by the magnitude of the velocity. The radius at the head of the trail is given by the radius of the particle, and the radius at the tail is Rmin voxel units, which has a default value of 1.5 corresponding to the Nyquist frequency!

Definition at line 339 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::setGrainSize ( int  grainSize)
inline

Set the grain size used for threading.

Note
A grain size of zero or less disables threading.

Definition at line 233 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::setRmax ( Real  Rmax)
inline

Set the largest radius allowed in voxel units.

Definition at line 218 of file ParticlesToLevelSet.h.

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
void openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::setRmin ( Real  Rmin)
inline

Set the smallest radius allowed in voxel units.

Definition at line 213 of file ParticlesToLevelSet.h.

Member Data Documentation

template<typename SdfGridT, typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
const bool openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::OutputIsMask = std::is_same<SdfType, bool>::value
static

Definition at line 165 of file ParticlesToLevelSet.h.


The documentation for this class was generated from the following file: