OpenVDB  9.0.1
Classes | Namespaces | Functions
PointsToMask.h File Reference

This tool produces a grid where every voxel that contains a point is active. It employs thread-local storage for best performance. More...

#include "openvdb/openvdb.h"
#include "openvdb/Grid.h"
#include "openvdb/Types.h"
#include "openvdb/util/NullInterrupter.h"
#include "openvdb/thread/Threading.h"
#include <tbb/enumerable_thread_specific.h>
#include <tbb/parallel_for.h>
#include <tbb/parallel_reduce.h>
#include <tbb/blocked_range.h>
#include <vector>

Go to the source code of this file.

Classes

class  PointsToMask< GridT, InterrupterT >
 Makes every voxel of a grid active if it contains a point. More...
 
class  PointsToMask< GridT, InterrupterT >
 Makes every voxel of a grid active if it contains a point. More...
 
struct  PointsToMask< GridT, InterrupterT >::ReducePool
 

Namespaces

 openvdb
 
 openvdb::v9_0
 
 openvdb::v9_0::tools
 

Functions

template<typename PointListT , typename GridT >
void maskPoints (const PointListT &points, GridT &grid)
 Makes every voxel of the grid active if it contains a point. More...
 
template<typename PointListT >
MaskGrid::Ptr createPointMask (const PointListT &points, const math::Transform &xform)
 Return a MaskGrid where each binary voxel value is on if the voxel contains one (or more) points (i.e. the 3D position of a point is closer to this voxel than any other voxels). More...
 

Detailed Description

This tool produces a grid where every voxel that contains a point is active. It employs thread-local storage for best performance.

Author
Ken Museth

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

class PointList {
...
public:
// Return the total number of particles in list.
size_t size() const;
// Get the world space position of the nth particle.
void getPos(size_t n, Vec3R& xyz) const;
};
Note
See unittest/TestPointsToMask.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).