HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParticlesToLevelSet.h File Reference

This tool converts particles (with position, radius and velocity) into a signed 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 <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"
#include "PointPartitioner.h"
#include "Prune.h"
#include "SignedFloodFill.h"
#include <iostream>
#include <type_traits>
+ Include dependency graph for ParticlesToLevelSet.h:

Go to the source code of this file.

Classes

class  openvdb::OPENVDB_VERSION_NAME::tools::p2ls_internal::BlindData< VisibleT, BlindT >
 
class  openvdb::OPENVDB_VERSION_NAME::tools::ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >
 
class  openvdb::OPENVDB_VERSION_NAME::tools::p2ls_internal::BlindData< VisibleT, BlindT >
 

Namespaces

 openvdb
 
 openvdb::OPENVDB_VERSION_NAME
 
 openvdb::OPENVDB_VERSION_NAME::tools
 
 openvdb::OPENVDB_VERSION_NAME::tools::p2ls_internal
 

Functions

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

Detailed Description

This tool converts particles (with position, radius and velocity) into a signed 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 blobby. 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:
using PosType = openvdb::Vec3R;
// Return the total number of particles in list.
// Always required!
size_t size() const;
// Get the world space position of the nth particle.
// Required by ParticledToLevelSet::rasterizeSphere(*this,radius).
void getPos(size_t n, Vec3R& xyz) const;
// Get the world space position and radius of the nth 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 the nth particle.
// Required by ParticledToLevelSet::rasterizeSphere(*this,radius).
void getPosRadVel(size_t n, Vec3R& xyz, Real& rad, Vec3R& vel) const;
// Get the attribute of the nth particle. AttributeType is user-defined!
// Only required if attribute transfer is enabled in ParticlesToLevelSet.
void getAtt(size_t n, 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 = nullptr) // 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).

Definition in file ParticlesToLevelSet.h.