OpenVDB  0.104.0
Namespaces | Classes | Enumerations | Functions
openvdb::v0_104_0::tools Namespace Reference

Namespaces

namespace  composite
 
namespace  internal
 
namespace  local
 This class rasterizes particles (with position, radius and velocity) into a narrow-band level set.
 
namespace  local_util
 
namespace  valxform
 

Classes

struct  CompReplaceOp
 
class  CsgVisitorBase
 
struct  CsgUnionVisitor
 
struct  CsgIntersectVisitor
 
struct  CsgDiffVisitor
 
class  CptImpl
 Computes the Closest-Point-Transform (CPT) from a distance field. More...
 
class  CptFunctor
 
class  Cpt
 Computes the Closest-Point-Transform (CPT) from a distance field. More...
 
class  Filter
 Filtering of VDB volumes. More...
 
struct  VectorToScalarConverter
 VectorToScalarConverter<VectorGridType>::Type is the type of a grid having the same tree configuration as VectorGridType but a scalar value type, T, where T is the type of the original vector components. More...
 
struct  ScalarToVectorConverter
 ScalarToVectorConverter<ScalarGridType>::Type is the type of a grid having the same tree configuration as ScalarGridType but value type Vec3<T> where T is ScalarGridType::ValueType. More...
 
class  Curl
 Computes the Curl of a scalar grid. More...
 
class  Divergence
 Computes the Divergence of a scalar grid. More...
 
class  Gradient
 Computes the Gradient of a scalar grid. More...
 
class  Laplacian
 Computes the Laplacian of a scalar grid. More...
 
class  MeanCurvature
 
class  Magnitude
 
class  Normalize
 
class  GridResampler
 
class  GridTransformer
 A GridTransformer applies a geometric transformation to an input grid using one of several sampling schemes, and stores the result in an output grid. More...
 
class  ABTransform
 This class implements the Transformer functor interface (specifically, the isAffine(), transform() and invTransform() methods) for a transform that maps an A grid into a B grid's index space such that, after resampling, A's index space and transform match B's index space and transform. More...
 
struct  PointSampler
 
struct  BoxSampler
 
struct  QuadraticSampler
 
struct  StaggeredPointSampler
 
struct  StaggeredBoxSampler
 
struct  StaggeredQuadraticSampler
 
class  GridSampler
 Base class that provides the interface for continuous sampling of values in a grid. More...
 
class  GridSampling
 Base class that provides the interface for continuous sampling of values in a grid. More...
 
class  LinearInterp
 Perform linear interpolation on a grid voxel to sample space. More...
 
class  QuadraticInterp
 
class  DiscreteField
 Sime wrapper class for a velocity grid. More...
 
class  EnrightField
 Analytical, divergence-free and periodic vecloity field. More...
 
class  LevelSetAdvection
 Hyperbolic advection of narrow-band level sets in an external velocity field. More...
 
class  LevelSetFilter
 Filtering (i.e. diffusion) of narrow-band level sets. More...
 
class  LevelSetSphere
 Generates a signed distance field (or narrow band level set) to a single sphere. More...
 
class  LevelSetTracker
 Performs multi-threaded interface tracking of narrow band level sets. More...
 
class  MinMaxVoxel
 Threaded operation to find the min and max active voxel values. More...
 
class  LeafTransformer
 Threaded leaf-node transformation scheme. More...
 
class  LevelSetFracture
 Level set fracturing. More...
 
class  MeshToVolume
 
struct  DimToWord
 Mapping from a Log2Dim to a data type of size 2^Log2Dim bits. More...
 
struct  DimToWord< 3 >
 
struct  DimToWord< 4 >
 
struct  DimToWord< 5 >
 
struct  DimToWord< 6 >
 
class  ParticlesToLevelSet
 
class  ParticlesToLevelSetAndId
 Use this wrapper class to convert particles into a level set and a separate index grid of closest-point particle id. The latter can be used to subsequently transfer particles attributes into separate grids. More...
 
class  ClosestPointProjector
 
class  VelocitySampler
 
class  VelocityIntegrator
 Performs runge-kutta time integration of variable order in a static velocity field. More...
 
class  PointAdvect
 
class  ConstrainedPointAdvect
 
class  UniformPointScatter
 The two point scatters UniformPointScatter and NonUniformPointScatter depend on the following two classes: More...
 
class  NonUniformPointScatter
 Non-uniform scatters of point in the active voxels. The local point count is implicitly defined as a product of of a global density and the local voxel (or tile) value. More...
 
class  PolygonPool
 Collection of quads and triangles. More...
 
class  VolumeToMesh
 Mesh any scalar grid with a continuous isosurface. More...
 

Typedefs

typedef boost::scoped_array
< openvdb::Vec3s
PointList
 Point and primitive list types. More...
 
typedef boost::scoped_array
< PolygonPool
PolygonPoolList
 Point and primitive list types. More...
 

Enumerations

enum  { GENERATE_PRIM_INDEX_GRID = 0x1 }
 Conversion flags, used to control the MeshToVolume output. More...
 
enum  { POLYFLAG_EXTERIOR = 0x1, POLYFLAG_FRACTURE_SEAM = 0x2 }
 Polygon flags, used for reference based meshing. More...
 

Functions

template<typename GridOrTreeT >
OPENVDB_STATIC_SPECIALIZATION void csgUnion (GridOrTreeT &a, GridOrTreeT &b, bool prune=true)
 Given two level set grids, replace the A grid with the union of A and B. More...
 
template<typename GridOrTreeT >
OPENVDB_STATIC_SPECIALIZATION void csgIntersection (GridOrTreeT &a, GridOrTreeT &b, bool prune=true)
 Given two level set grids, replace the A grid with the intersection of A and B. More...
 
template<typename GridOrTreeT >
OPENVDB_STATIC_SPECIALIZATION void csgDifference (GridOrTreeT &a, GridOrTreeT &b, bool prune=true)
 Given two level set grids, replace the A grid with the difference A / B. More...
 
template<typename GridOrTreeT >
OPENVDB_STATIC_SPECIALIZATION void compMax (GridOrTreeT &a, GridOrTreeT &b)
 Given grids A and B, compute max(a, b) per voxel (using sparse traversal). Store the result in the A grid and leave the B grid empty. More...
 
template<typename GridOrTreeT >
OPENVDB_STATIC_SPECIALIZATION void compMin (GridOrTreeT &a, GridOrTreeT &b)
 Given grids A and B, compute min(a, b) per voxel (using sparse traversal). Store the result in the A grid and leave the B grid empty. More...
 
template<typename GridOrTreeT >
OPENVDB_STATIC_SPECIALIZATION void compSum (GridOrTreeT &a, GridOrTreeT &b)
 Given grids A and B, compute a + b per voxel (using sparse traversal). Store the result in the A grid and leave the B grid empty. More...
 
template<typename GridOrTreeT >
OPENVDB_STATIC_SPECIALIZATION void compMul (GridOrTreeT &a, GridOrTreeT &b)
 Given grids A and B, compute a * b per voxel (using sparse traversal). Store the result in the A grid and leave the B grid empty. More...
 
template<typename GridOrTreeT >
OPENVDB_STATIC_SPECIALIZATION void compReplace (GridOrTreeT &a, const GridOrTreeT &b)
 Copy the active voxels of B into A. More...
 
template<typename GridType >
GridType::Ptr curl (const GridType &grid, bool threaded=true)
 Compute the curl of the given vector-valued grid. More...
 
template<typename GridType >
VectorToScalarConverter
< GridType >::Type::Ptr 
divergence (const GridType &grid, bool threaded=true)
 Compute the divergence of the given vector-valued grid. More...
 
template<typename GridType >
ScalarToVectorConverter
< GridType >::Type::Ptr 
gradient (const GridType &grid, bool threaded=true)
 Compute the gradient of the given scalar grid. More...
 
template<typename GridType >
GridType::Ptr laplacian (const GridType &grid, bool threaded=true)
 Compute the Laplacian of the given scalar grid. More...
 
template<typename GridType >
GridType::Ptr meanCurvature (const GridType &grid, bool threaded=true)
 Compute the mean curvature of the given grid. More...
 
template<typename GridType >
GridType::Ptr magnitude (const GridType &grid, bool threaded=true)
 Compute the magnitude of the given grid. More...
 
template<typename GridType >
GridType::Ptr normalize (const GridType &grid, bool threaded=true)
 Normalizes the given vector grid. More...
 
template<typename Sampler , typename Interrupter , typename GridType >
void resampleToMatch (const GridType &inGrid, GridType &outGrid, Interrupter &interrupter)
 Resample an input grid into an output grid of the same type such that, after resampling, the input and output grids coincide (apart from sampling artifacts), but the output grid's transform is unchanged. More...
 
template<typename Sampler , typename GridType >
void resampleToMatch (const GridType &inGrid, GridType &outGrid)
 Resample an input grid into an output grid of the same type such that, after resampling, the input and output grids coincide (apart from sampling artifacts), but the output grid's transform is unchanged. More...
 
template<class GridType >
GridType::Ptr levelSetRebuild (const GridType &grid, float isovalue, float halfWidth=3.0f, const math::Transform *xform=NULL)
 Returns a grid of type GridType containing a new narrow-band level set. More...
 
template<class GridType >
GridType::Ptr levelSetRebuild (const GridType &grid, float isovalue, float exBandWidth, float inBandWidth, const math::Transform *xform=NULL)
 Returns a grid of type GridType containing a new narrow-band level set. More...
 
template<class GridType , typename InterruptT >
GridType::Ptr levelSetRebuild (const GridType &grid, float isovalue, float exBandWidth, float inBandWidth, const math::Transform *xform=NULL, InterruptT *interrupter=NULL)
 Returns a grid of type GridType containing a new narrow-band level set. More...
 
template<typename GridType , typename InterruptT >
GridType::Ptr createLevelSetSphere (float radius, const openvdb::Vec3f &center, float voxelSize, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=NULL)
 Return a grid of type GridType containing a narrow-band level set representation of a sphere. More...
 
template<typename GridType >
GridType::Ptr createLevelSetSphere (float radius, const openvdb::Vec3f &center, float voxelSize, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Return a grid of type GridType containing a narrow-band level set representation of a sphere. More...
 
template<typename InterruptT >
OPENVDB_DEPRECATED FloatGrid::Ptr makeSphere (float radius, const openvdb::Vec3f &center, float voxelSize, float halfWidth, InterruptT *interrupt)
 
template<class GridType >
void sdfToFogVolume (GridType &grid, typename GridType::ValueType cutOffDistance=lsutilGridMax< GridType >())
 Threaded method to convert a sparse level-set/SDF into a sparse fog volume. More...
 
template<class GridType >
Grid< typename
GridType::TreeType::template
ValueConverter< bool >::Type >
::Ptr 
sdfInteriorMask (const GridType &grid, typename GridType::ValueType iso=lsutilGridZero< GridType >())
 Threaded method to extract the interior region mask from a level-set/SDF grid. More...
 
template<typename TreeType >
OPENVDB_STATIC_SPECIALIZATION void dilateVoxels (TreeType &tree)
 
template<typename TreeType >
OPENVDB_STATIC_SPECIALIZATION void dilateVoxels (tree::LeafManager< TreeType > &manager)
 
template<typename IterT , typename XformOp >
void foreach (const IterT &iter, XformOp &op, bool threaded=true, bool shareOp=true)
 
template<typename IterT , typename XformOp >
void foreach (const IterT &iter, const XformOp &op, bool threaded=true, bool shareOp=true)
 
template<typename InIterT , typename OutGridT , typename XformOp >
void transformValues (const InIterT &inIter, OutGridT &outGrid, XformOp &op, bool threaded=true, bool shareOp=true)
 
template<typename InIterT , typename OutGridT , typename XformOp >
void transformValues (const InIterT &inIter, OutGridT &outGrid, const XformOp &op, bool threaded=true, bool shareOp=true)
 

Typedef Documentation

typedef boost::scoped_array<openvdb::Vec3s> PointList

Point and primitive list types.

typedef boost::scoped_array<PolygonPool> PolygonPoolList

Point and primitive list types.

Enumeration Type Documentation

anonymous enum

Conversion flags, used to control the MeshToVolume output.

Enumerator
GENERATE_PRIM_INDEX_GRID 
anonymous enum

Polygon flags, used for reference based meshing.

Enumerator
POLYFLAG_EXTERIOR 
POLYFLAG_FRACTURE_SEAM 

Function Documentation

OPENVDB_STATIC_SPECIALIZATION void compMax ( GridOrTreeT &  a,
GridOrTreeT &  b 
)
inline

Given grids A and B, compute max(a, b) per voxel (using sparse traversal). Store the result in the A grid and leave the B grid empty.

OPENVDB_STATIC_SPECIALIZATION void compMin ( GridOrTreeT &  a,
GridOrTreeT &  b 
)
inline

Given grids A and B, compute min(a, b) per voxel (using sparse traversal). Store the result in the A grid and leave the B grid empty.

OPENVDB_STATIC_SPECIALIZATION void compMul ( GridOrTreeT &  a,
GridOrTreeT &  b 
)
inline

Given grids A and B, compute a * b per voxel (using sparse traversal). Store the result in the A grid and leave the B grid empty.

OPENVDB_STATIC_SPECIALIZATION void compReplace ( GridOrTreeT &  a,
const GridOrTreeT &  b 
)
inline

Copy the active voxels of B into A.

OPENVDB_STATIC_SPECIALIZATION void compSum ( GridOrTreeT &  a,
GridOrTreeT &  b 
)
inline

Given grids A and B, compute a + b per voxel (using sparse traversal). Store the result in the A grid and leave the B grid empty.

GridType::Ptr createLevelSetSphere ( float  radius,
const openvdb::Vec3f center,
float  voxelSize,
float  halfWidth = float(LEVEL_SET_HALF_WIDTH),
InterruptT *  interrupt = NULL 
)

Return a grid of type GridType containing a narrow-band level set representation of a sphere.

Parameters
radiusradius of the sphere in world units
centercenter of the sphere in world units
voxelSizevoxel size in world units
halfWidthhalf the width of the narrow band, in voxel units
interrupta pointer adhering to the util::NullInterrupter interface
Note
GridType::ValueType must be a floating-point scalar.
The leapfrog algorithm employed in this method is best suited for a single large sphere. For multiple small spheres consider using the faster algorithm in ParticlesToLevelSet.h
GridType::Ptr openvdb::v0_104_0::tools::createLevelSetSphere ( float  radius,
const openvdb::Vec3f center,
float  voxelSize,
float  halfWidth = float(LEVEL_SET_HALF_WIDTH) 
)

Return a grid of type GridType containing a narrow-band level set representation of a sphere.

Parameters
radiusradius of the sphere in world units
centercenter of the sphere in world units
voxelSizevoxel size in world units
halfWidthhalf the width of the narrow band, in voxel units
Note
GridType::ValueType must be a floating-point scalar.
The leapfrog algorithm employed in this method is best suited for a single large sphere. For multiple small spheres consider using the faster algorithm in ParticlesToLevelSet.h
OPENVDB_STATIC_SPECIALIZATION void csgDifference ( GridOrTreeT &  a,
GridOrTreeT &  b,
bool  prune = true 
)
inline

Given two level set grids, replace the A grid with the difference A / B.

Exceptions
ValueErrorif the background value of either grid is not greater than zero.
Note
This operation always leaves the B grid empty.
OPENVDB_STATIC_SPECIALIZATION void csgIntersection ( GridOrTreeT &  a,
GridOrTreeT &  b,
bool  prune = true 
)
inline

Given two level set grids, replace the A grid with the intersection of A and B.

Exceptions
ValueErrorif the background value of either grid is not greater than zero.
Note
This operation always leaves the B grid empty.
OPENVDB_STATIC_SPECIALIZATION void csgUnion ( GridOrTreeT &  a,
GridOrTreeT &  b,
bool  prune = true 
)
inline

Given two level set grids, replace the A grid with the union of A and B.

Exceptions
ValueErrorif the background value of either grid is not greater than zero.
Note
This operation always leaves the B grid empty.
GridType::Ptr curl ( const GridType &  grid,
bool  threaded = true 
)
inline

Compute the curl of the given vector-valued grid.

Returns
a new vector-valued grid
OPENVDB_STATIC_SPECIALIZATION void dilateVoxels ( TreeType &  tree)
inline

Topologically dilate all leaf-level active voxels in the given tree, i.e., expand the set of active voxels by one voxel in the +x, -x, +y, -y, +z and -z directions, but don't change the values of any voxels, only their active states.

OPENVDB_STATIC_SPECIALIZATION void openvdb::v0_104_0::tools::dilateVoxels ( tree::LeafManager< TreeType > &  manager)
inline
VectorToScalarConverter< GridType >::Type::Ptr divergence ( const GridType &  grid,
bool  threaded = true 
)
inline

Compute the divergence of the given vector-valued grid.

Returns
a new scalar-valued grid with the same numerical precision as the input grid (for example, if the input grid is a Vec3DGrid, the output grid will be a DoubleGrid)
void foreach ( const IterT &  iter,
XformOp &  op,
bool  threaded = true,
bool  shareOp = true 
)
inline

Iterate over a grid and at each step call op(iter).

Parameters
iteran iterator over a grid or its tree (Grid::ValueOnCIter, Tree::NodeIter, etc.)
opa functor of the form void op(const IterT&), where IterT is the type of iter
threadedif true, transform multiple values of the grid in parallel
shareOpif true and threaded is true, all threads use the same functor; otherwise, each thread gets its own copy of the functor
Example:
Multiply all values (both set and unset) of a scalar, floating-point grid by two.
struct Local {
static inline void op(const FloatGrid::ValueAllIter& iter) {
iter.setValue(*iter * 2);
}
};
FloatGrid grid;
tools::foreach(grid.beginValueAll(), Local::op);
Example:
Rotate all active vectors of a vector grid by 45 degrees about the y axis.
namespace {
struct MatMul {
MatMul(const math::Mat3s& mat): M(mat) {}
inline void operator()(const VectorGrid::ValueOnIter& iter) const {
iter.setValue(M.transform(*iter));
}
};
}
{
VectorGrid grid;
tools::foreach(grid.beginValueOn(),
MatMul(math::rotation<math::Mat3s>(math::Y, M_PI_4)));
}
Note
For more complex operations that require finer control over threading, consider using tbb::parallel_for() or tbb::parallel_reduce() in conjunction with a tree::IteratorRange that wraps a grid or tree iterator.
void foreach ( const IterT &  iter,
const XformOp &  op,
bool  threaded = true,
bool  shareOp = true 
)
inline
ScalarToVectorConverter< GridType >::Type::Ptr gradient ( const GridType &  grid,
bool  threaded = true 
)
inline

Compute the gradient of the given scalar grid.

Returns
a new vector-valued grid with the same numerical precision as the input grid (for example, if the input grid is a DoubleGrid, the output grid will be a Vec3DGrid)
GridType::Ptr laplacian ( const GridType &  grid,
bool  threaded = true 
)
inline

Compute the Laplacian of the given scalar grid.

Returns
a new scalar grid
GridType::Ptr levelSetRebuild ( const GridType &  grid,
float  isovalue,
float  halfWidth = 3.0f,
const math::Transform *  xform = NULL 
)
inline

Returns a grid of type GridType containing a new narrow-band level set.

Parameters
gridA scalar grid with a single closed isosurface at the given isovalue.
isovalueThe isovalue that defines the implicite surface.
halfWidthHalf the width of the narrow band, in voxel units.
xformOptional transform for the output grid, if not provided the transform of the input grid will be matched.
GridType::Ptr levelSetRebuild ( const GridType &  grid,
float  isovalue,
float  exBandWidth,
float  inBandWidth,
const math::Transform *  xform = NULL 
)
inline

Returns a grid of type GridType containing a new narrow-band level set.

Parameters
gridA scalar grid with a single closed isosurface at the given isovalue.
isovalueThe isovalue that defines the implicite surface.
exBandWidthThe exterior narrow-band width in voxel units.
inBandWidthThe interior narrow-band width in voxel units.
xformOptional transform for the output grid, if not provided the transform of the input grid will be matched.
GridType::Ptr levelSetRebuild ( const GridType &  grid,
float  isovalue,
float  exBandWidth,
float  inBandWidth,
const math::Transform *  xform = NULL,
InterruptT *  interrupter = NULL 
)
inline

Returns a grid of type GridType containing a new narrow-band level set.

Parameters
gridA scalar grid with a single closed isosurface at the given isovalue.
isovalueThe isovalue that defines the implicite surface.
exBandWidthThe exterior narrow-band width in voxel units.
inBandWidthThe interior narrow-band width in voxel units.
xformOptional transform for the output grid, if not provided the transform of the input grid will be matched.
interrupterOptional interupter object.
GridType::Ptr magnitude ( const GridType &  grid,
bool  threaded = true 
)
inline

Compute the magnitude of the given grid.

Returns
a new grid
OPENVDB_DEPRECATED FloatGrid::Ptr openvdb::v0_104_0::tools::makeSphere ( float  radius,
const openvdb::Vec3f center,
float  voxelSize,
float  halfWidth,
InterruptT *  interrupt 
)
Returns
a FloatGrid containing a narrow-band SDF of a sphere
Parameters
radiusRadius of the sphere in world units
centerCenter of the sphere in world units
voxelSizeSize of voxels in world units
halfWidthHalf-width of narrow-band in voxel units
interruptPointer to optional interrupter. Use template argument util::NullInterrupter if no interruption is desired.
Note
the leapfrog algorithm employed in this method is best suited for a single large sphere. For multiple small spheres consider using the faster algorithm in ParticlesToLevelSet.h
Deprecated:
Use createSphereSDF() or LevelSetSphere instead.
GridType::Ptr meanCurvature ( const GridType &  grid,
bool  threaded = true 
)
inline

Compute the mean curvature of the given grid.

Returns
a new grid
GridType::Ptr normalize ( const GridType &  grid,
bool  threaded = true 
)
inline

Normalizes the given vector grid.

Returns
a new grid
void resampleToMatch ( const GridType &  inGrid,
GridType &  outGrid,
Interrupter &  interrupter 
)
inline

Resample an input grid into an output grid of the same type such that, after resampling, the input and output grids coincide (apart from sampling artifacts), but the output grid's transform is unchanged.

Specifically, this function resamples the input grid into the output grid's index space, using a sampling kernel like PointSampler, BoxSampler, or QuadraticSampler.

Parameters
inGridthe grid to be resampled
outGridthe grid into which to write the resampled voxel data
interrupteran object adhering to the util::NullInterrupter interface
Example:
// Create an input grid with the default identity transform
// and populate it with a level-set sphere.
// Create an output grid and give it a uniform-scale transform.
const float voxelSize = 0.5;
dest->setTransform(math::Transform::createLinearTransform(voxelSize));
// Resample the input grid into the output grid, reproducing
// the level-set sphere at a smaller voxel size.
MyInterrupter interrupter = ...;
tools::resampleToMatch<tools::QuadraticSampler>(*src, *dest, interrupter);
void resampleToMatch ( const GridType &  inGrid,
GridType &  outGrid 
)
inline

Resample an input grid into an output grid of the same type such that, after resampling, the input and output grids coincide (apart from sampling artifacts), but the output grid's transform is unchanged.

Specifically, this function resamples the input grid into the output grid's index space, using a sampling kernel like PointSampler, BoxSampler, or QuadraticSampler.

Parameters
inGridthe grid to be resampled
outGridthe grid into which to write the resampled voxel data
Example:
// Create an input grid with the default identity transform
// and populate it with a level-set sphere.
// Create an output grid and give it a uniform-scale transform.
const float voxelSize = 0.5;
dest->setTransform(math::Transform::createLinearTransform(voxelSize));
// Resample the input grid into the output grid, reproducing
// the level-set sphere at a smaller voxel size.
tools::resampleToMatch<tools::QuadraticSampler>(*src, *dest);
Grid< typename GridType::TreeType::template ValueConverter< bool >::Type >::Ptr sdfInteriorMask ( const GridType &  grid,
typename GridType::ValueType  iso = lsutilGridZero<GridType>() 
)
inline

Threaded method to extract the interior region mask from a level-set/SDF grid.

Returns
Shared ptr to a new boolean grid with the same tree configuration and transform as the incoming grid. The interior region is made active.
Parameters
gridA Level set / SDF grid.
isoValues below this threshold are considered to be part of the interior region.
void sdfToFogVolume ( GridType &  grid,
typename GridType::ValueType  cutOffDistance = lsutilGridMax<GridType>() 
)
inline

Threaded method to convert a sparse level-set/SDF into a sparse fog volume.

Note
The active negative/interior values of the narrow-band are transformed into a smooth [0 to 1] gradient, and the interior inactive values are transformed to active constanct values of 1. All exterior values, including the background, are set to 0 with inactive states. The interior is still a sparse representations but the values arenow active.
Parameters
gridLevel set / SDF grid to transform.
cutOffDistanceOptional world space cutoff distance for the gradient (automatically clamped if greater than the interior narrow band width)
void transformValues ( const InIterT &  inIter,
OutGridT &  outGrid,
XformOp &  op,
bool  threaded = true,
bool  shareOp = true 
)
inline

Iterate over a grid and at each step call op(iter, accessor) to populate (via the accessor) the given output grid, whose ValueType need not be the same as the input grid's.

Parameters
inItera non-const or (preferably) const iterator over an input grid or its tree (Grid::ValueOnCIter, Tree::NodeIter, etc.)
outGridan empty grid to be populated
opa functor of the form void op(const InIterT&, OutGridT::ValueAccessor&), where InIterT is the type of inIter
threadedif true, transform multiple values of the input grid in parallel
shareOpif true and threaded is true, all threads use the same functor; otherwise, each thread gets its own copy of the functor
Example:
Populate a scalar floating-point grid with the lengths of the vectors from all active voxels of a vector-valued input grid.
struct Local {
static void op(
FloatGrid::ValueAccessor& accessor)
{
if (iter.isVoxelValue()) { // set a single voxel
accessor.setValue(iter.getCoord(), iter->length());
} else { // fill an entire tile
CoordBBox bbox;
iter.getBoundingBox(bbox);
accessor.getTree()->fill(bbox, iter->length());
}
}
};
Vec3fGrid inGrid;
FloatGrid outGrid;
tools::transformValues(inGrid.cbeginValueOn(), outGrid, Local::op);
Warning
The shareOp argument is currently ignored. The functor is always shared.
Note
For more complex operations that require finer control over threading, consider using tbb::parallel_for() or tbb::parallel_reduce() in conjunction with a tree::IteratorRange that wraps a grid or tree iterator.
void transformValues ( const InIterT &  inIter,
OutGridT &  outGrid,
const XformOp &  op,
bool  threaded = true,
bool  shareOp = true 
)
inline