OpenVDB  2.1.0
Classes | Namespaces | Functions
ParticlesToLevelSet.h File Reference

This tool converts particles (with position, radius and velocity) into a singed distance field encoded as a narrow band level set. Optionally arbitrary attributes on the particles can be transferred resulting in an additional attribute grid with the same topology as the level set grid. More...

#include <tbb/parallel_reduce.h>
#include <tbb/blocked_range.h>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/type_traits/is_floating_point.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/if.hpp>
#include <openvdb/util/Util.h>
#include <openvdb/Types.h>
#include <openvdb/Grid.h>
#include <openvdb/math/Math.h>
#include <openvdb/math/Transform.h>
#include <openvdb/util/NullInterrupter.h>
#include "Composite.h"

Go to the source code of this file.

Classes

class  BlindData< VisibleT, BlindT >
 
class  ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >
 
class  BlindData< VisibleT, BlindT >
 

Namespaces

 openvdb
 
 openvdb::v2_1_0
 
 openvdb::v2_1_0::tools
 
 openvdb::v2_1_0::tools::local
 

Functions

template<typename VisibleT , typename BlindT >
std::ostream & operator<< (std::ostream &ostr, const BlindData< VisibleT, BlindT > &rhs)
 
template<typename VisibleT , typename BlindT >
BlindData< VisibleT, BlindT > Abs (const BlindData< VisibleT, BlindT > &x)
 

Detailed Description

This tool converts particles (with position, radius and velocity) into a singed distance field encoded as a narrow band level set. Optionally arbitrary attributes on the particles can be transferred resulting in an additional attribute grid with the same topology as the level set grid.

Author
Ken Museth
Note
This fast particle to level set converter is always intended to be combined with some kind of surface post processing, i.e. tools::Filter. Without such post processing the generated surface is typically too noisy and blooby. However it serves as a great and fast starting point for subsequent level set surface processing and convolution.

The ParticleListT template argument below refers to any class with the following interface (see unittest/TestParticlesToLevelSet.cc and SOP_DW_OpenVDBParticleVoxelizer for practical examples):

*
* class ParticleList {
* ...
* public:
*
* // Return the total number of particles in list.
* // Always required!
* size_t size() const;
*
* // Get the world space position of n'th particle.
* // Required by ParticledToLevelSet::rasterizeSphere(*this,radius).
* void getPos(size_t n, Vec3R& xyz) const;
*
* // Get the world space position and radius of n'th particle.
* // Required by ParticledToLevelSet::rasterizeSphere(*this).
* void getPosRad(size_t n, Vec3R& xyz, Real& rad) const;
*
* // Get the world space position, radius and velocity of n'th particle.
* // Required by ParticledToLevelSet::rasterizeSphere(*this,radius).
* void getPosRadVel(size_t n, Vec3R& xyz, Real& rad, Vec3R& vel) const;
*
* // Get the attribute of the n'th particle. AttributeType is user-defined!
* // Only required is attribute transfer is enabled in ParticledToLevelSet.
* void getAtt(AttributeType& att) const;
* };
*
Note
See unittest/TestParticlesToLevelSet.cc for an example.

The InterruptT template argument below refers to any class with the following interface:

* class Interrupter {
* ...
* public:
* void start(const char* name = NULL)// called when computations begin
* void end() // called when computations end
* bool wasInterrupted(int percent=-1)// return true to break computation
* };
*
Note
If no template argument is provided for this InterruptT the util::NullInterrupter is used which implies that all interrupter calls are no-ops (i.e. incurs no computational overhead).