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

#include <ParticlesToLevelSet.h>

Public Types

typedef hboost::is_void
< AttributeT >::type 
DisableT
 
typedef InterrupterT InterrupterType
 
typedef SdfGridT SdfGridType
 
typedef SdfGridT::ValueType SdfType
 
typedef hboost::mpl::if_
< DisableT, size_t, AttributeT >
::type 
AttType
 
typedef SdfGridT::template
ValueConverter< AttType >
::Type 
AttGridType
 

Public Member Functions

 HBOOST_STATIC_ASSERT (hboost::is_floating_point< SdfType >::value)
 
 ParticlesToLevelSet (SdfGridT &grid, InterrupterT *interrupt=nullptr)
 Constructor using an exiting signed distance, i.e. narrow band level set, grid. More...
 
 ~ParticlesToLevelSet ()
 Destructor. More...
 
void finalize (bool prune=false)
 This methods syncs up the level set and attribute grids and therefore needs to be called before any of these grids are used and after the last call to any of the rasterizer methods. More...
 
AttGridType::Ptr attributeGrid ()
 Return a shared pointer to the grid containing the (optional) 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...
 
Real getRmax () const
 Return 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 number of small particles that were ignore due to Rmin. More...
 
size_t getMaxCount () const
 Return number of large particles that were ignore due to Rmax. More...
 
void setRmin (Real Rmin)
 set the smallest radius allowed in voxel units More...
 
void setRmax (Real Rmax)
 set the largest radius allowed in voxel units More...
 
int getGrainSize () const
 Returns the grain-size used for multi-threading. More...
 
void setGrainSize (int grainSize)
 Set the grain-size used for multi-threading. More...
 
template<typename ParticleListT >
void rasterizeSpheres (const ParticleListT &pa)
 Rasterize a sphere per particle derived from their position and radius. All spheres are CSG unioned. More...
 
template<typename ParticleListT >
void rasterizeSpheres (const ParticleListT &pa, Real radius)
 Rasterize a sphere per particle derived from their position and constant radius. All spheres are CSG unioned. More...
 
template<typename ParticleListT >
void rasterizeTrails (const ParticleListT &pa, Real delta=1.0)
 Rasterize a trail per particle derived from their position, radius and velocity. Each trail is generated as CSG unions of sphere instances with decreasing radius. More...
 

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 134 of file ParticlesToLevelSet.h.

Member Typedef Documentation

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

Definition at line 144 of file ParticlesToLevelSet.h.

template<typename SdfGridT , typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
typedef hboost::mpl::if_<DisableT, size_t, AttributeT>::type openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::AttType

Definition at line 143 of file ParticlesToLevelSet.h.

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

Definition at line 137 of file ParticlesToLevelSet.h.

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

Definition at line 138 of file ParticlesToLevelSet.h.

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

Definition at line 140 of file ParticlesToLevelSet.h.

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

Definition at line 141 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 exiting signed distance, i.e. narrow band level set, grid.

Parameters
gridLevel set grid in which particles are rasterized
interruptCallback to interrupt a long-running process
Note
The input grid is assumed to be a valid level set and if it already contains voxels (with SDF values) particles are unioned onto the existing level set surface. However, if attribute transfer is enabled, i.e. AttributeT != void, attributes are only generated for voxels that overlap with particles, not the existing voxels in the input grid (for which no attributes exist!).

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 also stored in the grid. Also note that -background corresponds to the constant value inside the generated narrow band level sets. Finally the default NullInterrupter should compile out interruption checks during optimization, thus incurring no run-time overhead.

Definition at line 274 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

Destructor.

Definition at line 172 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 shared pointer to the grid containing the (optional) attribute.

Warning
If attribute transfer was disabled, i.e. AttributeT = void, or finalize() was not called the pointer is nullptr!

Definition at line 189 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 methods syncs up the level set and attribute grids and therefore needs to be called before any of these grids are used and after the last call to any of the rasterizer methods.

Note
Avoid calling this method more than once and only after all the particles have been rasterized. It has no effect or overhead if attribute transfer is disabled, i.e. AttributeT = void and prune is false.

Definition at line 346 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

Returns the grain-size used for multi-threading.

Definition at line 215 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 195 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 number of large particles that were ignore due to Rmax.

Definition at line 207 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 number of small particles that were ignore due to Rmin.

Definition at line 205 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 200 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 198 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 192 of file ParticlesToLevelSet.h.

template<typename SdfGridT , typename AttributeT = void, typename InterrupterT = util::NullInterrupter>
openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >::HBOOST_STATIC_ASSERT ( hboost::is_floating_point< SdfType >::value  )
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 203 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 a sphere per particle derived from their position and radius. All spheres are CSG unioned.

Parameters
paParticles with position and radius.

Definition at line 305 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 a sphere per particle derived from their position and constant radius. All spheres are CSG unioned.

Parameters
paParticles with position.
radiusConstant particle radius in world units.

Definition at line 319 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 a trail per particle derived from their position, radius and velocity. Each trail is generated as CSG unions of sphere instances with decreasing radius.

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

Definition at line 333 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 multi-threading.

Note
A grainsize of 0 or less disables multi-threading!

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 >::setRmax ( Real  Rmax)
inline

set the largest radius allowed in voxel units

Definition at line 212 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 210 of file ParticlesToLevelSet.h.


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