OpenVDB 11.0.0

Loading...
Searching...
No Matches
Classes | Namespaces | Functions
ParticlesToLevelSet.h File Reference

Rasterize particles with position, radius and velocity into either a boolean mask grid or a narrow-band level set grid. More...

`#include <openvdb/Types.h>`
`#include <openvdb/Grid.h>`
`#include <openvdb/math/Math.h>`
`#include <openvdb/math/Transform.h>`
`#include <openvdb/tree/LeafManager.h>`
`#include <openvdb/util/logging.h>`
`#include <openvdb/util/NullInterrupter.h>`
`#include <openvdb/thread/Threading.h>`
`#include "Composite.h"`
`#include "PointPartitioner.h"`
`#include "Prune.h"`
`#include "SignedFloodFill.h"`
`#include <tbb/parallel_reduce.h>`
`#include <tbb/blocked_range.h>`
`#include <functional>`
`#include <iostream>`
`#include <type_traits>`
`#include <vector>`

Go to the source code of this file.

## Classes
class | ParticlesToLevelSet< SdfGridT, AttributeT, InterrupterT >

## Namespaces
namespace | openvdb
namespace | openvdb::v11_0
namespace | openvdb::v11_0::tools

## Functions
template<typename GridT , typename ParticleListT , typename InterrupterT = util::NullInterrupter>
void | particlesToSdf (const ParticleListT &, GridT &, InterrupterT *=nullptr)
| Populate a scalar, floating-point grid with CSG-unioned level set spheres described by the given particle positions and radii.
template<typename GridT , typename ParticleListT , typename InterrupterT = util::NullInterrupter>
void | particlesToSdf (const ParticleListT &, GridT &, Real radius, InterrupterT *=nullptr)
| Populate a scalar, floating-point grid with fixed-size, CSG-unioned level set spheres described by the given particle positions and the specified radius.
template<typename GridT , typename ParticleListT , typename InterrupterT = util::NullInterrupter>
void | particleTrailsToSdf (const ParticleListT &, GridT &, Real delta=1, InterrupterT *=nullptr)
| Populate a scalar, floating-point grid with CSG-unioned trails of level set spheres with decreasing radius, where the starting position and radius and the direction of each trail is given by particle attributes.
template<typename GridT , typename ParticleListT , typename InterrupterT = util::NullInterrupter>
void | particlesToMask (const ParticleListT &, GridT &, InterrupterT *=nullptr)
| Activate a boolean grid wherever it intersects the spheres described by the given particle positions and radii.
template<typename GridT , typename ParticleListT , typename InterrupterT = util::NullInterrupter>
void | particlesToMask (const ParticleListT &, GridT &, Real radius, InterrupterT *=nullptr)
| Activate a boolean grid wherever it intersects the fixed-size spheres described by the given particle positions and the specified radius.
template<typename GridT , typename ParticleListT , typename InterrupterT = util::NullInterrupter>
void | particleTrailsToMask (const ParticleListT &, GridT &, Real delta=1, InterrupterT *=nullptr)
| Activate a boolean grid wherever it intersects trails of spheres with decreasing radius, where the starting position and radius and the direction of each trail is given by particle attributes.

## Detailed Description

Rasterize particles with position, radius and velocity into either a boolean mask grid or a narrow-band level set grid.

Author
  Ken Museth

Optionally, arbitrary attributes on the particles can be transferred, resulting in additional output grids with the same topology as the main grid.

Note
  Particle to level set conversion is intended to be combined with some kind of surface postprocessing, using LevelSetFilter, for example. Without such postprocessing 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.

For particle access, any class with the following interface may be used (see the unit test or the From Particles Houdini SOP for practical examples):

struct ParticleList
{
// Return the total number of particles in the list.
// Always required!
size_t size() const;
// Get the world-space position of the nth particle.
// Required by rasterizeSpheres().
void getPos(size_t n, Vec3R& xyz) const;
// Get the world-space position and radius of the nth particle.
// Required by rasterizeSpheres().
void getPosRad(size_t n, Vec3R& xyz, Real& radius) const;
// Get the world-space position, radius and velocity of the nth particle.
// Required by rasterizeTrails().
void getPosRadVel(size_t n, Vec3R& xyz, Real& radius, Vec3R& velocity) const;
// Get the value of the nth particle's user-defined attribute (of type @c AttributeType).
// Required only if attribute transfer is enabled in ParticlesToLevelSet.
void getAtt(size_t n, AttributeType& att) const;
};

Some functions accept an interrupter argument. This refers to any class with the following interface:

struct Interrupter
{
void start(const char* name = nullptr) // called when computations begin
void end() // called when computations end
bool wasInterrupted(int percent=-1) // return true to abort computation
};

The default interrupter is NullInterrupter, for which all calls are no-ops that incur no computational overhead.