OpenVDB  2.1.0
Namespaces | Classes | Enumerations | Functions
openvdb::v2_1_0::tools Namespace Reference

Namespaces

 activation
 
 composite
 
 internal
 
 local
 
 local_util
 
 stats_internal
 
 valxform
 

Classes

struct  CompReplaceOp
 
class  CsgVisitorBase
 
struct  CsgUnionVisitor
 
struct  CsgIntersectVisitor
 
struct  CsgDiffVisitor
 
class  DenseBase
 Base class for Dense which is defined below. More...
 
class  DenseBase< ValueT, LayoutZYX >
 Partial template specialization of DenseBase. More...
 
class  DenseBase< ValueT, LayoutXYZ >
 Partial template specialization of DenseBase. More...
 
class  Dense
 Dense is a simple dense grid API used by the CopyToDense and CopyFromDense classes defined below. More...
 
class  CopyToDense
 Copy an OpenVDB tree into an existing dense grid. More...
 
class  CopyFromDense
 Copy the values from a dense grid into an OpenVDB tree. More...
 
class  Filter
 Volume filtering (e.g., diffusion) with optional alpha masking. 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  Cpt
 Compute the closest-point transform of a scalar grid. More...
 
class  Curl
 Compute 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
 Class that provides the interface for continuous sampling of values in a tree. Consider using the GridSampler below instead. More...
 
class  GridSampler< tree::ValueAccessor< TreeT >, SamplerType >
 Specialization of GridSampler for construction from a ValueAccessor type. More...
 
class  DualGridSampler
 This is a simple convenience class that allows for sampling from a source grid into the index space of a target grid. At construction the source and target grids are checked for alignment which potentially renders interpolation unnecessary. Else interpolation is performed according to the templated Sampler type. More...
 
class  DiscreteField
 Thin 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 (e.g. diffusion) of narrow-band level sets. An optional scalar field can be used to produce a (smooth) alpha mask for the filtering. More...
 
class  LevelSetFracture
 Level set fracturing. More...
 
class  DiracDelta
 Smeared-out and continuous Dirac Delta function. More...
 
class  LevelSetMeasure
 Multi-threaded computation of surface area, volume and average mean-curvature for narrow band level sets. More...
 
class  LevelSetMorphing
 Hyperbolic advection of narrow-band level sets in an external velocity field. 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 operator that finds the minimum and maximum values among the active leaf-level voxels of a grid. More...
 
class  MeshToVolume
 
class  MeshToVoxelEdgeData
 Extracts and stores voxel edge intersection data from a mesh. More...
 
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  Morphology
 
class  ParticlesToLevelSet
 
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...
 
struct  LevelSetHDDA
 Helper class that implements Hierarchical Digital Differential Analyzers and is specialized for ray intersections with level sets. More...
 
struct  VolumeHDDA
 
class  LinearSearchImpl
 Implements linear iterative search for a zero-crossing of the level set along along the direction of the ray. More...
 
class  LevelSetRayIntersector
 This class provides the public API for intersecting a ray with a narrow-band level set. More...
 
class  VolumeRayIntersector
 This class provides the public API for intersecting a ray with a generic (e.g. density) volume. More...
 
struct  LevelSetHDDA< TreeT,-1 >
 Specialization of Hierarchical Digital Differential Analyzer class that intersects a ray against the voxels of a level set. More...
 
struct  VolumeHDDA< TreeT,-1 >
 Specialization of Hierarchical Digital Differential Analyzer class that intersects against the voxels of a generic volume. More...
 
class  LevelSetRayTracer
 A (very) simple multithreaded ray tracer specifically for narrow-band level sets. More...
 
class  Film
 A simple class that allows for concurrent writes to pixels in an image, background initialization of the image, and PPM or EXR file output. More...
 
class  BaseCamera
 Abstract base class for the perspective and orthographic cameras. More...
 
class  PerspectiveCamera
 
class  OrthographicCamera
 
class  BaseShader
 Abstract base class for the shaders. More...
 
class  MatteShader
 Shader that produces a simple matte. More...
 
class  NormalShader
 Color shader that treats the surface normal (x, y, z) as an RGB color. More...
 
class  PositionShader
 
class  DiffuseShader
 Simple diffuse Lambertian surface shader. More...
 
class  PolygonPool
 Collection of quads and triangles. More...
 
class  VolumeToMesh
 Mesh any scalar grid that has a continuous isosurface. More...
 
class  ClosestSurfacePoint
 Accelerated closest surface point queries for narrow band level sets. Supports queries that originate at arbitrary worldspace locations, is not confined to the narrow band region of the input volume geometry. 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  MemoryLayout { LayoutXYZ, LayoutZYX }
 
enum  { GENERATE_PRIM_INDEX_GRID = 0x1, OUTPUT_RAW_DATA = 0x2 }
 Conversion flags, used to control the MeshToVolume output. More...
 
enum  { POLYFLAG_EXTERIOR = 0x1, POLYFLAG_FRACTURE_SEAM = 0x2, POLYFLAG_SUBDIVIDED = 0x4 }
 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 DenseT , typename GridOrTreeT >
void copyToDense (const GridOrTreeT &sparse, DenseT &dense, bool serial=false)
 Populate a dense grid with the values of voxels from a sparse grid, where the sparse grid intersects the dense grid. More...
 
template<typename DenseT , typename GridOrTreeT >
void copyFromDense (const DenseT &dense, GridOrTreeT &sparse, const typename GridOrTreeT::ValueType &tolerance, bool serial=false)
 Populate a sparse grid with the values of all of the voxels of a dense grid. More...
 
template<typename GridType , typename InterruptT >
ScalarToVectorConverter
< GridType >::Type::Ptr 
cpt (const GridType &grid, bool threaded, InterruptT *interrupt)
 Compute the Closest-Point Transform (CPT) from a distance field. More...
 
template<typename GridType , typename MaskT , typename InterruptT >
ScalarToVectorConverter
< GridType >::Type::Ptr 
cpt (const GridType &grid, const MaskT &mask, bool threaded, InterruptT *interrupt)
 
template<typename GridType >
ScalarToVectorConverter
< GridType >::Type::Ptr 
cpt (const GridType &grid, bool threaded=true)
 
template<typename GridType , typename MaskT >
ScalarToVectorConverter
< GridType >::Type::Ptr 
cpt (const GridType &grid, const MaskT &mask, bool threaded=true)
 
template<typename GridType , typename InterruptT >
GridType::Ptr curl (const GridType &grid, bool threaded, InterruptT *interrupt)
 Compute the curl of the given vector-valued grid. More...
 
template<typename GridType , typename MaskT , typename InterruptT >
GridType::Ptr curl (const GridType &grid, const MaskT &mask, bool threaded, InterruptT *interrupt)
 
template<typename GridType >
GridType::Ptr curl (const GridType &grid, bool threaded=true)
 
template<typename GridType , typename MaskT >
GridType::Ptr curl (const GridType &grid, const MaskT &mask, bool threaded=true)
 
template<typename GridType , typename InterruptT >
VectorToScalarConverter
< GridType >::Type::Ptr 
divergence (const GridType &grid, bool threaded, InterruptT *interrupt)
 Compute the divergence of the given vector-valued grid. More...
 
template<typename GridType , typename MaskT , typename InterruptT >
VectorToScalarConverter
< GridType >::Type::Ptr 
divergence (const GridType &grid, const MaskT &mask, bool threaded, InterruptT *interrupt)
 
template<typename GridType >
VectorToScalarConverter
< GridType >::Type::Ptr 
divergence (const GridType &grid, bool threaded=true)
 
template<typename GridType , typename MaskT >
VectorToScalarConverter
< GridType >::Type::Ptr 
divergence (const GridType &grid, const MaskT &mask, bool threaded=true)
 
template<typename GridType , typename InterruptT >
ScalarToVectorConverter
< GridType >::Type::Ptr 
gradient (const GridType &grid, bool threaded, InterruptT *interrupt)
 Compute the gradient of the given scalar grid. More...
 
template<typename GridType , typename MaskT , typename InterruptT >
ScalarToVectorConverter
< GridType >::Type::Ptr 
gradient (const GridType &grid, const MaskT &mask, bool threaded, InterruptT *interrupt)
 
template<typename GridType >
ScalarToVectorConverter
< GridType >::Type::Ptr 
gradient (const GridType &grid, bool threaded=true)
 
template<typename GridType , typename MaskT >
ScalarToVectorConverter
< GridType >::Type::Ptr 
gradient (const GridType &grid, const MaskT &mask, bool threaded=true)
 
template<typename GridType , typename InterruptT >
GridType::Ptr laplacian (const GridType &grid, bool threaded, InterruptT *interrupt)
 Compute the Laplacian of the given scalar grid. More...
 
template<typename GridType , typename MaskT , typename InterruptT >
GridType::Ptr laplacian (const GridType &grid, const MaskT &mask, bool threaded, InterruptT *interrupt)
 
template<typename GridType >
GridType::Ptr laplacian (const GridType &grid, bool threaded=true)
 
template<typename GridType , typename MaskT >
GridType::Ptr laplacian (const GridType &grid, const MaskT mask, bool threaded=true)
 
template<typename GridType , typename InterruptT >
GridType::Ptr meanCurvature (const GridType &grid, bool threaded, InterruptT *interrupt)
 Compute the mean curvature of the given grid. More...
 
template<typename GridType , typename MaskT , typename InterruptT >
GridType::Ptr meanCurvature (const GridType &grid, const MaskT &mask, bool threaded, InterruptT *interrupt)
 
template<typename GridType >
GridType::Ptr meanCurvature (const GridType &grid, bool threaded=true)
 
template<typename GridType , typename MaskT >
GridType::Ptr meanCurvature (const GridType &grid, const MaskT &mask, bool threaded=true)
 
template<typename GridType , typename InterruptT >
VectorToScalarConverter
< GridType >::Type::Ptr 
magnitude (const GridType &grid, bool threaded, InterruptT *interrupt)
 Compute the magnitudes of the vectors of the given vector-valued grid. More...
 
template<typename GridType , typename MaskT , typename InterruptT >
VectorToScalarConverter
< GridType >::Type::Ptr 
magnitude (const GridType &grid, const MaskT &mask, bool threaded, InterruptT *interrupt)
 
template<typename GridType >
VectorToScalarConverter
< GridType >::Type::Ptr 
magnitude (const GridType &grid, bool threaded=true)
 
template<typename GridType , typename MaskT >
VectorToScalarConverter
< GridType >::Type::Ptr 
magnitude (const GridType &grid, const MaskT &mask, bool threaded=true)
 
template<typename GridType , typename InterruptT >
GridType::Ptr normalize (const GridType &grid, bool threaded, InterruptT *interrupt)
 Normalize the vectors of the given vector-valued grid. More...
 
template<typename GridType , typename MaskT , typename InterruptT >
GridType::Ptr normalize (const GridType &grid, const MaskT &mask, bool threaded, InterruptT *interrupt)
 
template<typename GridType >
GridType::Ptr normalize (const GridType &grid, bool threaded=true)
 
template<typename GridType , typename MaskT >
GridType::Ptr normalize (const GridType &grid, const MaskT &mask, bool threaded=true)
 
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<typename Sampler , typename Interrupter , typename GridType >
void doResampleToMatch (const GridType &inGrid, GridType &outGrid, Interrupter &interrupter)
 
template<class GridType >
Real levelSetArea (const GridType &grid, bool useWorldSpace=true)
 Return the surface area of a narrow-band level set. More...
 
template<class GridType >
Real levelSetVolume (const GridType &grid, bool useWorldSpace=true)
 Return the volume of a narrow-band level set surface. More...
 
template<class GridType >
void levelSetMeasure (const GridType &grid, Real &area, Real &volume, bool useWorldSpace=true)
 Compute the surface area and volume of a narrow-band level set. More...
 
template<class GridType >
void levelSetMeasure (const GridType &grid, Real &area, Real &volume, Real &avgCurvature, bool useWorldSpace=true)
 Compute the surface area and volume of a narrow-band level set. More...
 
template<class GridT >
boost::enable_if
< boost::is_floating_point
< typename GridT::ValueType >
, Real >::type 
doLevelSetArea (const GridT &grid, bool useWorldSpace)
 
template<class GridT >
boost::disable_if
< boost::is_floating_point
< typename GridT::ValueType >
, Real >::type 
doLevelSetArea (const GridT &, bool)
 
template<class GridT >
Real levelSetArea (const GridT &grid, bool useWorldSpace)
 
template<class GridT >
boost::enable_if
< boost::is_floating_point
< typename GridT::ValueType >
, Real >::type 
doLevelSetVolume (const GridT &grid, bool useWorldSpace)
 
template<class GridT >
boost::disable_if
< boost::is_floating_point
< typename GridT::ValueType >
, Real >::type 
doLevelSetVolume (const GridT &, bool)
 
template<class GridT >
Real levelSetVolume (const GridT &grid, bool useWorldSpace)
 
template<class GridT >
boost::enable_if
< boost::is_floating_point
< typename GridT::ValueType >
>::type 
doLevelSetMeasure (const GridT &grid, Real &area, Real &volume, bool useWorldSpace)
 
template<class GridT >
boost::disable_if
< boost::is_floating_point
< typename GridT::ValueType >
>::type 
doLevelSetMeasure (const GridT &, Real &, Real &, bool)
 
template<class GridT >
void levelSetMeasure (const GridT &grid, Real &area, Real &volume, bool useWorldSpace)
 
template<class GridT >
boost::enable_if
< boost::is_floating_point
< typename GridT::ValueType >
>::type 
doLevelSetMeasure (const GridT &grid, Real &area, Real &volume, Real &avgCurvature, bool useWorldSpace)
 
template<class GridT >
boost::disable_if
< boost::is_floating_point
< typename GridT::ValueType >
>::type 
doLevelSetMeasure (const GridT &, Real &, Real &, Real &, bool)
 
template<class GridT >
void levelSetMeasure (const GridT &grid, Real &area, Real &volume, Real &avgCurvature, bool useWorldSpace)
 
template<class GridType >
GridType::Ptr levelSetRebuild (const GridType &grid, float isovalue=0, float halfWidth=float(LEVEL_SET_HALF_WIDTH), const math::Transform *xform=NULL)
 Return a new grid of type GridType that contains a narrow-band level set representation of an isosurface of a given grid. More...
 
template<class GridType >
GridType::Ptr levelSetRebuild (const GridType &grid, float isovalue, float exBandWidth, float inBandWidth, const math::Transform *xform=NULL)
 Return a new grid of type GridType that contains a narrow-band level set representation of an isosurface of a given grid. 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)
 Return a new grid of type GridType that contains a narrow-band level set representation of an isosurface of a given grid. More...
 
template<class GridType , typename InterruptT >
boost::enable_if
< boost::is_floating_point
< typename GridType::ValueType >
, typename GridType::Ptr >
::type 
doLevelSetRebuild (const GridType &grid, typename GridType::ValueType iso, typename GridType::ValueType exWidth, typename GridType::ValueType inWidth, const math::Transform *xform, InterruptT *interrupter)
 
template<class GridType , typename InterruptT >
boost::disable_if
< boost::is_floating_point
< typename GridType::ValueType >
, typename GridType::Ptr >
::type 
doLevelSetRebuild (const GridType &, typename GridType::ValueType, typename GridType::ValueType, typename GridType::ValueType, const math::Transform *, InterruptT *)
 
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<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 an interior region mask from a level set/SDF grid. More...
 
template<typename GridType >
GridType::Ptr meshToLevelSet (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Convert a triangle mesh to a level set volume. More...
 
template<typename GridType >
GridType::Ptr meshToLevelSet (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec4I > &quads, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Convert a quad mesh to a level set volume. More...
 
template<typename GridType >
GridType::Ptr meshToLevelSet (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
 Convert a triangle and quad mesh to a level set volume. More...
 
template<typename GridType >
GridType::Ptr meshToSignedDistanceField (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float exBandWidth, float inBandWidth)
 Convert a triangle and quad mesh to a signed distance field with an asymmetrical narrow band. More...
 
template<typename GridType >
GridType::Ptr meshToUnsignedDistanceField (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float bandWidth)
 Convert a triangle and quad mesh to an unsigned distance field. More...
 
template<typename GridType >
boost::enable_if
< boost::is_floating_point
< typename GridType::ValueType >
, typename GridType::Ptr >
::type 
doMeshConversion (const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float exBandWidth, float inBandWidth, bool unsignedDistanceField=false)
 
template<typename GridType >
boost::disable_if
< boost::is_floating_point
< typename GridType::ValueType >
, typename GridType::Ptr >
::type 
doMeshConversion (const math::Transform &, const std::vector< Vec3s > &, const std::vector< Vec3I > &, const std::vector< Vec4I > &, float, float, bool unsignedDistanceField=false)
 
std::ostream & operator<< (std::ostream &ostr, const MeshToVoxelEdgeData::EdgeData &rhs)
 
MeshToVoxelEdgeData::EdgeData Abs (const MeshToVoxelEdgeData::EdgeData &x)
 
template<typename GridOrTree >
void activate (GridOrTree &, const typename GridOrTree::ValueType &value, const typename GridOrTree::ValueType &tolerance=zeroVal< typename GridOrTree::ValueType >())
 Mark as active any inactive tiles or voxels in the given grid or tree whose values are equal to value (optionally to within the given tolerance). More...
 
template<typename GridOrTree >
void deactivate (GridOrTree &, const typename GridOrTree::ValueType &value, const typename GridOrTree::ValueType &tolerance=zeroVal< typename GridOrTree::ValueType >())
 Mark as inactive any active tiles or voxels in the given grid or tree whose values are equal to value (optionally to within the given tolerance). More...
 
template<typename GridT >
void rayTrace (const GridT &, const BaseShader &, BaseCamera &, size_t pixelSamples=1, unsigned int seed=0, bool threaded=true)
 Ray-trace a volume. More...
 
template<typename GridT , typename IntersectorT >
void rayTrace (const GridT &, const IntersectorT &, const BaseShader &, BaseCamera &, size_t pixelSamples=1, unsigned int seed=0, bool threaded=true)
 Ray-trace a volume using a given ray intersector. More...
 
template<typename IterT >
math::Histogram histogram (const IterT &iter, double minVal, double maxVal, size_t numBins=10, bool threaded=true)
 Iterate over a scalar grid and compute a histogram of the values of the voxels that are visited, or iterate over a vector-valued grid and compute a histogram of the magnitudes of the vectors. More...
 
template<typename IterT >
math::Stats statistics (const IterT &iter, bool threaded=true)
 Iterate over a scalar grid and compute statistics (mean, variance, etc.) of the values of the voxels that are visited, or iterate over a vector-valued grid and compute statistics of the magnitudes of the vectors. More...
 
template<typename IterT , typename ValueOp >
math::Stats statistics (const IterT &iter, const ValueOp &op, bool threaded)
 Iterate over a grid and compute statistics (mean, variance, etc.) of the values produced by applying the given functor at each voxel that is visited. More...
 
template<typename OperatorT , typename IterT >
math::Stats opStatistics (const IterT &iter, const OperatorT &op=OperatorT(), bool threaded=true)
 Iterate over a grid and compute statistics (mean, variance, etc.) of the values produced by applying a given operator (see math/Operators.h) at each voxel that is visited. More...
 
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, MergePolicy merge=MERGE_ACTIVE_STATES)
 
template<typename InIterT , typename OutGridT , typename XformOp >
void transformValues (const InIterT &inIter, OutGridT &outGrid, const XformOp &op, bool threaded=true, bool shareOp=true, MergePolicy merge=MERGE_ACTIVE_STATES)
 
template<typename IterT , typename XformOp >
void accumulate (const IterT &iter, XformOp &op, bool threaded=true)
 
template<typename TreeT >
void setValueOnMin (TreeT &tree, const Coord &xyz, const typename TreeT::ValueType &value)
 Set the value of the voxel at the given coordinates in tree to the minimum of its current value and value, and mark the voxel as active. More...
 
template<typename TreeT >
void setValueOnMax (TreeT &tree, const Coord &xyz, const typename TreeT::ValueType &value)
 Set the value of the voxel at the given coordinates in tree to the maximum of its current value and value, and mark the voxel as active. More...
 
template<typename TreeT >
void setValueOnSum (TreeT &tree, const Coord &xyz, const typename TreeT::ValueType &value)
 Set the value of the voxel at the given coordinates in tree to the sum of its current value and value, and mark the voxel as active. More...
 
template<typename TreeT >
void setValueOnMult (TreeT &tree, const Coord &xyz, const typename TreeT::ValueType &value)
 Set the value of the voxel at the given coordinates in tree to the product of its current value and value, and mark the voxel as active. More...
 
template<typename GridType >
void volumeToMesh (const GridType &grid, std::vector< Vec3s > &points, std::vector< Vec4I > &quads, double isovalue=0.0)
 Uniformly mesh any scalar grid that has a continuous isosurface. More...
 
template<typename GridType >
void volumeToMesh (const GridType &grid, std::vector< Vec3s > &points, std::vector< Vec3I > &triangles, std::vector< Vec4I > &quads, double isovalue=0.0, double adaptivity=0.0)
 Adaptively mesh any scalar grid that has a continuous isosurface. More...
 
Vec3d findFeaturePoint (const std::vector< Vec3d > &points, const std::vector< Vec3d > &normals)
 Given a set of tangent elements, points with corresponding normals, this method returns the intersection point of all tangent elements. More...
 
template<typename GridT , typename InterrupterT >
void fillWithSpheres (const GridT &grid, std::vector< openvdb::Vec4s > &spheres, int maxSphereCount, bool overlapping=false, float minRadius=1.0, float maxRadius=std::numeric_limits< float >::max(), float isovalue=0.0, int instanceCount=10000, InterrupterT *interrupter=NULL)
 Threaded method to fill a closed level set or fog volume with adaptively sized spheres. More...
 
template<typename GridT >
void fillWithSpheres (const GridT &grid, std::vector< openvdb::Vec4s > &spheres, int maxSphereCount, bool overlapping=false, float minRadius=1.0, float maxRadius=std::numeric_limits< float >::max(), float isovalue=0.0, int instanceCount=10000)
 fillWithSpheres method variant that automatically infers the util::NullInterrupter. More...
 
template<typename TreeType >
OPENVDB_STATIC_SPECIALIZATION void dilateVoxels (TreeType &tree, int count=1)
 
template<typename TreeType >
OPENVDB_STATIC_SPECIALIZATION void dilateVoxels (tree::LeafManager< TreeType > &manager, int count=1)
 
template<typename TreeType >
OPENVDB_STATIC_SPECIALIZATION void erodeVoxels (TreeType &tree, int count=1)
 
template<typename TreeType >
OPENVDB_STATIC_SPECIALIZATION void erodeVoxels (tree::LeafManager< TreeType > &manager, int count=1)
 

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 
OUTPUT_RAW_DATA 
anonymous enum

Polygon flags, used for reference based meshing.

Enumerator
POLYFLAG_EXTERIOR 
POLYFLAG_FRACTURE_SEAM 
POLYFLAG_SUBDIVIDED 

We currently support the following two 3D memory layouts for dense volumes: XYZ, i.e. x is the fastest moving index, and ZYX, i.e. z is the fastest moving index. The ZYX memory layout leads to nested for-loops of the order x, y, z, which we find to be the most intuitive. Hence, ZYX is the layout used throughout VDB. However, other data structures, e.g. Houdini and Maya, employ the XYZ layout. Clearly a dense volume with the ZYX layout converts more efficiently to a VDB, but we support both for convenience.

Enumerator
LayoutXYZ 
LayoutZYX 

Function Documentation

MeshToVoxelEdgeData::EdgeData openvdb::v2_1_0::tools::Abs ( const MeshToVoxelEdgeData::EdgeData &  x)
inline
void accumulate ( const IterT &  iter,
XformOp &  op,
bool  threaded = true 
)
inline

Iterate over a grid and at each step call op(iter). If threading is enabled, call op.join(otherOp) to accumulate intermediate results from pairs of threads.

Parameters
iteran iterator over a grid or its tree (Grid::ValueOnCIter, Tree::NodeIter, etc.)
opa functor with a join method of the form void join(XformOp&) and a call method of the form void op(const IterT&), where IterT is the type of iter
threadedif true, transform multiple values of the grid in parallel
Note
If threaded is true, each thread gets its own copy of the original functor. The order in which threads are joined is unspecified.
If threaded is false, the join method is never called.
Example:
Compute the average of the active values of a scalar, floating-point grid using the math::Stats class.
* namespace {
* struct Average {
* math::Stats stats;
*
* // Accumulate voxel and tile values into this functor's Stats object.
* inline void operator()(const FloatGrid::ValueOnCIter& iter) {
* if (iter.isVoxelValue()) stats.add(*iter);
* else stats.add(*iter, iter.getVoxelCount());
* }
*
* // Accumulate another functor's Stats object into this functor's.
* inline void join(Average& other) { stats.add(other.stats); }
*
* // Return the cumulative result.
* inline double average() const { return stats.mean(); }
* };
* }
* {
* FloatGrid grid = ...;
* Average op;
* tools::accumulate(grid.cbeginValueOn(), op);
* double average = op.average();
* }
*
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 activate ( GridOrTree &  gridOrTree,
const typename GridOrTree::ValueType &  value,
const typename GridOrTree::ValueType &  tolerance = zeroVal<typename GridOrTree::ValueType>() 
)
inline

Mark as active any inactive tiles or voxels in the given grid or tree whose values are equal to value (optionally to within the given tolerance).

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.

void copyFromDense ( const DenseT &  dense,
GridOrTreeT &  sparse,
const typename GridOrTreeT::ValueType &  tolerance,
bool  serial = false 
)

Populate a sparse grid with the values of all of the voxels of a dense grid.

Parameters
densethe dense grid from which to copy values
sparsean OpenVDB grid or tree into which to copy values
tolerancevalues in the dense grid that are within this tolerance of the sparse grid's background value become inactive background voxels or tiles in the sparse grid
serialif false, process voxels in parallel
void copyToDense ( const GridOrTreeT &  sparse,
DenseT &  dense,
bool  serial = false 
)

Populate a dense grid with the values of voxels from a sparse grid, where the sparse grid intersects the dense grid.

Parameters
sparsean OpenVDB grid or tree from which to copy values
densethe dense grid into which to copy values
serialif false, process voxels in parallel
ScalarToVectorConverter< GridType >::Type::Ptr cpt ( const GridType &  grid,
bool  threaded,
InterruptT *  interrupt 
)
inline

Compute the Closest-Point Transform (CPT) from a distance field.

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) When a mask grid is specified, the solution is calculated only in the intersection of the mask active topology and the input active topology independent of the transforms associated with either grid.
Note
The current implementation assumes all the input distance values are represented by leaf voxels and not tiles. This is true for all narrow-band level sets, which this class was originally developed for. In the future we will expand this class to also handle tile values.
ScalarToVectorConverter< GridType >::Type::Ptr cpt ( const GridType &  grid,
const MaskT &  mask,
bool  threaded,
InterruptT *  interrupt 
)
inline
ScalarToVectorConverter<GridType>::Type::Ptr openvdb::v2_1_0::tools::cpt ( const GridType &  grid,
bool  threaded = true 
)
inline
ScalarToVectorConverter<GridType>::Type::Ptr openvdb::v2_1_0::tools::cpt ( const GridType &  grid,
const MaskT &  mask,
bool  threaded = true 
)
inline
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::v2_1_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,
InterruptT *  interrupt 
)
inline

Compute the curl of the given vector-valued grid.

Returns
a new vector-valued grid When a mask grid is specified, the solution is calculated only in the intersection of the mask active topology and the input active topology independent of the transforms associated with either grid.
GridType::Ptr curl ( const GridType &  grid,
const MaskT &  mask,
bool  threaded,
InterruptT *  interrupt 
)
inline
GridType::Ptr openvdb::v2_1_0::tools::curl ( const GridType &  grid,
bool  threaded = true 
)
inline
GridType::Ptr openvdb::v2_1_0::tools::curl ( const GridType &  grid,
const MaskT &  mask,
bool  threaded = true 
)
inline
void deactivate ( GridOrTree &  gridOrTree,
const typename GridOrTree::ValueType &  value,
const typename GridOrTree::ValueType &  tolerance = zeroVal<typename GridOrTree::ValueType>() 
)
inline

Mark as inactive any active tiles or voxels in the given grid or tree whose values are equal to value (optionally to within the given tolerance).

OPENVDB_STATIC_SPECIALIZATION void dilateVoxels ( TreeType &  tree,
int  count = 1 
)
inline

Topologically dilate all leaf-level active voxels in the given tree, i.e., expand the set of active voxels by count voxels 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 dilateVoxels ( tree::LeafManager< TreeType > &  manager,
int  count = 1 
)
inline

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

VectorToScalarConverter< GridType >::Type::Ptr divergence ( const GridType &  grid,
bool  threaded,
InterruptT *  interrupt 
)
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) When a mask grid is specified, the solution is calculated only in the intersection of the mask active topology and the input active topology independent of the transforms associated with either grid.
VectorToScalarConverter< GridType >::Type::Ptr divergence ( const GridType &  grid,
const MaskT &  mask,
bool  threaded,
InterruptT *  interrupt 
)
inline
VectorToScalarConverter<GridType>::Type::Ptr openvdb::v2_1_0::tools::divergence ( const GridType &  grid,
bool  threaded = true 
)
inline
VectorToScalarConverter<GridType>::Type::Ptr openvdb::v2_1_0::tools::divergence ( const GridType &  grid,
const MaskT &  mask,
bool  threaded = true 
)
inline
boost::enable_if<boost::is_floating_point<typename GridT::ValueType>, Real>::type openvdb::v2_1_0::tools::doLevelSetArea ( const GridT &  grid,
bool  useWorldSpace 
)
inline
boost::disable_if<boost::is_floating_point<typename GridT::ValueType>, Real>::type openvdb::v2_1_0::tools::doLevelSetArea ( const GridT &  ,
bool   
)
inline
boost::enable_if<boost::is_floating_point<typename GridT::ValueType> >::type openvdb::v2_1_0::tools::doLevelSetMeasure ( const GridT &  grid,
Real &  area,
Real &  volume,
bool  useWorldSpace 
)
inline
boost::disable_if<boost::is_floating_point<typename GridT::ValueType> >::type openvdb::v2_1_0::tools::doLevelSetMeasure ( const GridT &  ,
Real &  ,
Real &  ,
bool   
)
inline
boost::enable_if<boost::is_floating_point<typename GridT::ValueType> >::type openvdb::v2_1_0::tools::doLevelSetMeasure ( const GridT &  grid,
Real &  area,
Real &  volume,
Real &  avgCurvature,
bool  useWorldSpace 
)
inline
boost::disable_if<boost::is_floating_point<typename GridT::ValueType> >::type openvdb::v2_1_0::tools::doLevelSetMeasure ( const GridT &  ,
Real &  ,
Real &  ,
Real &  ,
bool   
)
inline
boost::enable_if<boost::is_floating_point<typename GridType::ValueType>,typename GridType::Ptr>::type openvdb::v2_1_0::tools::doLevelSetRebuild ( const GridType &  grid,
typename GridType::ValueType  iso,
typename GridType::ValueType  exWidth,
typename GridType::ValueType  inWidth,
const math::Transform *  xform,
InterruptT *  interrupter 
)
inline

The normal entry points for level set rebuild are the levelSetRebuild() functions. doLevelSetRebuild() is mainly for internal use, but when the isovalue and half band widths are given in ValueType units (for example, if they are queried from a grid), it might be more convenient to call this function directly.

boost::disable_if<boost::is_floating_point<typename GridType::ValueType>,typename GridType::Ptr>::type openvdb::v2_1_0::tools::doLevelSetRebuild ( const GridType &  ,
typename GridType::ValueType  ,
typename GridType::ValueType  ,
typename GridType::ValueType  ,
const math::Transform *  ,
InterruptT *   
)
inline
boost::enable_if<boost::is_floating_point<typename GridT::ValueType>, Real>::type openvdb::v2_1_0::tools::doLevelSetVolume ( const GridT &  grid,
bool  useWorldSpace 
)
inline
boost::disable_if<boost::is_floating_point<typename GridT::ValueType>, Real>::type openvdb::v2_1_0::tools::doLevelSetVolume ( const GridT &  ,
bool   
)
inline
boost::enable_if<boost::is_floating_point<typename GridType::ValueType>,typename GridType::Ptr>::type openvdb::v2_1_0::tools::doMeshConversion ( const openvdb::math::Transform &  xform,
const std::vector< Vec3s > &  points,
const std::vector< Vec3I > &  triangles,
const std::vector< Vec4I > &  quads,
float  exBandWidth,
float  inBandWidth,
bool  unsignedDistanceField = false 
)
inline
boost::disable_if<boost::is_floating_point<typename GridType::ValueType>,typename GridType::Ptr>::type openvdb::v2_1_0::tools::doMeshConversion ( const math::Transform &  ,
const std::vector< Vec3s > &  ,
const std::vector< Vec3I > &  ,
const std::vector< Vec4I > &  ,
float  ,
float  ,
bool  unsignedDistanceField = false 
)
inline
void openvdb::v2_1_0::tools::doResampleToMatch ( const GridType &  inGrid,
GridType &  outGrid,
Interrupter &  interrupter 
)
inline

The normal entry points for resampling are the resampleToMatch() functions, which correctly handle level set grids under scaling and shearing. doResampleToMatch() is mainly for internal use but is typically faster for level sets, and correct provided that no scaling or shearing is needed.

Warning
Do not use this function to scale or shear a level set grid.
OPENVDB_STATIC_SPECIALIZATION void erodeVoxels ( TreeType &  tree,
int  count = 1 
)
inline

Topologically erode all leaf-level active voxels in the given tree, i.e., shrink the set of active voxels by count voxels 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 erodeVoxels ( tree::LeafManager< TreeType > &  manager,
int  count = 1 
)
inline

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

void fillWithSpheres ( const GridT &  grid,
std::vector< openvdb::Vec4s > &  spheres,
int  maxSphereCount,
bool  overlapping = false,
float  minRadius = 1.0,
float  maxRadius = std::numeric_limits<float>::max(),
float  isovalue = 0.0,
int  instanceCount = 10000,
InterrupterT *  interrupter = NULL 
)
inline

Threaded method to fill a closed level set or fog volume with adaptively sized spheres.

Parameters
grida scalar gird to fill with spheres.
spheresa Vec4 array representing the spheres that returned by this method. The first three components specify the sphere center and the fourth is the radius. The spheres in this array are ordered by radius, biggest to smallest.
maxSphereCountno more than this number of spheres are generated.
overlappingtoggle to allow spheres to overlap/intersect
minRadiusdetermines the smallest sphere size in voxel units.
maxRadiusdetermines the largest sphere size in voxel units.
isovaluethe crossing point of the volume values that is considered the surface. The zero default value works for signed distance fields while fog volumes require a larger positive value, 0.5 is a good initial guess.
instanceCounthow many interior points to consider for the sphere placement, increasing this count increases the chances of finding optimal sphere sizes.
interruptera pointer adhering to the util::NullInterrupter interface
void openvdb::v2_1_0::tools::fillWithSpheres ( const GridT &  grid,
std::vector< openvdb::Vec4s > &  spheres,
int  maxSphereCount,
bool  overlapping = false,
float  minRadius = 1.0,
float  maxRadius = std::numeric_limits<float>::max(),
float  isovalue = 0.0,
int  instanceCount = 10000 
)
inline

fillWithSpheres method variant that automatically infers the util::NullInterrupter.

Vec3d openvdb::v2_1_0::tools::findFeaturePoint ( const std::vector< Vec3d > &  points,
const std::vector< Vec3d > &  normals 
)
inline

Given a set of tangent elements, points with corresponding normals, this method returns the intersection point of all tangent elements.

Note
Used to extract surfaces with sharp edges and corners from volume data, see the following paper for details: "Feature Sensitive Surface Extraction from Volume Data, Kobbelt et al. 2001".
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 original 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,
InterruptT *  interrupt 
)
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) When a mask grid is specified, the solution is calculated only in the intersection of the mask active topology and the input active topology independent of the transforms associated with either grid.
ScalarToVectorConverter< GridType >::Type::Ptr gradient ( const GridType &  grid,
const MaskT &  mask,
bool  threaded,
InterruptT *  interrupt 
)
inline
ScalarToVectorConverter<GridType>::Type::Ptr openvdb::v2_1_0::tools::gradient ( const GridType &  grid,
bool  threaded = true 
)
inline
ScalarToVectorConverter<GridType>::Type::Ptr openvdb::v2_1_0::tools::gradient ( const GridType &  grid,
const MaskT &  mask,
bool  threaded = true 
)
inline
math::Histogram histogram ( const IterT &  iter,
double  minVal,
double  maxVal,
size_t  numBins = 10,
bool  threaded = true 
)
inline

Iterate over a scalar grid and compute a histogram of the values of the voxels that are visited, or iterate over a vector-valued grid and compute a histogram of the magnitudes of the vectors.

Parameters
iteran iterator over the values of a grid or its tree (Grid::ValueOnCIter, Tree::ValueOffIter, etc.)
minValthe smallest value that can be added to the histogram
maxValthe largest value that can be added to the histogram
numBinsthe number of histogram bins
threadedif true, iterate over the grid in parallel
GridType::Ptr laplacian ( const GridType &  grid,
bool  threaded,
InterruptT *  interrupt 
)
inline

Compute the Laplacian of the given scalar grid.

Returns
a new scalar grid When a mask grid is specified, the solution is calculated only in the intersection of the mask active topology and the input active topology independent of the transforms associated with either grid.
GridType::Ptr laplacian ( const GridType &  grid,
const MaskT &  mask,
bool  threaded,
InterruptT *  interrupt 
)
inline
GridType::Ptr openvdb::v2_1_0::tools::laplacian ( const GridType &  grid,
bool  threaded = true 
)
inline
GridType::Ptr openvdb::v2_1_0::tools::laplacian ( const GridType &  grid,
const MaskT  mask,
bool  threaded = true 
)
inline
Real openvdb::v2_1_0::tools::levelSetArea ( const GridType &  grid,
bool  useWorldSpace = true 
)
inline

Return the surface area of a narrow-band level set.

Parameters
grida scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
useWorldSpaceif true the area is computed in world space units, else in voxel units.
Exceptions
TypeErrorif grid is not scalar or not floating-point or not a level set.
Real openvdb::v2_1_0::tools::levelSetArea ( const GridT &  grid,
bool  useWorldSpace 
)
inline
void openvdb::v2_1_0::tools::levelSetMeasure ( const GridType &  grid,
Real &  area,
Real &  volume,
bool  useWorldSpace = true 
)
inline

Compute the surface area and volume of a narrow-band level set.

Parameters
grida scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
areasurface area of the level set
volumevolume of the level set surface
useWorldSpaceif true the area and volume are computed in world space units, else in voxel units.
Exceptions
TypeErrorif grid is not scalar or not floating-point or not a level set.
void openvdb::v2_1_0::tools::levelSetMeasure ( const GridType &  grid,
Real &  area,
Real &  volume,
Real &  avgCurvature,
bool  useWorldSpace = true 
)
inline

Compute the surface area and volume of a narrow-band level set.

Parameters
grida scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
areasurface area of the level set
volumevolume of the level set surface
avgCurvatureaverage mean curvature of the level set surface
useWorldSpaceif true the area, volume and curvature are computed in world space units, else in voxel units.
Exceptions
TypeErrorif grid is not scalar or not floating-point or not a level set.
void openvdb::v2_1_0::tools::levelSetMeasure ( const GridT &  grid,
Real &  area,
Real &  volume,
bool  useWorldSpace 
)
inline
void openvdb::v2_1_0::tools::levelSetMeasure ( const GridT &  grid,
Real &  area,
Real &  volume,
Real &  avgCurvature,
bool  useWorldSpace 
)
inline
GridType::Ptr levelSetRebuild ( const GridType &  grid,
float  isovalue = 0,
float  halfWidth = float(LEVEL_SET_HALF_WIDTH),
const math::Transform *  xform = NULL 
)
inline

Return a new grid of type GridType that contains a narrow-band level set representation of an isosurface of a given grid.

Parameters
grida scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
isovaluethe isovalue that defines the implicit surface (defaults to zero, which is typical if the input grid is already a level set or a SDF).
halfWidthhalf the width of the narrow band, in voxel units (defaults to 3 voxels, which is required for some level set operations)
xformoptional transform for the output grid (if not provided, the transform of the input grid will be matched)
Exceptions
TypeErrorif grid is not scalar or not floating-point
Note
If the input grid contains overlapping isosurfaces, interior edges will be lost.
GridType::Ptr levelSetRebuild ( const GridType &  grid,
float  isovalue,
float  exBandWidth,
float  inBandWidth,
const math::Transform *  xform = NULL 
)
inline

Return a new grid of type GridType that contains a narrow-band level set representation of an isosurface of a given grid.

Parameters
grida scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
isovaluethe isovalue that defines the implicit 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)
Exceptions
TypeErrorif grid is not scalar or not floating-point
Note
If the input grid contains overlapping isosurfaces, interior edges will be lost.
GridType::Ptr levelSetRebuild ( const GridType &  grid,
float  isovalue,
float  exBandWidth,
float  inBandWidth,
const math::Transform *  xform = NULL,
InterruptT *  interrupter = NULL 
)
inline

Return a new grid of type GridType that contains a narrow-band level set representation of an isosurface of a given grid.

Parameters
grida scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
isovaluethe isovalue that defines the implicit 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 interrupter object
Exceptions
TypeErrorif grid is not scalar or not floating-point
Note
If the input grid contains overlapping isosurfaces, interior edges will be lost.
Real openvdb::v2_1_0::tools::levelSetVolume ( const GridType &  grid,
bool  useWorldSpace = true 
)
inline

Return the volume of a narrow-band level set surface.

Parameters
grida scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
useWorldSpaceif true the volume is computed in world space units, else in voxel units.
Exceptions
TypeErrorif grid is not scalar or not floating-point or not a level set.
Real openvdb::v2_1_0::tools::levelSetVolume ( const GridT &  grid,
bool  useWorldSpace 
)
inline
VectorToScalarConverter< GridType >::Type::Ptr magnitude ( const GridType &  grid,
bool  threaded,
InterruptT *  interrupt 
)
inline

Compute the magnitudes of the vectors 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) When a mask grid is specified, the solution is calculated only in the intersection of the mask active topology and the input active topology independent of the transforms associated with either grid.
VectorToScalarConverter< GridType >::Type::Ptr magnitude ( const GridType &  grid,
const MaskT &  mask,
bool  threaded,
InterruptT *  interrupt 
)
inline
VectorToScalarConverter<GridType>::Type::Ptr openvdb::v2_1_0::tools::magnitude ( const GridType &  grid,
bool  threaded = true 
)
inline
VectorToScalarConverter<GridType>::Type::Ptr openvdb::v2_1_0::tools::magnitude ( const GridType &  grid,
const MaskT &  mask,
bool  threaded = true 
)
inline
GridType::Ptr meanCurvature ( const GridType &  grid,
bool  threaded,
InterruptT *  interrupt 
)
inline

Compute the mean curvature of the given grid.

Returns
a new grid When a mask grid is specified, the solution is calculated only in the intersection of the mask active topology and the input active topology independent of the transforms associated with either grid.
GridType::Ptr meanCurvature ( const GridType &  grid,
const MaskT &  mask,
bool  threaded,
InterruptT *  interrupt 
)
inline
GridType::Ptr openvdb::v2_1_0::tools::meanCurvature ( const GridType &  grid,
bool  threaded = true 
)
inline
GridType::Ptr openvdb::v2_1_0::tools::meanCurvature ( const GridType &  grid,
const MaskT &  mask,
bool  threaded = true 
)
inline
GridType::Ptr meshToLevelSet ( const openvdb::math::Transform &  xform,
const std::vector< Vec3s > &  points,
const std::vector< Vec3I > &  triangles,
float  halfWidth = float(LEVEL_SET_HALF_WIDTH) 
)
inline

Convert a triangle mesh to a level set volume.

Returns
a grid of type GridType containing a narrow-band level set representation of the input mesh.
Exceptions
TypeErrorif GridType is not scalar or not floating-point
Note
Requires a closed surface but not necessarily a manifold surface. Supports surfaces with self intersections and degenerate faces and is independent of mesh surface normals.
Parameters
xformtransform for the output grid
pointslist of world space point positions
trianglestriangle index list
halfWidthhalf the width of the narrow band, in voxel units
GridType::Ptr meshToLevelSet ( const openvdb::math::Transform &  xform,
const std::vector< Vec3s > &  points,
const std::vector< Vec4I > &  quads,
float  halfWidth = float(LEVEL_SET_HALF_WIDTH) 
)
inline

Convert a quad mesh to a level set volume.

Returns
a grid of type GridType containing a narrow-band level set representation of the input mesh.
Exceptions
TypeErrorif GridType is not scalar or not floating-point
Note
Requires a closed surface but not necessarily a manifold surface. Supports surfaces with self intersections and degenerate faces and is independent of mesh surface normals.
Parameters
xformtransform for the output grid
pointslist of world space point positions
quadsquad index list
halfWidthhalf the width of the narrow band, in voxel units
GridType::Ptr meshToLevelSet ( const openvdb::math::Transform &  xform,
const std::vector< Vec3s > &  points,
const std::vector< Vec3I > &  triangles,
const std::vector< Vec4I > &  quads,
float  halfWidth = float(LEVEL_SET_HALF_WIDTH) 
)
inline

Convert a triangle and quad mesh to a level set volume.

Returns
a grid of type GridType containing a narrow-band level set representation of the input mesh.
Exceptions
TypeErrorif GridType is not scalar or not floating-point
Note
Requires a closed surface but not necessarily a manifold surface. Supports surfaces with self intersections and degenerate faces and is independent of mesh surface normals.
Parameters
xformtransform for the output grid
pointslist of world space point positions
trianglestriangle index list
quadsquad index list
halfWidthhalf the width of the narrow band, in voxel units
GridType::Ptr meshToSignedDistanceField ( const openvdb::math::Transform &  xform,
const std::vector< Vec3s > &  points,
const std::vector< Vec3I > &  triangles,
const std::vector< Vec4I > &  quads,
float  exBandWidth,
float  inBandWidth 
)
inline

Convert a triangle and quad mesh to a signed distance field with an asymmetrical narrow band.

Returns
a grid of type GridType containing a narrow-band signed distance field representation of the input mesh.
Exceptions
TypeErrorif GridType is not scalar or not floating-point
Note
Requires a closed surface but not necessarily a manifold surface. Supports surfaces with self intersections and degenerate faces and is independent of mesh surface normals.
Parameters
xformtransform for the output grid
pointslist of world space point positions
trianglestriangle index list
quadsquad index list
exBandWidththe exterior narrow-band width in voxel units
inBandWidththe interior narrow-band width in voxel units
GridType::Ptr meshToUnsignedDistanceField ( const openvdb::math::Transform &  xform,
const std::vector< Vec3s > &  points,
const std::vector< Vec3I > &  triangles,
const std::vector< Vec4I > &  quads,
float  bandWidth 
)
inline

Convert a triangle and quad mesh to an unsigned distance field.

Returns
a grid of type GridType containing a narrow-band unsigned distance field representation of the input mesh.
Exceptions
TypeErrorif GridType is not scalar or not floating-point
Note
Does not requires a closed surface.
Parameters
xformtransform for the output grid
pointslist of world space point positions
trianglestriangle index list
quadsquad index list
bandWidththe width of the narrow band, in voxel units
GridType::Ptr normalize ( const GridType &  grid,
bool  threaded,
InterruptT *  interrupt 
)
inline

Normalize the vectors of the given vector-valued grid.

Returns
a new vector-valued grid When a mask grid is specified, the solution is calculated only in the intersection of the mask active topology and the input active topology independent of the transforms associated with either grid.
GridType::Ptr normalize ( const GridType &  grid,
const MaskT &  mask,
bool  threaded,
InterruptT *  interrupt 
)
inline
GridType::Ptr openvdb::v2_1_0::tools::normalize ( const GridType &  grid,
bool  threaded = true 
)
inline
GridType::Ptr openvdb::v2_1_0::tools::normalize ( const GridType &  grid,
const MaskT &  mask,
bool  threaded = true 
)
inline
std::ostream& openvdb::v2_1_0::tools::operator<< ( std::ostream &  ostr,
const MeshToVoxelEdgeData::EdgeData &  rhs 
)
inline
math::Stats opStatistics ( const IterT &  iter,
const OperatorT &  op = OperatorT(),
bool  threaded = true 
)
inline

Iterate over a grid and compute statistics (mean, variance, etc.) of the values produced by applying a given operator (see math/Operators.h) at each voxel that is visited.

Parameters
iteran iterator over the values of a grid or its tree (Grid::ValueOnCIter, Tree::ValueOffIter, etc.)
opan operator object with a method of the form double result(Accessor&, const Coord&)
threadedif true, iterate over the grid in parallel
Note
World-space operators, whose result() methods are of the form double result(const Map&, Accessor&, const Coord&), must be wrapped in a math::MapAdapter.
Vector-valued operators like math::Gradient must be wrapped in an adapter such as math::OpMagnitude.
Example:
Compute statistics of the magnitude of the gradient at the active voxels of a scalar, floating-point grid. (Note the use of the math::MapAdapter and math::OpMagnitude adapters.)
* FloatGrid grid = ...;
*
* // Assume that we know that the grid has a uniform scale map.
* typedef math::UniformScaleMap MapType;
* // Specify a world-space gradient operator that uses first-order differencing.
* typedef math::Gradient<MapType, math::FD_1ST> GradientOp;
* // Wrap the operator with an adapter that computes the magnitude of the gradient.
* typedef math::OpMagnitude<GradientOp, MapType> MagnitudeOp;
* // Wrap the operator with an adapter that associates a map with it.
* typedef math::MapAdapter<MapType, GradientOp, double> CompoundOp;
*
* if (MapType::Ptr map = grid.constTransform().constMap<MapType>()) {
* math::Stats stats = tools::opStatistics(grid.cbeginValueOn(), CompoundOp(*map));
* }
*
Example:
Compute statistics of the divergence at the active voxels of a vector-valued grid.
* Vec3SGrid grid = ...;
*
* // Assume that we know that the grid has a uniform scale map.
* typedef math::UniformScaleMap MapType;
* // Specify a world-space divergence operator that uses first-order differencing.
* typedef math::Divergence<MapType, math::FD_1ST> DivergenceOp;
* // Wrap the operator with an adapter that associates a map with it.
* typedef math::MapAdapter<MapType, DivergenceOp, double> CompoundOp;
*
* if (MapType::Ptr map = grid.constTransform().constMap<MapType>()) {
* math::Stats stats = tools::opStatistics(grid.cbeginValueOn(), CompoundOp(*map));
* }
*
Example:
As above, but computing the divergence in index space.
* Vec3SGrid grid = ...;
*
* // Specify an index-space divergence operator that uses first-order differencing.
* typedef math::ISDivergence<math::FD_1ST> DivergenceOp;
*
* math::Stats stats = tools::opStatistics(grid.cbeginValueOn(), DivergenceOp());
*
void rayTrace ( const GridT &  grid,
const BaseShader &  shader,
BaseCamera &  camera,
size_t  pixelSamples = 1,
unsigned int  seed = 0,
bool  threaded = true 
)
inline

Ray-trace a volume.

void rayTrace ( const GridT &  ,
const IntersectorT &  inter,
const BaseShader &  shader,
BaseCamera &  camera,
size_t  pixelSamples = 1,
unsigned int  seed = 0,
bool  threaded = true 
)
inline

Ray-trace a volume using a given ray intersector.

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.
* FloatGrid::ConstPtr src = tools::makeSphere(...);
* // 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.
* FloatGrid::ConstPtr src = tools::makeSphere(...);
* // 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 an interior region mask from a level set/SDF grid.

Returns
a shared pointer to a new boolean grid with the same tree configuration and transform as the incoming grid and whose active voxels correspond to the interior of the input SDF
Parameters
grida level set/SDF grid
isothreshold below which values 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.

For a level set, the active and negative-valued interior half of the narrow band becomes a linear ramp from 0 to 1; the inactive interior becomes active with a constant value of 1; and the exterior, including the background and the active exterior half of the narrow band, becomes inactive with a constant value of 0. The interior, though active, remains sparse.

For a generic SDF, a specified cutoff distance determines the width of the ramp, but otherwise the result is the same as for a level set.

Parameters
gridlevel set/SDF grid to transform
cutoffDistanceoptional world space cutoff distance for the ramp (automatically clamped if greater than the interior narrow band width)
void setValueOnMax ( TreeT &  tree,
const Coord &  xyz,
const typename TreeT::ValueType &  value 
)
inline

Set the value of the voxel at the given coordinates in tree to the maximum of its current value and value, and mark the voxel as active.

This is typically significantly faster than calling getValue() followed by setValueOn().

Note
TreeT can be either a Tree or a ValueAccessor.
void setValueOnMin ( TreeT &  tree,
const Coord &  xyz,
const typename TreeT::ValueType &  value 
)
inline

Set the value of the voxel at the given coordinates in tree to the minimum of its current value and value, and mark the voxel as active.

This is typically significantly faster than calling getValue() followed by setValueOn().

Note
TreeT can be either a Tree or a ValueAccessor.
void setValueOnMult ( TreeT &  tree,
const Coord &  xyz,
const typename TreeT::ValueType &  value 
)
inline

Set the value of the voxel at the given coordinates in tree to the product of its current value and value, and mark the voxel as active.

This is typically significantly faster than calling getValue() followed by setValueOn().

Note
TreeT can be either a Tree or a ValueAccessor.
void setValueOnSum ( TreeT &  tree,
const Coord &  xyz,
const typename TreeT::ValueType &  value 
)
inline

Set the value of the voxel at the given coordinates in tree to the sum of its current value and value, and mark the voxel as active.

This is typically significantly faster than calling getValue() followed by setValueOn().

Note
TreeT can be either a Tree or a ValueAccessor.
math::Stats statistics ( const IterT &  iter,
bool  threaded = true 
)
inline

Iterate over a scalar grid and compute statistics (mean, variance, etc.) of the values of the voxels that are visited, or iterate over a vector-valued grid and compute statistics of the magnitudes of the vectors.

Parameters
iteran iterator over the values of a grid or its tree (Grid::ValueOnCIter, Tree::ValueOffIter, etc.)
threadedif true, iterate over the grid in parallel
math::Stats statistics ( const IterT &  iter,
const ValueOp &  op,
bool  threaded 
)
inline

Iterate over a grid and compute statistics (mean, variance, etc.) of the values produced by applying the given functor at each voxel that is visited.

Parameters
iteran iterator over the values of a grid or its tree (Grid::ValueOnCIter, Tree::ValueOffIter, etc.)
opa functor of the form void op(const IterT&, math::Stats&), where IterT is the type of iter, that inserts zero or more floating-point values into the provided math::Stats object
threadedif true, iterate over the grid in parallel
Note
When threaded is true, each thread gets its own copy of the functor.
Example:
Compute statistics of just the active and positive-valued voxels of a scalar, floating-point grid.
* struct Local {
* static inline
* void addIfPositive(const FloatGrid::ValueOnCIter& iter, math::Stats& stats)
* {
* const float f = *iter;
* if (f > 0.0) {
* if (iter.isVoxelValue()) stats.add(f);
* else stats.add(f, iter.getVoxelCount());
* }
* }
* };
* FloatGrid grid = ...;
* math::Stats stats =
* tools::statistics(grid.cbeginValueOn(), Local::addIfPositive, /*threaded=*/true);
*
void transformValues ( const InIterT &  inIter,
OutGridT &  outGrid,
XformOp &  op,
bool  threaded = true,
bool  shareOp = true,
MergePolicy  merge = MERGE_ACTIVE_STATES 
)
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 original functor
mergehow to merge intermediate results from multiple threads (see Types.h)
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);
*
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,
MergePolicy  merge = MERGE_ACTIVE_STATES 
)
inline
void volumeToMesh ( const GridType &  grid,
std::vector< Vec3s > &  points,
std::vector< Vec4I > &  quads,
double  isovalue = 0.0 
)

Uniformly mesh any scalar grid that has a continuous isosurface.

Parameters
grida scalar grid to mesh
pointsoutput list of world space points
quadsoutput quad index list
isovaluedetermines which isosurface to mesh
void volumeToMesh ( const GridType &  grid,
std::vector< Vec3s > &  points,
std::vector< Vec3I > &  triangles,
std::vector< Vec4I > &  quads,
double  isovalue = 0.0,
double  adaptivity = 0.0 
)
inline

Adaptively mesh any scalar grid that has a continuous isosurface.

Parameters
grida scalar grid to mesh
pointsoutput list of world space points
trianglesoutput quad index list
quadsoutput quad index list
isovaluedetermines which isosurface to mesh
adaptivitysurface adaptivity threshold [0 to 1]