OpenVDB: openvdb::v12_0::tools Namespace Reference

OpenVDB 12.0.1 |

Loading...
Searching...
No Matches
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
openvdb::v12_0::tools Namespace Reference

## Namespaces
namespace | composite
namespace | ds
namespace | gridop
namespace | local_util
namespace | lstrack
namespace | morphology
namespace | poisson
namespace | Scheme
namespace | valxform

## Classes
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...
class | AlphaMask
class | BaseCamera
| Abstract base class for the perspective and orthographic cameras. More...
class | BasePointScatter
| Forward declaration of base class. More...
class | BaseShader
| Abstract base class for the shaders. More...
struct | BoxSampler
class | ChangeBackgroundOp
class | ChangeLevelSetBackgroundOp
struct | CheckDivergence
| Checks the divergence against a range. More...
struct | CheckEikonal
| Checks the norm of the gradient at zero-crossing voxels against a range. More...
struct | CheckFinite
| Checks for both NaN and inf values, i.e. any value that is not finite. More...
class | CheckFogVolume
| Class that performs various types of checks on fog volumes. More...
struct | CheckInf
| Checks for infinite values, e.g. 1/0 or -1/0. More...
class | CheckLevelSet
| Class that performs various types of checks on narrow-band level sets. More...
struct | CheckMagnitude
| Check that the magnitude of a value, a, is close to a fixed magnitude, b, given a fixed tolerance c. That is | |a| - |b| | <= c. More...
struct | CheckMax
| Checks a value against a maximum. More...
struct | CheckMin
| Checks a value against a minimum. More...
struct | CheckNan
| Checks NaN values. More...
struct | CheckNormGrad
| Checks the norm of the gradient against a range, i.e., |∇Φ| ∈ [min, max]. More...
struct | CheckRange
| Checks a value against a range. More...
class | ClosestPointProjector
class | ClosestSurfacePoint
| Accelerated closest surface point queries for narrow band level sets. More...
struct | CompReplaceOp
class | ConstrainedPointAdvect
struct | ContiguousOp
| a wrapper struct used to avoid unnecessary computation of memory access from `Coord` when all offsets are guaranteed to be within the dense grid. More...
class | CopyFromDense
| Copy the values from a dense grid into an OpenVDB tree. More...
class | CopyToDense
| Copy an OpenVDB tree into an existing dense grid. More...
class | Cpt
| Compute the closest-point transform of a scalar grid. More...
struct | CsgDifferenceOp
| DynamicNodeManager operator to merge two trees using a CSG difference. More...
struct | CsgUnionOrIntersectionOp
| DynamicNodeManager operator to merge trees using a CSG union or intersection. More...
class | Curl
| Compute the curl of a vector grid. More...
class | Dense
| Dense is a simple dense grid API used by the CopyToDense and CopyFromDense classes defined below. More...
class | DenseBase
| Base class for Dense which is defined below. More...
class | DenseBase< ValueT, LayoutXYZ >
| Partial template specialization of DenseBase. More...
class | DenseBase< ValueT, LayoutZYX >
| Partial template specialization of DenseBase. More...
class | DenseTransformer
| Class that applies a functor to the index space intersection of a prescribed bounding box and the dense grid. NB: This class only supports DenseGrids with ZYX memory layout. More...
class | DenseUniformPointScatter
| Scatters a fixed (and integer) number of points in all active voxels and tiles. More...
struct | DepthFirstNodeVisitor
| Visit all nodes that are downstream of a specific node in depth-first order and apply a user-supplied functor to each node. More...
struct | DepthFirstNodeVisitor< NodeT, 0 >
class | Diagnose
| Performs multithreaded diagnostics of a grid. More...
class | DiffuseShader
| Simple diffuse Lambertian surface shader. More...
class | DiffuseShader< Film::RGBA, SamplerType >
class | DiracDelta
| Smeared-out and continuous Dirac Delta function. More...
class | DiscreteField
| Thin wrapper class for a velocity grid. More...
class | Divergence
| Compute the divergence of a vector grid. More...
struct | DSConverter
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 | DualGridSampler< tree::ValueAccessor< TreeT >, SamplerT >
| Specialization of DualGridSampler for construction from a ValueAccessor type. More...
class | EnrightField
| Analytical, divergence-free and periodic velocity field. More...
struct | ExtractAll
| a simple utility class used by `extractSparseTreeWithMask` More...
class | FastSweeping
| Computes signed distance values from an initial iso-surface and optionally performs velocity extension at the same time. This is done by means of a novel sparse and parallel fast sweeping algorithm based on a first order Godunov's scheme. More...
class | Film
| A simple class that allows for concurrent writes to pixels in an image, background initialization of the image, and PPM file output. More...
class | Filter
| Volume filtering (e.g., diffusion) with optional alpha masking. More...
class | FindActiveValues
| Finds the active values in a tree which intersects a bounding box. More...
class | Gradient
| Compute the gradient of a scalar grid. More...
class | GridResampler
class | GridSampler
| Class that provides the interface for continuous sampling of values in a tree. More...
class | GridSampler< tree::ValueAccessor< TreeT >, SamplerType >
| Specialization of GridSampler for construction from a ValueAccessor type. More...
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...
struct | HalfWidthOp
struct | HalfWidthOp< bool >
struct | HomogeneousMatMul
class | InactivePruneOp
class | Laplacian
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 | LevelSetMeasure
| Multi-threaded computation of surface area, volume and average mean-curvature for narrow band level sets. More...
class | LevelSetMorphing
| Shape morphology of level sets. Morphing from a source narrow-band level sets to a target narrow-band level set. More...
class | LevelSetPruneOp
class | LevelSetRayIntersector
| This class provides the public API for intersecting a ray with a narrow-band level set. More...
class | LevelSetRayTracer
| A (very) simple multithreaded ray tracer specifically for 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 | LinearSearchImpl
| Implements linear iterative search for an iso-value of the level set along the direction of the ray. More...
class | Magnitude
struct | MatMul
struct | MatMulNormalize
class | MatteShader
| Shader that produces a simple matte. More...
class | MatteShader< Film::RGBA, SamplerType >
class | MeanCurvature
class | MeshToVoxelEdgeData
| Extracts and stores voxel edge intersection data from a mesh. More...
class | MultiResGrid
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 (called pointsPerVolume) and the local voxel (or tile) value. More...
class | Normalize
class | NormalShader
| Color shader that treats the surface normal (x, y, z) as an RGB color. More...
class | NormalShader< Film::RGBA, SamplerType >
class | OrthographicCamera
struct | ParticleAtlas
class | ParticlesToLevelSet
class | PerspectiveCamera
class | PointAdvect
struct | PointIndexFilter
struct | PointIndexIterator
| Accelerated range and nearest-neighbor searches for point index grids. More...
struct | PointIndexLeafNode
class | PointPartitioner
struct | PointSampler
class | PointsToMask
| Makes every voxel of a grid active if it contains a point. More...
class | PolygonPool
| Collection of quads and triangles. More...
class | PositionShader
| Color shader that treats position (x, y, z) as an RGB color in a cube defined from an axis-aligned bounding box in world space. More...
class | PositionShader< Film::RGBA, SamplerType >
struct | QuadAndTriangleDataAdapter
| Contiguous quad and triangle data adapter class. More...
struct | QuadraticSampler
struct | Sampler
| Provises a unified interface for sampling, i.e. interpolation. More...
struct | Sampler< 0, false >
struct | Sampler< 0, true >
struct | Sampler< 1, false >
struct | Sampler< 1, true >
struct | Sampler< 2, false >
struct | Sampler< 2, true >
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 | SignedFloodFillOp
class | SparseExtractor
| Functor-based class used to extract data that satisfies some criteria defined by the embedded `OpType` functor. The `extractSparseTree` function wraps this class. More...
class | SparseMaskedExtractor
| Functor-based class used to extract data from a dense grid, at the index-space intersection with a supplied mask in the form of a sparse tree. The `extractSparseTreeWithMask` function wraps this class. More...
class | SparseToDenseCompositor
struct | StaggeredBoxSampler
struct | StaggeredPointSampler
struct | StaggeredQuadraticSampler
struct | SumMergeOp
| DynamicNodeManager operator to merge trees using a sum operation. More...
struct | TileData
| Struct that encodes a bounding box, value and level of a tile. More...
class | TolerancePruneOp
struct | TreeToMerge
| Convenience class that contains a pointer to a tree to be stolen or deep copied depending on the tag dispatch class used and a subset of methods to retrieve data from the tree. More...
class | UniformPointScatter
| The two point scatters UniformPointScatter and NonUniformPointScatter depend on the following two classes: 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 | VectorToScalarGrid
| Metafunction to convert a vector-valued grid type to a scalar grid type. More...
class | VelocityIntegrator
| Performs Runge-Kutta time integration of variable order in a static velocity field. More...
class | VelocitySampler
class | VolumeAdvection
| Performs advections of an arbitrary type of volume in a static velocity field. The advections are performed by means of various derivatives of Semi-Lagrangian integration, i.e. backwards tracking along the hyperbolic characteristics followed by interpolation. More...
class | VolumeRayIntersector
| This class provides the public API for intersecting a ray with a generic (e.g. density) volume. More...
class | VolumeRender
| A (very) simple multithreaded volume render specifically for scalar density. More...
struct | VolumeToMesh
| Mesh any scalar grid that has a continuous isosurface. More...

## Typedefs
template<typename TreeT>
using | CsgUnionOp = CsgUnionOrIntersectionOp<TreeT, true>
template<typename TreeT>
using | CsgIntersectionOp = CsgUnionOrIntersectionOp<TreeT, false>
using | ParticleIndexAtlas = ParticleAtlas<PointIndexGrid>
using | PointIndexTree
| Point index tree configured to match the default OpenVDB tree configuration.
using | PointIndexGrid = Grid<PointIndexTree>
| Point index grid.
using | UInt32PointPartitioner = PointPartitioner<uint32_t, 3>
using | OutTreeT = typename Adapter::TreeType
using | Processor = typename valxform::SharedOpTransformer<InIterT, OutTreeT, const XformOp>
using | PointList = std::unique_ptr<openvdb::Vec3s[]>
| Point and primitive list types.
using | PolygonPoolList = std::unique_ptr<PolygonPool[]>
| Point and primitive list types.

## Enumerations
enum | MemoryLayout { LayoutXYZ , LayoutZYX }
enum | DSCompositeOp { DS_OVER , DS_ADD , DS_SUB , DS_MIN , DS_MAX , DS_MULT , DS_SET }
enum class | FastSweepingDomain { SWEEP_ALL , SWEEP_GREATER_THAN_ISOVALUE , SWEEP_LESS_THAN_ISOVALUE }
| Fast Sweeping update mode. This is useful to determine narrow-band extension or field extension in one side of a signed distance field. More...
enum | MeshToVolumeFlags { UNSIGNED_DISTANCE_FIELD = 0x1 , DISABLE_INTERSECTING_VOXEL_REMOVAL = 0x2 , DISABLE_RENORMALIZATION = 0x4 , DISABLE_NARROW_BAND_TRIMMING = 0x8 }
| Mesh to volume conversion flags. More...
enum | InteriorTestStrategy { EVAL_EVERY_VOXEL = 0 , EVAL_EVERY_TILE = 1 }
| Different staregies how to determine sign of an SDF when using interior test. More...
enum | NearestNeighbors { NN_FACE = 6 , NN_FACE_EDGE = 18 , NN_FACE_EDGE_VERTEX = 26 }
| Voxel topology of nearest neighbors. More...
enum | TilePolicy { IGNORE_TILES , EXPAND_TILES , PRESERVE_TILES }
| Different policies when dilating trees with active tiles. More...
enum | { POLYFLAG_EXTERIOR = 0x1 , POLYFLAG_FRACTURE_SEAM = 0x2 , POLYFLAG_SUBDIVIDED = 0x4 }
| Polygon flags, used for reference based meshing. More...

## Functions
template<typename GridOrTree>
void | activate (GridOrTree &, const typename GridOrTree::ValueType &value, const typename GridOrTree::ValueType &tolerance=zeroVal< typename GridOrTree::ValueType >(), const bool threaded=true)
| 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).
template<typename GridOrTree>
void | deactivate (GridOrTree &, const typename GridOrTree::ValueType &value, const typename GridOrTree::ValueType &tolerance=zeroVal< typename GridOrTree::ValueType >(), const bool threaded=true)
| 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).
template<typename TreeOrLeafManagerT>
void | changeBackground (TreeOrLeafManagerT &tree, const typename TreeOrLeafManagerT::ValueType &background, bool threaded=true, size_t grainSize=32)
| Replace the background value in all the nodes of a tree.
template<typename TreeOrLeafManagerT>
void | changeLevelSetBackground (TreeOrLeafManagerT &tree, const typename TreeOrLeafManagerT::ValueType &halfWidth, bool threaded=true, size_t grainSize=32)
| Replace the background value in all the nodes of a floating-point tree containing a symmetric narrow-band level set.
template<typename TreeOrLeafManagerT>
void | changeAsymmetricLevelSetBackground (TreeOrLeafManagerT &tree, const typename TreeOrLeafManagerT::ValueType &outsideWidth, const typename TreeOrLeafManagerT::ValueType &insideWidth, bool threaded=true, size_t grainSize=32)
| Replace the background values in all the nodes of a floating-point tree containing a possibly asymmetric narrow-band level set.
template<typename GridType>
GridType::Ptr | clip (const GridType &grid, const BBoxd &bbox, bool keepInterior=true)
| Clip the given grid against a world-space bounding box and return a new grid containing the result.
template<typename GridType>
GridType::Ptr | clip (const GridType &grid, const math::NonlinearFrustumMap &frustum, bool keepInterior=true)
| Clip the given grid against a frustum and return a new grid containing the result.
template<typename GridType, typename MaskTreeType>
GridType::Ptr | clip (const GridType &grid, const Grid< MaskTreeType > &mask, bool keepInterior=true)
| Clip a grid against the active voxels of another grid and return a new grid containing the result.
template<typename GridOrTreeT>
void | csgUnion (GridOrTreeT &a, GridOrTreeT &b, bool prune=true, bool pruneCancelledTiles=false)
| Given two level set grids, replace the A grid with the union of A and B.
template<typename GridOrTreeT>
void | csgIntersection (GridOrTreeT &a, GridOrTreeT &b, bool prune=true, bool pruneCancelledTiles=false)
| Given two level set grids, replace the A grid with the intersection of A and B.
template<typename GridOrTreeT>
void | csgDifference (GridOrTreeT &a, GridOrTreeT &b, bool prune=true, bool pruneCancelledTiles=false)
| Given two level set grids, replace the A grid with the difference A / B.
template<typename GridOrTreeT>
GridOrTreeT::Ptr | csgUnionCopy (const GridOrTreeT &a, const GridOrTreeT &b)
| Threaded CSG union operation that produces a new grid or tree from immutable inputs.
template<typename GridOrTreeT>
GridOrTreeT::Ptr | csgIntersectionCopy (const GridOrTreeT &a, const GridOrTreeT &b)
| Threaded CSG intersection operation that produces a new grid or tree from immutable inputs.
template<typename GridOrTreeT>
GridOrTreeT::Ptr | csgDifferenceCopy (const GridOrTreeT &a, const GridOrTreeT &b)
| Threaded CSG difference operation that produces a new grid or tree from immutable inputs.
template<typename GridOrTreeT>
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.
template<typename GridOrTreeT>
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.
template<typename GridOrTreeT>
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.
template<typename GridOrTreeT>
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.
template<typename GridOrTreeT>
void | compDiv (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.
template<typename GridOrTreeT>
void | compReplace (GridOrTreeT &a, const GridOrTreeT &b)
| Copy the active voxels of B into A.
template<typename TreeT, typename OpT = composite::CopyOp<TreeT>>
void | compActiveLeafVoxels (TreeT &srcTree, TreeT &dstTree, OpT op=composite::CopyOp< TreeT >())
| Composite the active values in leaf nodes, i.e. active voxels, of a source tree into a destination tree.
template<typename TreeT>
Index64 | countActiveVoxels (const TreeT &tree, bool threaded=true)
| Return the total number of active voxels in the tree.
template<typename TreeT>
Index64 | countActiveVoxels (const TreeT &tree, const CoordBBox &bbox, bool threaded=true)
| Return the total number of active voxels in the tree that intersects a bounding box.
template<typename TreeT>
Index64 | countActiveLeafVoxels (const TreeT &tree, bool threaded=true)
| Return the total number of active voxels stored in leaf nodes.
template<typename TreeT>
Index64 | countActiveLeafVoxels (const TreeT &tree, const CoordBBox &bbox, bool threaded=true)
| Return the total number of active voxels stored in leaf nodes that intersects a bounding box.
template<typename TreeT>
Index64 | countInactiveVoxels (const TreeT &tree, bool threaded=true)
| Return the total number of inactive voxels in the tree.
template<typename TreeT>
Index64 | countInactiveLeafVoxels (const TreeT &tree, bool threaded=true)
| Return the total number of inactive voxels stored in leaf nodes.
template<typename TreeT>
Index64 | countActiveTiles (const TreeT &tree, bool threaded=true)
| Return the total number of active tiles in the tree.
template<typename TreeT>
Index64 | memUsage (const TreeT &tree, bool threaded=true)
| Return the total amount of memory in bytes occupied by this tree.
template<typename TreeT>
Index64 | memUsageIfLoaded (const TreeT &tree, bool threaded=true)
| Return the deserialized memory usage of this tree. This is not necessarily equal to the current memory usage (returned by tools::memUsage) if delay-loading is enabled. See File::open.
template<typename TreeT>
math::MinMax< typename TreeT::ValueType > | minMax (const TreeT &tree, bool threaded=true)
| Return the minimum and maximum active values in this tree.
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.
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.
template<typename OpType, typename DenseType>
OpType::ResultTreeType::Ptr | extractSparseTree (const DenseType &dense, const OpType &functor, const typename OpType::ResultValueType &background, bool threaded=true)
| Selectively extract and transform data from a dense grid, producing a sparse tree with leaf nodes only (e.g. create a tree from the square of values greater than a cutoff.)
template<typename DenseType, typename MaskTreeType>
DSConverter< DenseType, MaskTreeType >::Type::Ptr | extractSparseTreeWithMask (const DenseType &dense, const MaskTreeType &mask, const typename DenseType::ValueType &background, bool threaded=true)
| Copy data from the intersection of a sparse tree and a dense input grid. The resulting tree has the same configuration as the sparse tree, but holds the data type specified by the dense input.
template<typename ValueT, typename OpType>
void | transformDense (Dense< ValueT, openvdb::tools::LayoutZYX > &dense, const openvdb::CoordBBox &bbox, const OpType &op, bool parallel=true)
template<DSCompositeOp, typename TreeT>
void | compositeToDense (Dense< typename TreeT::ValueType, LayoutZYX > &dense, const TreeT &source, const TreeT &alpha, const typename TreeT::ValueType beta, const typename TreeT::ValueType strength, bool threaded=true)
| Composite data from a sparse tree into a dense array of the same value type.
template<typename ValueT, typename PointwiseOpT>
void | transformDense (Dense< ValueT, openvdb::tools::LayoutZYX > &dense, const openvdb::CoordBBox &bbox, const PointwiseOpT &functor, bool parallel)
| Apply a point-wise functor to the intersection of a dense grid and a given bounding box.
template<class GridType>
std::string | checkLevelSet (const GridType &grid, size_t number=9)
| Perform checks on a grid to see if it is a valid symmetric, narrow-band level set.
template<class GridType>
std::string | checkFogVolume (const GridType &grid, size_t number=6)
| Perform checks on a grid to see if it is a valid fog volume.
template<class GridType>
bool | uniqueInactiveValues (const GridType &grid, std::vector< typename GridType::ValueType > &values, size_t numValues)
| Threaded method to find unique inactive values.
template<typename GridT>
GridT::Ptr | fogToSdf (const GridT &fogGrid, typename GridT::ValueType isoValue, int nIter=1)
| Converts a scalar fog volume into a signed distance function. Active input voxels with scalar values above the given isoValue will have NEGATIVE distance values on output, i.e. they are assumed to be INSIDE the iso-surface.
template<typename GridT>
GridT::Ptr | sdfToSdf (const GridT &sdfGrid, typename GridT::ValueType isoValue=0, int nIter=1)
| Given an existing approximate SDF it solves the Eikonal equation for all its active voxels. Active input voxels with a signed distance value above the given isoValue will have POSITIVE distance values on output, i.e. they are assumed to be OUTSIDE the iso-surface.
template<typename FogGridT, typename ExtOpT, typename ExtValueT>
FogGridT::template ValueConverter< ExtValueT >::Type::Ptr | fogToExt (const FogGridT &fogGrid, const ExtOpT &op, const ExtValueT &background, typename FogGridT::ValueType isoValue, int nIter=1, FastSweepingDomain mode=FastSweepingDomain::SWEEP_ALL, const typename FogGridT::template ValueConverter< ExtValueT >::Type::ConstPtr extGrid=nullptr)
| Computes the extension of a field (scalar, vector, or int are supported), defined by the specified functor, off an iso-surface from an input FOG volume.
template<typename SdfGridT, typename ExtOpT, typename ExtValueT>
SdfGridT::template ValueConverter< ExtValueT >::Type::Ptr | sdfToExt (const SdfGridT &sdfGrid, const ExtOpT &op, const ExtValueT &background, typename SdfGridT::ValueType isoValue=0, int nIter=1, FastSweepingDomain mode=FastSweepingDomain::SWEEP_ALL, const typename SdfGridT::template ValueConverter< ExtValueT >::Type::ConstPtr extGrid=nullptr)
| Computes the extension of a field (scalar, vector, or int are supported), defined by the specified functor, off an iso-surface from an input SDF volume.
template<typename FogGridT, typename ExtOpT, typename ExtValueT>
std::pair< typename FogGridT::Ptr, typename FogGridT::template ValueConverter< ExtValueT >::Type::Ptr > | fogToSdfAndExt (const FogGridT &fogGrid, const ExtOpT &op, const ExtValueT &background, typename FogGridT::ValueType isoValue, int nIter=1, FastSweepingDomain mode=FastSweepingDomain::SWEEP_ALL, const typename FogGridT::template ValueConverter< ExtValueT >::Type::ConstPtr extGrid=nullptr)
| Computes the signed distance field and the extension of a field (scalar, vector, or int are supported), defined by the specified functor, off an iso-surface from an input FOG volume.
template<typename SdfGridT, typename ExtOpT, typename ExtValueT>
std::pair< typename SdfGridT::Ptr, typename SdfGridT::template ValueConverter< ExtValueT >::Type::Ptr > | sdfToSdfAndExt (const SdfGridT &sdfGrid, const ExtOpT &op, const ExtValueT &background, typename SdfGridT::ValueType isoValue=0, int nIter=1, FastSweepingDomain mode=FastSweepingDomain::SWEEP_ALL, const typename SdfGridT::template ValueConverter< ExtValueT >::Type::ConstPtr extGrid=nullptr)
| Computes the signed distance field and the extension of a field (scalar, vector, or int are supported), defined by the specified functor, off an iso-surface from an input SDF volume.
template<typename GridT>
GridT::Ptr | dilateSdf (const GridT &sdfGrid, int dilation, NearestNeighbors nn=NN_FACE, int nIter=1, FastSweepingDomain mode=FastSweepingDomain::SWEEP_ALL)
| Dilates the narrow band of an existing signed distance field by a specified number of voxels (like adding "onion-rings").
template<typename GridT, typename MaskTreeT>
GridT::Ptr | maskSdf (const GridT &sdfGrid, const Grid< MaskTreeT > &mask, bool ignoreActiveTiles=false, int nIter=1)
| Fills mask by extending an existing signed distance field into the active values of this input ree of arbitrary value type.
template<typename SdfGridT, typename OpT, typename ExtValueT>
SdfGridT::template ValueConverter< ExtValueT >::Type::Ptr | sdfToExt (const SdfGridT &sdfGrid, const OpT &op, const ExtValueT &background, typename SdfGridT::ValueType isoValue, int nIter, FastSweepingDomain mode, const typename SdfGridT::template ValueConverter< ExtValueT >::Type::ConstPtr extGrid)
template<typename TreeT>
bool | anyActiveValues (const TreeT &tree, const CoordBBox &bbox)
| Returns true if the bounding box intersects any of the active values in a tree, i.e. either active voxels or active tiles.
template<typename TreeT>
bool | anyActiveVoxels (const TreeT &tree, const CoordBBox &bbox)
| Returns true if the bounding box intersects any of the active voxels in a tree, i.e. ignores active tile values.
template<typename TreeT>
bool | anyActiveTiles (const TreeT &tree, const CoordBBox &bbox)
| Returns true if the bounding box intersects any of the active tiles in a tree, i.e. ignores active leaf values.
template<typename TreeT>
bool | noActiveValues (const TreeT &tree, const CoordBBox &bbox)
| Returns true if the bounding box intersects none of the active values in a tree, i.e. neither active voxels or active tiles.
template<typename TreeT>
Index64 | countActiveValues (const TreeT &tree, const CoordBBox &bbox)
| Returns the number of active values that intersects a bounding box intersects, i.e. the count includes both active voxels and virtual voxels in active tiles.
template<typename TreeT>
std::vector< TileData< typename TreeT::ValueType > > | activeTiles (const TreeT &tree, const CoordBBox &bbox)
| Return a vector with bounding boxes that represents all the intersections between active tiles in the tree and the specified bounding box.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
template<class GridType>
Real | levelSetVolume (const GridType &grid, bool useWorldSpace=true)
| Return the volume of a narrow-band level set surface.
template<class GridType>
int | levelSetEulerCharacteristic (const GridType &grid)
| Return the Euler Characteristics of a narrow-band level set surface (possibly disconnected).
template<class GridType>
int | levelSetGenus (const GridType &grid)
| Return the genus of a narrow-band level set surface.
template<class GridT>
Real | levelSetArea (const GridT &grid, bool useWorldUnits)
template<class GridT>
Real | levelSetVolume (const GridT &grid, bool useWorldUnits)
template<class GridT>
int | levelSetEulerCharacteristic (const GridT &grid)
template<class GridT>
int | levelSetGenus (const GridT &grid)
template<typename GridType, typename InterruptT>
GridType::Ptr | createLevelSetPlatonic (int faceCount, float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
| Return a grid of type `GridType` containing a narrow-band level set representation of a platonic solid.
template<typename GridType>
GridType::Ptr | createLevelSetPlatonic (int faceCount, float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
| Return a grid of type `GridType` containing a narrow-band level set representation of a platonic solid.
template<typename GridType, typename InterruptT>
GridType::Ptr | createLevelSetTetrahedron (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
| Return a grid of type `GridType` containing a narrow-band level set representation of a tetrahedron.
template<typename GridType>
GridType::Ptr | createLevelSetTetrahedron (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
| Return a grid of type `GridType` containing a narrow-band level set representation of a tetrahedron.
template<typename GridType, typename InterruptT>
GridType::Ptr | createLevelSetCube (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
| Return a grid of type `GridType` containing a narrow-band level set representation of a cube.
template<typename GridType>
GridType::Ptr | createLevelSetCube (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
| Return a grid of type `GridType` containing a narrow-band level set representation of a cube.
template<typename GridType, typename InterruptT>
GridType::Ptr | createLevelSetOctahedron (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
| Return a grid of type `GridType` containing a narrow-band level set representation of an octahedron.
template<typename GridType>
GridType::Ptr | createLevelSetOctahedron (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
| Return a grid of type `GridType` containing a narrow-band level set representation of an octahedron.
template<typename GridType, typename InterruptT>
GridType::Ptr | createLevelSetDodecahedron (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
| Return a grid of type `GridType` containing a narrow-band level set representation of a dodecahedron.
template<typename GridType>
GridType::Ptr | createLevelSetDodecahedron (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
| Return a grid of type `GridType` containing a narrow-band level set representation of a dodecahedron.
template<typename GridType, typename InterruptT>
GridType::Ptr | createLevelSetIcosahedron (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH), InterruptT *interrupt=nullptr)
| Return a grid of type `GridType` containing a narrow-band level set representation of an icosahedron.
template<typename GridType>
GridType::Ptr | createLevelSetIcosahedron (float scale=1.0f, const Vec3f &center=Vec3f(0.0f), float voxelSize=0.1f, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
| Return a grid of type `GridType` containing a narrow-band level set representation of an icosahedron.
template<class GridType>
GridType::Ptr | levelSetRebuild (const GridType &grid, float isovalue=0, float halfWidth=float(LEVEL_SET_HALF_WIDTH), const math::Transform *xform=nullptr)
| Return a new grid of type `GridType` that contains a narrow-band level set representation of an isosurface of a given grid.
template<class GridType>
GridType::Ptr | levelSetRebuild (const GridType &grid, float isovalue, float exBandWidth, float inBandWidth, const math::Transform *xform=nullptr)
| Return a new grid of type `GridType` that contains a narrow-band level set representation of an isosurface of a given grid.
template<class GridType, typename InterruptT>
GridType::Ptr | levelSetRebuild (const GridType &grid, float isovalue, float exBandWidth, float inBandWidth, const math::Transform *xform=nullptr, InterruptT *interrupter=nullptr)
| Return a new grid of type `GridType` that contains a narrow-band level set representation of an isosurface of a given grid.
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=nullptr, bool threaded=true)
| Return a grid of type `GridType` containing a narrow-band level set representation of a sphere.
template<typename GridType>
GridType::Ptr | createLevelSetSphere (float radius, const openvdb::Vec3f &center, float voxelSize, float halfWidth=float(LEVEL_SET_HALF_WIDTH), bool threaded=true)
| Return a grid of type `GridType` containing a narrow-band level set representation of a sphere.
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.
template<class GridOrTreeType>
GridOrTreeType::template ValueConverter< bool >::Type::Ptr | sdfInteriorMask (const GridOrTreeType &volume, typename GridOrTreeType::ValueType isovalue=lsutilGridZero< GridOrTreeType >())
| Threaded method to construct a boolean mask that represents interior regions in a signed distance field.
template<typename GridOrTreeType>
GridOrTreeType::template ValueConverter< bool >::Type::Ptr | extractEnclosedRegion (const GridOrTreeType &volume, typename GridOrTreeType::ValueType isovalue=lsutilGridZero< GridOrTreeType >(), const typename TreeAdapter< GridOrTreeType >::TreeType::template ValueConverter< bool >::Type *fillMask=nullptr)
| Extracts the interior regions of a signed distance field and topologically enclosed (watertight) regions of value greater than the isovalue (cavities) that can arise as the result of CSG union operations between different shapes where at least one of the shapes has a concavity that is capped.
template<typename GridOrTreeType>
GridOrTreeType::template ValueConverter< bool >::Type::Ptr | extractIsosurfaceMask (const GridOrTreeType &volume, typename GridOrTreeType::ValueType isovalue)
| Return a mask of the voxels that intersect the implicit surface with the given isovalue.
template<typename GridOrTreeType>
void | extractActiveVoxelSegmentMasks (const GridOrTreeType &volume, std::vector< typename GridOrTreeType::template ValueConverter< bool >::Type::Ptr > &masks)
| Return a mask for each connected component of the given grid's active voxels.
template<typename GridOrTreeType>
void | segmentActiveVoxels (const GridOrTreeType &volume, std::vector< typename GridOrTreeType::Ptr > &segments)
| Separates disjoint active topology components into distinct grids or trees.
template<typename GridOrTreeType>
void | segmentSDF (const GridOrTreeType &volume, std::vector< typename GridOrTreeType::Ptr > &segments)
| Separates disjoint SDF surfaces into distinct grids or trees.
template<class GridType>
OPENVDB_DOCS_INTERNAL void | sdfToFogVolume (GridType &grid, typename GridType::ValueType cutoffDistance)
| Threaded method to convert a sparse level set/SDF into a sparse fog volume.
template<typename GridType>
GridType::template ValueConverter< bool >::Type::Ptr | interiorMask (const GridType &grid, const double isovalue=0.0)
| Given an input grid of any type, return a new, boolean grid whose active voxel topology matches the input grid's or, if the input grid is a level set, matches the input grid's interior.
template<typename GridType, typename MeshDataAdapter, typename InteriorTest = std::nullptr_t>
GridType::Ptr | meshToVolume (const MeshDataAdapter &mesh, const math::Transform &transform, float exteriorBandWidth=3.0f, float interiorBandWidth=3.0f, int flags=0, typename GridType::template ValueConverter< Int32 >::Type *polygonIndexGrid=nullptr, InteriorTest interiorTest=nullptr, InteriorTestStrategy interiorTestStrat=EVAL_EVERY_VOXEL)
template<typename GridType, typename MeshDataAdapter, typename Interrupter, typename InteriorTest = std::nullptr_t>
GridType::Ptr | meshToVolume (Interrupter &interrupter, const MeshDataAdapter &mesh, const math::Transform &transform, float exteriorBandWidth=3.0f, float interiorBandWidth=3.0f, int flags=0, typename GridType::template ValueConverter< Int32 >::Type *polygonIndexGrid=nullptr, InteriorTest interiorTest=nullptr, InteriorTestStrategy interiorTestStrategy=EVAL_EVERY_VOXEL)
| Convert polygonal meshes that consist of quads and/or triangles into signed or unsigned distance field volumes.
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.
template<typename GridType, typename Interrupter>
GridType::Ptr | meshToLevelSet (Interrupter &interrupter, const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
| Adds support for a interrupter callback used to cancel the conversion.
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.
template<typename GridType, typename Interrupter>
GridType::Ptr | meshToLevelSet (Interrupter &interrupter, const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec4I > &quads, float halfWidth=float(LEVEL_SET_HALF_WIDTH))
| Adds support for a interrupter callback used to cancel the conversion.
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.
template<typename GridType, typename Interrupter>
GridType::Ptr | meshToLevelSet (Interrupter &interrupter, 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))
| Adds support for a interrupter callback used to cancel the conversion.
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.
template<typename GridType, typename Interrupter>
GridType::Ptr | meshToSignedDistanceField (Interrupter &interrupter, const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float exBandWidth, float inBandWidth)
| Adds support for a interrupter callback used to cancel the conversion.
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.
template<typename GridType, typename Interrupter>
GridType::Ptr | meshToUnsignedDistanceField (Interrupter &interrupter, const openvdb::math::Transform &xform, const std::vector< Vec3s > &points, const std::vector< Vec3I > &triangles, const std::vector< Vec4I > &quads, float bandWidth)
| Adds support for a interrupter callback used to cancel the conversion.
template<typename GridType, typename VecType>
GridType::Ptr | createLevelSetBox (const math::BBox< VecType > &bbox, const openvdb::math::Transform &xform, typename VecType::ValueType halfWidth=LEVEL_SET_HALF_WIDTH)
| Return a grid of type `GridType` containing a narrow-band level set representation of a box.
template<typename FloatTreeT>
void | traceExteriorBoundaries (FloatTreeT &tree)
| Traces the exterior voxel boundary of closed objects in the input volume tree. Exterior voxels are marked with a negative sign, voxels with a value below `0.75` are left unchanged and act as the boundary layer.
template<typename T, Index Log2Dim, typename InteriorTest>
void | floodFillLeafNode (tree::LeafNode< T, Log2Dim > &leafNode, const InteriorTest &interiorTest)
template<typename FloatTreeT, typename InteriorTest>
void | evaluateInteriorTest (FloatTreeT &tree, InteriorTest interiorTest, InteriorTestStrategy interiorTestStrategy)
| Sets the sign of voxel values of `tree` based on the `interiorTest`
std::ostream & | operator<< (std::ostream &ostr, const MeshToVoxelEdgeData::EdgeData &rhs)
MeshToVoxelEdgeData::EdgeData | Abs (const MeshToVoxelEdgeData::EdgeData &x)
template<typename TreeOrLeafManagerT>
void | dilateActiveValues (TreeOrLeafManagerT &tree, const int iterations=1, const NearestNeighbors nn=NN_FACE, const TilePolicy mode=PRESERVE_TILES, const bool threaded=true)
| Topologically dilate all active values (i.e. both voxels and tiles) in a tree using one of three nearest neighbor connectivity patterns.
template<typename TreeOrLeafManagerT>
void | erodeActiveValues (TreeOrLeafManagerT &tree, const int iterations=1, const NearestNeighbors nn=NN_FACE, const TilePolicy mode=PRESERVE_TILES, const bool threaded=true)
| Topologically erode all active values (i.e. both voxels and tiles) in a tree using one of three nearest neighbor connectivity patterns.
template<typename TreeT, typename OpT>
size_t | visitNodesDepthFirst (TreeT &tree, OpT &op, size_t idx=0)
| Visit all nodes in the tree depth-first and apply a user-supplied functor to each node.
template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>
void | particlesToSdf (const ParticleListT &, GridT &, InterrupterT *=nullptr)
| Populate a scalar, floating-point grid with CSG-unioned level set spheres described by the given particle positions and radii.
template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>
void | particlesToSdf (const ParticleListT &, GridT &, Real radius, InterrupterT *=nullptr)
| Populate a scalar, floating-point grid with fixed-size, CSG-unioned level set spheres described by the given particle positions and the specified radius.
template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>
void | particleTrailsToSdf (const ParticleListT &, GridT &, Real delta=1, InterrupterT *=nullptr)
| Populate a scalar, floating-point grid with CSG-unioned trails of level set spheres with decreasing radius, where the starting position and radius and the direction of each trail is given by particle attributes.
template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>
void | particlesToMask (const ParticleListT &, GridT &, InterrupterT *=nullptr)
| Activate a boolean grid wherever it intersects the spheres described by the given particle positions and radii.
template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>
void | particlesToMask (const ParticleListT &, GridT &, Real radius, InterrupterT *=nullptr)
| Activate a boolean grid wherever it intersects the fixed-size spheres described by the given particle positions and the specified radius.
template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>
void | particleTrailsToMask (const ParticleListT &, GridT &, Real delta=1, InterrupterT *=nullptr)
| Activate a boolean grid wherever it intersects trails of spheres with decreasing radius, where the starting position and radius and the direction of each trail is given by particle attributes.
template<typename GridT, typename PointArrayT>
GridT::Ptr | createPointIndexGrid (const PointArrayT &points, double voxelSize)
| Partition points into a point index grid to accelerate range and nearest-neighbor searches.
template<typename GridT, typename PointArrayT>
GridT::Ptr | createPointIndexGrid (const PointArrayT &points, const math::Transform &xform)
| Partition points into a point index grid to accelerate range and nearest-neighbor searches.
template<typename PointArrayT, typename GridT>
bool | isValidPartition (const PointArrayT &points, const GridT &grid)
| Return `true` if the given point index grid represents a valid partitioning of the given point array.
template<typename GridT, typename PointArrayT>
GridT::ConstPtr | getValidPointIndexGrid (const PointArrayT &points, const typename GridT::ConstPtr &grid)
| Repartition the points if needed, otherwise return the input grid.
template<typename GridT, typename PointArrayT>
GridT::Ptr | getValidPointIndexGrid (const PointArrayT &points, const typename GridT::Ptr &grid)
| Repartition the points if needed, otherwise return the input grid.
template<typename PointListT, typename GridT>
void | maskPoints (const PointListT &points, GridT &grid)
| Makes every voxel of the `grid` active if it contains a point.
template<typename PointListT>
MaskGrid::Ptr | createPointMask (const PointListT &points, const math::Transform &xform)
| Return a MaskGrid where each binary voxel value is on if the voxel contains one (or more) points (i.e. the 3D position of a point is closer to this voxel than any other voxels).
template<typename GridT, typename MaskT = typename GridT::template ValueConverter<ValueMask>::Type>
MaskT::Ptr | createPotentialFlowMask (const GridT &grid, int dilation=5)
| Construct a mask for the Potential Flow domain.
template<typename Vec3T, typename GridT, typename MaskT>
GridT::template ValueConverter< Vec3T >::Type::Ptr | createPotentialFlowNeumannVelocities (const GridT &collider, const MaskT &domain, const typename GridT::template ValueConverter< Vec3T >::Type::ConstPtr boundaryVelocity, const Vec3T &backgroundVelocity)
| Create a Potential Flow velocities grid for the Neumann boundary.
template<typename Vec3GridT, typename MaskT, typename InterrupterT = util::NullInterrupter>
VectorToScalarGrid< Vec3GridT >::Ptr | computeScalarPotential (const MaskT &domain, const Vec3GridT &neumann, math::pcg::State &state, InterrupterT *interrupter=nullptr)
| Compute the Potential on the domain using the Neumann boundary conditions on solid boundaries.
template<typename Vec3GridT>
Vec3GridT::Ptr | computePotentialFlow (const typename VectorToScalarGrid< Vec3GridT >::Type &potential, const Vec3GridT &neumann, const typename Vec3GridT::ValueType backgroundVelocity=zeroVal< typename Vec3GridT::TreeType::ValueType >())
| Compute a vector Flow Field comprising the gradient of the potential with Neumann boundary conditions applied.
template<typename TreeT>
void | prune (TreeT &tree, typename TreeT::ValueType tolerance=zeroVal< typename TreeT::ValueType >(), bool threaded=true, size_t grainSize=1)
| Reduce the memory footprint of a tree by replacing with tiles any nodes whose values are all the same (optionally to within a tolerance) and have the same active state.
template<typename TreeT>
void | pruneTiles (TreeT &tree, typename TreeT::ValueType tolerance=zeroVal< typename TreeT::ValueType >(), bool threaded=true, size_t grainSize=1)
| Reduce the memory footprint of a tree by replacing with tiles any non-leaf nodes whose values are all the same (optionally to within a tolerance) and have the same active state.
template<typename TreeT>
void | pruneInactive (TreeT &tree, bool threaded=true, size_t grainSize=1)
| Reduce the memory footprint of a tree by replacing with background tiles any nodes whose values are all inactive.
template<typename TreeT>
void | pruneInactiveWithValue (TreeT &tree, const typename TreeT::ValueType &value, bool threaded=true, size_t grainSize=1)
| Reduce the memory footprint of a tree by replacing any nodes whose values are all inactive with tiles of the given value.
template<typename TreeT>
void | pruneLevelSet (TreeT &tree, bool threaded=true, size_t grainSize=1)
| Reduce the memory footprint of a tree by replacing nodes whose values are all inactive with inactive tiles having a value equal to the first value encountered in the (inactive) child.
template<typename TreeT>
void | pruneLevelSet (TreeT &tree, const typename TreeT::ValueType &outsideWidth, const typename TreeT::ValueType &insideWidth, bool threaded=true, size_t grainSize=1)
| Reduce the memory footprint of a tree by replacing nodes whose voxel values are all inactive with inactive tiles having the value -| insideWidth | if the voxel values are negative and | outsideWidth | otherwise.
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.
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.
template<typename TreeOrLeafManagerT>
void | signedFloodFill (TreeOrLeafManagerT &tree, bool threaded=true, size_t grainSize=1, Index minLevel=0)
| Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to +background and inside values to -background.
template<typename TreeOrLeafManagerT>
void | signedFloodFillWithValues (TreeOrLeafManagerT &tree, const typename TreeOrLeafManagerT::ValueType &outsideWidth, const typename TreeOrLeafManagerT::ValueType &insideWidth, bool threaded=true, size_t grainSize=1, Index minLevel=0)
| Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting exterior values to outsideWidth and interior values to insideWidth. Set the background value of this tree to outsideWidth.
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.
template<typename IterT>
math::Extrema | extrema (const IterT &iter, bool threaded=true)
| Iterate over a scalar grid and compute extrema (min/max) of the values of the voxels that are visited, or iterate over a vector-valued grid and compute extrema of the magnitudes of the vectors.
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.
template<typename IterT, typename ValueOp>
math::Extrema | extrema (const IterT &iter, const ValueOp &op, bool threaded)
| Iterate over a grid and compute extrema (min/max) of the values produced by applying the given functor at each voxel that is visited.
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.
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.
template<typename OperatorT, typename IterT>
math::Extrema | opExtrema (const IterT &iter, const OperatorT &op=OperatorT(), bool threaded=true)
| Same as opStatistics except it returns a math::Extrema vs a math::Stats.
template<typename GridT>
GridT::template ValueConverter< float >::Type::Ptr | topologyToLevelSet (const GridT &grid, int halfWidth=3, int closingSteps=1, int dilation=0, int smoothingSteps=0)
| Compute the narrow-band signed distance to the interface between active and inactive voxels in the input grid.
template<typename GridT, typename InterrupterT>
GridT::template ValueConverter< float >::Type::Ptr | topologyToLevelSet (const GridT &grid, int halfWidth=3, int closingSteps=1, int dilation=0, int smoothingSteps=0, InterrupterT *interrupt=nullptr)
| Compute the narrow-band signed distance to the interface between active and inactive voxels in the input grid.
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>
| OPENVDB_UBSAN_SUPPRESS ("undefined") void transformValues(const InIterT &inIter
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.
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.
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.
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.
| if (shared)
Processor | proc (inIter, Adapter::tree(outGrid), op, merge)
proc | process (threaded)
template<typename GridType>
void | transformVectors (GridType &, const Mat4d &)
| Apply an affine transform to the voxel values of a vector-valued grid in accordance with the grid's vector type (covariant, contravariant, etc.).
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.
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, bool relaxDisorientedTriangles=true)
| Adaptively mesh any scalar grid that has a continuous isosurface.
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.
template<typename GridT, typename InterrupterT = util::NullInterrupter>
void | fillWithSpheres (const GridT &grid, std::vector< openvdb::Vec4s > &spheres, const Vec2i &sphereCount=Vec2i(1, 50), bool overlapping=false, float minRadius=1.0, float maxRadius=std::numeric_limits< float >::max(), float isovalue=0.0, int instanceCount=10000, InterrupterT *interrupter=nullptr)
| Fill a closed level set or fog volume with adaptively-sized spheres.

## Variables
template<typename SdfGridT, typename ExtValueT>
const Coord | FastSweeping< SdfGridT, ExtValueT >::mOffset [6]
OutGridT & | outGrid
OutGridT XformOp & | op
OutGridT XformOp bool | threaded = true
OutGridT XformOp bool bool | shareOp = true
OutGridT XformOp bool bool MergePolicy | merge = MERGE_ACTIVE_STATES)
OutGridT XformOp bool bool | shared
| else
OutGridT const XformOp bool | bool

## Typedef Documentation

## ◆ CsgIntersectionOp

template<typename TreeT>

using CsgIntersectionOp = CsgUnionOrIntersectionOp<TreeT, false>

## ◆ CsgUnionOp

template<typename TreeT>

using CsgUnionOp = CsgUnionOrIntersectionOp<TreeT, true>

## ◆ OutTreeT

using OutTreeT = typename Adapter::TreeType

## ◆ ParticleIndexAtlas

using ParticleIndexAtlas = ParticleAtlas<PointIndexGrid>

## ◆ PointIndexGrid

using PointIndexGrid = Grid<PointIndexTree>

Point index grid.

## ◆ PointIndexTree

using PointIndexTree

Initial value:
tree::Tree<tree::RootNode<tree::InternalNode<tree::InternalNode
<PointIndexLeafNode<PointIndex32, 3>, 4>, 5>>>
openvdb::v12_0::tree::InternalNode
Definition InternalNode.h:35
openvdb::v12_0::tree::RootNode
Definition RootNode.h:40
openvdb::v12_0::tree::Tree
Definition Tree.h:195
openvdb::v12_0::tools::PointIndexLeafNode
Definition PointIndexGrid.h:1359

Point index tree configured to match the default OpenVDB tree configuration.

## ◆ PointList

using PointList = std::unique_ptr<openvdb::Vec3s[]>

Point and primitive list types.

## ◆ PolygonPoolList

using PolygonPoolList = std::unique_ptr<PolygonPool[]>

Point and primitive list types.

## ◆ Processor

using Processor = typename valxform::SharedOpTransformer<InIterT, OutTreeT, const XformOp>

## ◆ UInt32PointPartitioner

using UInt32PointPartitioner = PointPartitioner<uint32_t, 3>

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Polygon flags, used for reference based meshing.

Enumerator
POLYFLAG_EXTERIOR |
POLYFLAG_FRACTURE_SEAM |
POLYFLAG_SUBDIVIDED |

## ◆ DSCompositeOp

enum DSCompositeOp

We currrently support the following operations when compositing sparse data into a dense grid.

Enumerator
DS_OVER |
DS_ADD |
DS_SUB |
DS_MIN |
DS_MAX |
DS_MULT |
DS_SET |

## ◆ FastSweepingDomain

enum class FastSweepingDomain
| strong

Fast Sweeping update mode. This is useful to determine narrow-band extension or field extension in one side of a signed distance field.

Enumerator
SWEEP_ALL | Update all voxels affected by the sweeping algorithm.
SWEEP_GREATER_THAN_ISOVALUE |
SWEEP_LESS_THAN_ISOVALUE |

## ◆ InteriorTestStrategy

enum InteriorTestStrategy

Different staregies how to determine sign of an SDF when using interior test.

Enumerator
EVAL_EVERY_VOXEL | Evaluates interior test at every voxel. This is usefull when we rebuild already existing SDF where evaluating previous grid is cheap
EVAL_EVERY_TILE | Evaluates interior test at least once per tile and flood fills within the tile.

## ◆ MemoryLayout

enum MemoryLayout

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 |

## ◆ MeshToVolumeFlags

enum MeshToVolumeFlags

Mesh to volume conversion flags.

Enumerator
UNSIGNED_DISTANCE_FIELD | Switch from the default signed distance field conversion that classifies regions as either inside or outside the mesh boundary to a unsigned distance field conversion that only computes distance values. This conversion type does not require a closed watertight mesh.
DISABLE_INTERSECTING_VOXEL_REMOVAL | Disable the cleanup step that removes voxels created by self intersecting portions of the mesh.
DISABLE_RENORMALIZATION | Disable the distance renormalization step that smooths out bumps caused by self intersecting or overlapping portions of the mesh
DISABLE_NARROW_BAND_TRIMMING | Disable the cleanup step that removes active voxels that exceed the narrow band limits. (Only relevant for small limits)

## ◆ NearestNeighbors

enum NearestNeighbors

Voxel topology of nearest neighbors.

NN_FACE

  face adjacency (6 nearest neighbors, defined as all neighbor voxels connected along one of the primary axes)

NN_FACE_EDGE

  face and edge adjacency (18 nearest neighbors, defined as all neighbor voxels connected along either one or two of the primary axes)

NN_FACE_EDGE_VERTEX
  face, edge and vertex adjacency (26 nearest neighbors, defined as all neighbor voxels connected along either one, two or all three of the primary axes)

Enumerator
NN_FACE |
NN_FACE_EDGE |
NN_FACE_EDGE_VERTEX |

## ◆ TilePolicy

enum TilePolicy

Different policies when dilating trees with active tiles.

IGNORE_TILES

  Active tiles are ignores. For dilation, only active voxels are dilated. For erosion, active tiles still appear as neighboring activity however will themselves not be eroded.

EXPAND_TILES

  For dilation and erosion, active tiles are voxelized (expanded), dilated or eroded and left in their voxelized state irrespective of their final state.

PRESERVE_TILES
  For dilation, active tiles remain unchanged but they still contribute to the dilation as if they were active voxels. For erosion, active tiles are only eroded should the erosion wavefront reach them, otherwise they are left unchanged. Additionally, dense or empty nodes with constant values are pruned.

Enumerator
IGNORE_TILES |
EXPAND_TILES |
PRESERVE_TILES |

## Function Documentation

## ◆ Abs()

MeshToVoxelEdgeData::EdgeData Abs | ( | const MeshToVoxelEdgeData::EdgeData & | x | ) |
| inline

## ◆ accumulate()

template<typename IterT, typename XformOp>

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

  iter | an iterator over a grid or its tree (`Grid::ValueOnCIter`, `Tree::NodeIter`, etc.)
  op | a 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
  threaded | if 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();
  }
  openvdb::v12_0::Grid< FloatTree >::ValueOnCIter
  typename FloatTree::ValueOnCIter ValueOnCIter
  Definition Grid.h:583
  openvdb::v12_0::math::Stats
  This class computes statistics (minimum value, maximum value, mean, variance and standard deviation) ...
  Definition Stats.h:180
  openvdb::v12_0::math::Stats::add
  void add(double val)
  Add a single sample.
  Definition Stats.h:190
  openvdb::v12_0::math::Stats::mean
  double mean() const
  Definition Stats.h:223
  openvdb::v12_0::tools::op
  OutGridT XformOp & op
  Definition ValueTransformer.h:140
  openvdb::v12_0::tools::accumulate
  void accumulate(const IterT &iter, XformOp &op, bool threaded=true)
  Definition ValueTransformer.h:683
  openvdb::v12_0::FloatGrid
  Grid< FloatTree > FloatGrid
  Definition openvdb.h:75

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.

## ◆ activate()

template<typename GridOrTree>

void activate | ( | GridOrTree & | gridOrTree,
|  | const typename GridOrTree::ValueType & | value,
|  | const typename GridOrTree::ValueType & | tolerance = zeroVal<typename GridOrTree::ValueType>(),
|  | const bool | threaded = true )

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).

## ◆ activeTiles()

template<typename TreeT>

std::vector< TileData< typename TreeT::ValueType > > activeTiles | ( | const TreeT & | tree,
|  | const CoordBBox & | bbox )

Return a vector with bounding boxes that represents all the intersections between active tiles in the tree and the specified bounding box.

Warning
  For repeated calls to this method consider instead creating an instance of FindActiveValues and then repeatedly call count(). This assumes the tree to be constant between calls but is slightly faster.

Parameters

  tree | const tree to be tested for active tiles.
  bbox | index bounding box which is intersected against the active tiles.

## ◆ anyActiveTiles()

template<typename TreeT>

bool anyActiveTiles | ( | const TreeT & | tree,
|  | const CoordBBox & | bbox )

Returns true if the bounding box intersects any of the active tiles in a tree, i.e. ignores active leaf values.

Warning
  For repeated calls to this method consider instead creating an instance of FindActiveValues and then repeatedly call anyActiveTiles(). This assumes the tree to be constant between calls but is slightly faster.

Parameters

  tree | const tree to be tested for active tiles.
  bbox | index bounding box which is intersected against the active tiles.

## ◆ anyActiveValues()

template<typename TreeT>

bool anyActiveValues | ( | const TreeT & | tree,
|  | const CoordBBox & | bbox )

Returns true if the bounding box intersects any of the active values in a tree, i.e. either active voxels or active tiles.

Warning
  For repeated calls to this method consider instead creating an instance of FindActiveValues and then repeatedly call anyActiveValues(). This assumes the tree to be constant between calls but is slightly faster.

Parameters

  tree | const tree to be tested for active values.
  bbox | index bounding box which is intersected against the active values.

## ◆ anyActiveVoxels()

template<typename TreeT>

bool anyActiveVoxels | ( | const TreeT & | tree,
|  | const CoordBBox & | bbox )

Returns true if the bounding box intersects any of the active voxels in a tree, i.e. ignores active tile values.

Note
  In VDB voxels by definition reside in the leaf nodes ONLY. So this method ignores active tile values that reside higher up in the VDB tree structure.

Warning
  For repeated calls to this method consider instead creating an instance of FindActiveValues and then repeatedly call anyActiveVoxels(). This assumes the tree to be constant between calls but is slightly faster.

Parameters

  tree | const tree to be tested for active voxels.
  bbox | index bounding box which is intersected against the active voxels.

## ◆ changeAsymmetricLevelSetBackground()

template<typename TreeOrLeafManagerT>

void changeAsymmetricLevelSetBackground | ( | TreeOrLeafManagerT & | tree,
|  | const typename TreeOrLeafManagerT::ValueType & | outsideWidth,
|  | const typename TreeOrLeafManagerT::ValueType & | insideWidth,
|  | bool | threaded = true,
|  | size_t | grainSize = 32 )

Replace the background values in all the nodes of a floating-point tree containing a possibly asymmetric narrow-band level set.

All inactive values will be set to +| outsideWidth | if outside and -| insideWidth | if inside, where outsideWidth is the outside width of the narrow band and insideWidth is its inside width.

Note
  This method is faster than changeBackground since it does not perform tests to see if inactive values are equal to the old background value.
  If a LeafManager is used the cached leaf nodes are reused, resulting in slightly better overall performance.

Parameters

  tree | Tree (or LeafManager) that will have its background value changed
  outsideWidth | The width of the outside of the narrow band
  insideWidth | The width of the inside of the narrow band
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 32)

Exceptions

  ValueError | if outsideWidth is negative or insideWidth is not negative (as defined by math::isNegative)

## ◆ changeBackground()

template<typename TreeOrLeafManagerT>

void changeBackground | ( | TreeOrLeafManagerT & | tree,
|  | const typename TreeOrLeafManagerT::ValueType & | background,
|  | bool | threaded = true,
|  | size_t | grainSize = 32 )

Replace the background value in all the nodes of a tree.

The sign of the background value is preserved, and only inactive values equal to the old background value are replaced.

Note
  If a LeafManager is used the cached leaf nodes are reused, resulting in slightly better overall performance.

Parameters

  tree | Tree (or LeafManager) that will have its background value changed
  background | the new background value
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 32)

## ◆ changeLevelSetBackground()

template<typename TreeOrLeafManagerT>

void changeLevelSetBackground | ( | TreeOrLeafManagerT & | tree,
|  | const typename TreeOrLeafManagerT::ValueType & | halfWidth,
|  | bool | threaded = true,
|  | size_t | grainSize = 32 )

Replace the background value in all the nodes of a floating-point tree containing a symmetric narrow-band level set.

All inactive values will be set to +| halfWidth | if outside and -| halfWidth | if inside, where halfWidth is half the width of the symmetric narrow band.

Note
  This method is faster than changeBackground since it does not perform tests to see if inactive values are equal to the old background value.
  If a LeafManager is used the cached leaf nodes are reused, resulting in slightly better overall performance.

Parameters

  tree | Tree (or LeafManager) that will have its background value changed
  halfWidth | half of the width of the symmetric narrow band
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 32)

Exceptions

  ValueError | if halfWidth is negative (as defined by math::isNegative)

## ◆ checkFogVolume()

template<class GridType>

std::string checkFogVolume | ( | const GridType & | grid,
|  | size_t | number = 6 )

Perform checks on a grid to see if it is a valid fog volume.

Parameters

  grid | Grid to be checked
  number | Number of the checks to be performed (see below)

Returns
  string with a message indicating the nature of the issue. If no issue is detected the return string is empty.

number refers to the following ordered list of checks - always starting from the top. Fast checks 1: value type is floating point 2: has FOG volume class type 3: background value is zero

Slower checks 4: all the values are finite, i.e not NaN or infinite 5: inactive values are zero 6: active values are in the range [0,1]

## ◆ checkLevelSet()

template<class GridType>

std::string checkLevelSet | ( | const GridType & | grid,
|  | size_t | number = 9 )

Perform checks on a grid to see if it is a valid symmetric, narrow-band level set.

Parameters

  grid | Grid to be checked
  number | Number of the checks to be performed (see below)

Returns
  string with a message indicating the nature of the issue. If no issue is detected the return string is empty.

number refers to the following ordered list of checks - always starting from the top. Fast checks 1: value type is floating point 2: has level set class type 3: has uniform scale 4: background value is positive and n*dx

Slower checks 5: no active tiles 6: all the values are finite, i.e not NaN or infinite 7: active values in range between +-background 8: abs of inactive values = background, i.e. assuming a symmetric narrow band!

Relatively slow check (however multithreaded) 9: norm gradient is close to one, i.e. satisfied the Eikonal equation.

## ◆ clip() [1/3]

template<typename GridType>

GridType::Ptr clip | ( | const GridType & | grid,
|  | const BBoxd & | bbox,
|  | bool | keepInterior = true )

Clip the given grid against a world-space bounding box and return a new grid containing the result.

Parameters

  grid | the grid to be clipped
  bbox | a world-space bounding box
  keepInterior | if true, discard voxels that lie outside the bounding box; if false, discard voxels that lie inside the bounding box

Warning
  Clipping a level set will likely produce a grid that is no longer a valid level set.

## ◆ clip() [2/3]

template<typename GridType, typename MaskTreeType>

GridType::Ptr clip | ( | const GridType & | grid,
|  | const Grid< MaskTreeType > & | mask,
|  | bool | keepInterior = true )

Clip a grid against the active voxels of another grid and return a new grid containing the result.

Parameters

  grid | the grid to be clipped
  mask | a grid whose active voxels form a boolean clipping mask
  keepInterior | if true, discard voxels that do not intersect the mask; if false, discard voxels that intersect the mask

The mask grid need not have the same transform as the source grid. Also, if the mask grid is a level set, consider using tools::sdfInteriorMask to construct a new mask comprising the interior (rather than the narrow band) of the level set.

Warning
  Clipping a level set will likely produce a grid that is no longer a valid level set.

## ◆ clip() [3/3]

template<typename GridType>

GridType::Ptr clip | ( | const GridType & | grid,
|  | const math::NonlinearFrustumMap & | frustum,
|  | bool | keepInterior = true )

Clip the given grid against a frustum and return a new grid containing the result.

Parameters

  grid | the grid to be clipped
  frustum | a frustum map
  keepInterior | if true, discard voxels that lie outside the frustum; if false, discard voxels that lie inside the frustum

Warning
  Clipping a level set will likely produce a grid that is no longer a valid level set.

## ◆ compActiveLeafVoxels()

template<typename TreeT, typename OpT = composite::CopyOp<TreeT>>

void compActiveLeafVoxels | ( | TreeT & | srcTree,
|  | TreeT & | dstTree,
|  | OpT | op = composite::CopyOp<TreeT>() )

Composite the active values in leaf nodes, i.e. active voxels, of a source tree into a destination tree.

Parameters

  srcTree | source tree from which active voxels are composited.
  dstTree | destination tree into which active voxels are composited.
  op | a functor of the form `void op(T& dst, const T& src)`, where `T` is the `ValueType` of the tree, that composites a source value into a destination value. By default it copies the value from src to dst.

All active voxels in the source tree will be active in the destination tree, and their value is determined by a use-defined functor (OpT op) that operates on the source and destination values. The only exception is when the tree type is MaskTree, in which case no functor is needed since by defintion a MaskTree has no values (only topology).

Warning
  This function only operated on leaf node values, i.e. tile values are ignored.

## ◆ compDiv()

template<typename GridOrTreeT>

void compDiv | ( | 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.

## ◆ compMax()

template<typename GridOrTreeT>

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.

## ◆ compMin()

template<typename GridOrTreeT>

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.

## ◆ compMul()

template<typename GridOrTreeT>

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.

## ◆ compositeToDense()

template<DSCompositeOp, typename TreeT>

void compositeToDense | ( | Dense< typename TreeT::ValueType, LayoutZYX > & | dense,
|  | const TreeT & | source,
|  | const TreeT & | alpha,
|  | const typename TreeT::ValueType | beta,
|  | const typename TreeT::ValueType | strength,
|  | bool | threaded = true )
| inline

Composite data from a sparse tree into a dense array of the same value type.

Parameters

  dense | Dense grid to be altered by the operation
  source | Sparse data to composite into `dense`
  alpha | Sparse Alpha mask used in compositing operations.
  beta | Constant multiplier on src
  strength | Constant multiplier on alpha
  threaded | Enable threading for this operation.

## ◆ compReplace()

template<typename GridOrTreeT>

void compReplace | ( | GridOrTreeT & | a,
|  | const GridOrTreeT & | b )

Copy the active voxels of B into A.

## ◆ compSum()

template<typename GridOrTreeT>

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.

## ◆ computePotentialFlow()

template<typename Vec3GridT>

Vec3GridT::Ptr computePotentialFlow | ( | const typename VectorToScalarGrid< Vec3GridT >::Type & | potential,
|  | const Vec3GridT & | neumann,
|  | const typename Vec3GridT::ValueType | backgroundVelocity = zeroVal<typename Vec3GridT::TreeType::ValueType>() )

Compute a vector Flow Field comprising the gradient of the potential with Neumann boundary conditions applied.

Parameters

  potential | scalar potential, typically computed from computeScalarPotential()
  neumann | the topology of this grid defines where the solid boundaries are and grid values give the Neumann boundaries that should be applied there
  backgroundVelocity | a background velocity value

## ◆ computeScalarPotential()

template<typename Vec3GridT, typename MaskT, typename InterrupterT = util::NullInterrupter>

VectorToScalarGrid< Vec3GridT >::Ptr computeScalarPotential | ( | const MaskT & | domain,
|  | const Vec3GridT & | neumann,
|  | math::pcg::State & | state,
|  | InterrupterT * | interrupter = nullptr )

Compute the Potential on the domain using the Neumann boundary conditions on solid boundaries.

Parameters

  domain | a mask to represent the domain in which to perform the solve
  neumann | the topology of this grid defines where the solid boundaries are and grid values give the Neumann boundaries that should be applied there
  state | the solver parameters for computing the solution
  interrupter | pointer to an optional interrupter adhering to the util::NullInterrupter interface

On input, the State object should specify convergence criteria (minimum error and maximum number of iterations); on output, it gives the actual termination conditions.

## ◆ copyFromDense()

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.

Parameters

  dense | the dense grid from which to copy values
  sparse | an OpenVDB grid or tree into which to copy values
  tolerance | values 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
  serial | if false, process voxels in parallel

## ◆ copyToDense()

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.

Parameters

  sparse | an OpenVDB grid or tree from which to copy values
  dense | the dense grid into which to copy values
  serial | if false, process voxels in parallel

## ◆ countActiveLeafVoxels() [1/2]

template<typename TreeT>

Index64 countActiveLeafVoxels | ( | const TreeT & | tree,
|  | bool | threaded = true )

Return the total number of active voxels stored in leaf nodes.

## ◆ countActiveLeafVoxels() [2/2]

template<typename TreeT>

Index64 countActiveLeafVoxels | ( | const TreeT & | tree,
|  | const CoordBBox & | bbox,
|  | bool | threaded = true )

Return the total number of active voxels stored in leaf nodes that intersects a bounding box.

## ◆ countActiveTiles()

template<typename TreeT>

Index64 countActiveTiles | ( | const TreeT & | tree,
|  | bool | threaded = true )

Return the total number of active tiles in the tree.

## ◆ countActiveValues()

template<typename TreeT>

Index64 countActiveValues | ( | const TreeT & | tree,
|  | const CoordBBox & | bbox )

Returns the number of active values that intersects a bounding box intersects, i.e. the count includes both active voxels and virtual voxels in active tiles.

Warning
  For repeated calls to this method consider instead creating an instance of FindActiveValues and then repeatedly call count(). This assumes the tree to be constant between calls but is slightly faster.

Parameters

  tree | const tree to be tested for active values.
  bbox | index bounding box which is intersected against the active values.

## ◆ countActiveVoxels() [1/2]

template<typename TreeT>

Index64 countActiveVoxels | ( | const TreeT & | tree,
|  | bool | threaded = true )

Return the total number of active voxels in the tree.

## ◆ countActiveVoxels() [2/2]

template<typename TreeT>

Index64 countActiveVoxels | ( | const TreeT & | tree,
|  | const CoordBBox & | bbox,
|  | bool | threaded = true )

Return the total number of active voxels in the tree that intersects a bounding box.

## ◆ countInactiveLeafVoxels()

template<typename TreeT>

Index64 countInactiveLeafVoxels | ( | const TreeT & | tree,
|  | bool | threaded = true )

Return the total number of inactive voxels stored in leaf nodes.

## ◆ countInactiveVoxels()

template<typename TreeT>

Index64 countInactiveVoxels | ( | const TreeT & | tree,
|  | bool | threaded = true )

Return the total number of inactive voxels in the tree.

## ◆ cpt() [1/4]

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.

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.

## ◆ cpt() [2/4]

template<typename GridType>

ScalarToVectorConverter< GridType >::Type::Ptr cpt | ( | const GridType & | grid,
|  | bool | threaded = true )

## ◆ cpt() [3/4]

template<typename GridType, typename MaskT, typename InterruptT>

ScalarToVectorConverter< GridType >::Type::Ptr cpt | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded,
|  | InterruptT * | interrupt )

## ◆ cpt() [4/4]

template<typename GridType, typename MaskT>

ScalarToVectorConverter< GridType >::Type::Ptr cpt | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded = true )

## ◆ createLevelSetBox()

template<typename GridType, typename VecType>

GridType::Ptr createLevelSetBox | ( | const math::BBox< VecType > & | bbox,
|  | const openvdb::math::Transform & | xform,
|  | typename VecType::ValueType | halfWidth = LEVEL_SET_HALF_WIDTH )

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

Parameters

  bbox | a bounding box in world units
  xform | world-to-index-space transform
  halfWidth | half the width of the narrow band, in voxel units

## ◆ createLevelSetCube() [1/2]

template<typename GridType>

GridType::Ptr createLevelSetCube | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH) )

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

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetCube() [2/2]

template<typename GridType, typename InterruptT>

GridType::Ptr createLevelSetCube | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH),
|  | InterruptT * | interrupt = nullptr )

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

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units
  interrupt | a pointer adhering to the util::NullInterrupter interface

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetDodecahedron() [1/2]

template<typename GridType>

GridType::Ptr createLevelSetDodecahedron | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH) )

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

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetDodecahedron() [2/2]

template<typename GridType, typename InterruptT>

GridType::Ptr createLevelSetDodecahedron | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH),
|  | InterruptT * | interrupt = nullptr )

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

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units
  interrupt | a pointer adhering to the util::NullInterrupter interface

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetIcosahedron() [1/2]

template<typename GridType>

GridType::Ptr createLevelSetIcosahedron | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH) )

Return a grid of type `GridType` containing a narrow-band level set representation of an icosahedron.

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetIcosahedron() [2/2]

template<typename GridType, typename InterruptT>

GridType::Ptr createLevelSetIcosahedron | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH),
|  | InterruptT * | interrupt = nullptr )

Return a grid of type `GridType` containing a narrow-band level set representation of an icosahedron.

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units
  interrupt | a pointer adhering to the util::NullInterrupter interface

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetOctahedron() [1/2]

template<typename GridType>

GridType::Ptr createLevelSetOctahedron | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH) )

Return a grid of type `GridType` containing a narrow-band level set representation of an octahedron.

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetOctahedron() [2/2]

template<typename GridType, typename InterruptT>

GridType::Ptr createLevelSetOctahedron | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH),
|  | InterruptT * | interrupt = nullptr )

Return a grid of type `GridType` containing a narrow-band level set representation of an octahedron.

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units
  interrupt | a pointer adhering to the util::NullInterrupter interface

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetPlatonic() [1/2]

template<typename GridType>

GridType::Ptr createLevelSetPlatonic | ( | int | faceCount,
|  | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH) )

Return a grid of type `GridType` containing a narrow-band level set representation of a platonic solid.

Parameters

  faceCount | number of faces of the platonic solid, i.e. 4, 6, 8, 12 or 20
  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units

Faces: TETRAHEDRON=4, CUBE=6, OCTAHEDRON=8, DODECAHEDRON=12, ICOSAHEDRON=20

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetPlatonic() [2/2]

template<typename GridType, typename InterruptT>

GridType::Ptr createLevelSetPlatonic | ( | int | faceCount,
|  | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH),
|  | InterruptT * | interrupt = nullptr )

Return a grid of type `GridType` containing a narrow-band level set representation of a platonic solid.

Parameters

  faceCount | number of faces of the platonic solid, i.e. 4, 6, 8, 12 or 20
  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units
  interrupt | a pointer adhering to the util::NullInterrupter interface

Faces: TETRAHEDRON=4, CUBE=6, OCTAHEDRON=8, DODECAHEDRON=12, ICOSAHEDRON=20

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetSphere() [1/2]

template<typename GridType>

GridType::Ptr createLevelSetSphere | ( | float | radius,
|  | const openvdb::Vec3f & | center,
|  | float | voxelSize,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH),
|  | bool | threaded = true )

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

Parameters

  radius | radius of the sphere in world units
  center | center of the sphere in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units
  threaded | if true multi-threading is enabled (true by default)

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

## ◆ createLevelSetSphere() [2/2]

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 = nullptr,
|  | bool | threaded = true )

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

Parameters

  radius | radius of the sphere in world units
  center | center of the sphere in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units
  interrupt | a pointer adhering to the util::NullInterrupter interface
  threaded | if true multi-threading is enabled (true by default)

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

## ◆ createLevelSetTetrahedron() [1/2]

template<typename GridType>

GridType::Ptr createLevelSetTetrahedron | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH) )

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

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createLevelSetTetrahedron() [2/2]

template<typename GridType, typename InterruptT>

GridType::Ptr createLevelSetTetrahedron | ( | float | scale = 1.0f,
|  | const Vec3f & | center = Vec3f(0.0f),
|  | float | voxelSize = 0.1f,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH),
|  | InterruptT * | interrupt = nullptr )

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

Parameters

  scale | scale of the platonic solid in world units
  center | center of the platonic solid in world units
  voxelSize | voxel size in world units
  halfWidth | half the width of the narrow band, in voxel units
  interrupt | a pointer adhering to the util::NullInterrupter interface

Note
  `GridType::ValueType` must be a floating-point scalar.

## ◆ createPointIndexGrid() [1/2]

template<typename GridT, typename PointArrayT>

GridT::Ptr createPointIndexGrid | ( | const PointArrayT & | points,
|  | const math::Transform & | xform )
| inline

Partition points into a point index grid to accelerate range and nearest-neighbor searches.

Parameters

  points | world-space point array conforming to the PointArray interface
  xform | world-to-index-space transform

## ◆ createPointIndexGrid() [2/2]

template<typename GridT, typename PointArrayT>

GridT::Ptr createPointIndexGrid | ( | const PointArrayT & | points,
|  | double | voxelSize )
| inline

Partition points into a point index grid to accelerate range and nearest-neighbor searches.

Parameters

  points | world-space point array conforming to the PointArray interface
  voxelSize | voxel size in world units

## ◆ createPointMask()

template<typename PointListT>

MaskGrid::Ptr createPointMask | ( | const PointListT & | points,
|  | const math::Transform & | xform )
| inline

Return a MaskGrid where each binary voxel value is on if the voxel contains one (or more) points (i.e. the 3D position of a point is closer to this voxel than any other voxels).

Parameters

  points | points that active the voxels in the returned grid.
  xform | transform from world space to voxels in grid space.

## ◆ createPotentialFlowMask()

template<typename GridT, typename MaskT = typename GridT::template ValueConverter<ValueMask>::Type>

MaskT::Ptr createPotentialFlowMask | ( | const GridT & | grid,
|  | int | dilation = 5 )

Construct a mask for the Potential Flow domain.

For a level set, this represents a rebuilt exterior narrow band. For any other grid it is a new region that surrounds the active voxels.

Parameters

  grid | source grid to use for computing the mask
  dilation | dilation in voxels of the source grid to form the new potential flow mask

## ◆ createPotentialFlowNeumannVelocities()

template<typename Vec3T, typename GridT, typename MaskT>

GridT::template ValueConverter< Vec3T >::Type::Ptr createPotentialFlowNeumannVelocities | ( | const GridT & | collider,
|  | const MaskT & | domain,
|  | const typename GridT::template ValueConverter< Vec3T >::Type::ConstPtr | boundaryVelocity,
|  | const Vec3T & | backgroundVelocity )

Create a Potential Flow velocities grid for the Neumann boundary.

Parameters

  collider | a level set that represents the boundary
  domain | a mask to represent the potential flow domain
  boundaryVelocity | an optional grid pointer to stores the velocities of the boundary
  backgroundVelocity | a background velocity value

Typically this method involves supplying a velocity grid for the collider boundary, however it can also be used for a global wind field around the collider by supplying an empty boundary Velocity and a non-zero background velocity.

## ◆ csgDifference()

template<typename GridOrTreeT>

void csgDifference | ( | GridOrTreeT & | a,
|  | GridOrTreeT & | b,
|  | bool | prune = true,
|  | bool | pruneCancelledTiles = false )

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

Exceptions

  ValueError | if the background value of either grid is not greater than zero.

Note
  This operation always leaves the B grid empty.
  cancelled tiles only pruned if pruning is also enabled.

## ◆ csgDifferenceCopy()

template<typename GridOrTreeT>

GridOrTreeT::Ptr csgDifferenceCopy | ( | const GridOrTreeT & | a,
|  | const GridOrTreeT & | b )

Threaded CSG difference operation that produces a new grid or tree from immutable inputs.

Returns
  The CSG difference of the and level set inputs.

## ◆ csgIntersection()

template<typename GridOrTreeT>

void csgIntersection | ( | GridOrTreeT & | a,
|  | GridOrTreeT & | b,
|  | bool | prune = true,
|  | bool | pruneCancelledTiles = false )

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

Exceptions

  ValueError | if the background value of either grid is not greater than zero.

Note
  This operation always leaves the B grid empty.
  cancelled tiles only pruned if pruning is also enabled.

## ◆ csgIntersectionCopy()

template<typename GridOrTreeT>

GridOrTreeT::Ptr csgIntersectionCopy | ( | const GridOrTreeT & | a,
|  | const GridOrTreeT & | b )

Threaded CSG intersection operation that produces a new grid or tree from immutable inputs.

Returns
  The CSG intersection of the and level set inputs.

## ◆ csgUnion()

template<typename GridOrTreeT>

void csgUnion | ( | GridOrTreeT & | a,
|  | GridOrTreeT & | b,
|  | bool | prune = true,
|  | bool | pruneCancelledTiles = false )

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

Exceptions

  ValueError | if the background value of either grid is not greater than zero.

Note
  This operation always leaves the B grid empty.
  cancelled tiles only pruned if pruning is also enabled.

## ◆ csgUnionCopy()

template<typename GridOrTreeT>

GridOrTreeT::Ptr csgUnionCopy | ( | const GridOrTreeT & | a,
|  | const GridOrTreeT & | b )

Threaded CSG union operation that produces a new grid or tree from immutable inputs.

Returns
  The CSG union of the and level set inputs.

## ◆ curl() [1/4]

template<typename GridType, typename InterruptT>

GridType::Ptr curl | ( | const GridType & | grid,
|  | bool | threaded,
|  | InterruptT * | interrupt )

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.

## ◆ curl() [2/4]

template<typename GridType>

GridType::Ptr curl | ( | const GridType & | grid,
|  | bool | threaded = true )

## ◆ curl() [3/4]

template<typename GridType, typename MaskT, typename InterruptT>

GridType::Ptr curl | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded,
|  | InterruptT * | interrupt )

## ◆ curl() [4/4]

template<typename GridType, typename MaskT>

GridType::Ptr curl | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded = true )

## ◆ deactivate()

template<typename GridOrTree>

void deactivate | ( | GridOrTree & | gridOrTree,
|  | const typename GridOrTree::ValueType & | value,
|  | const typename GridOrTree::ValueType & | tolerance = zeroVal<typename GridOrTree::ValueType>(),
|  | const bool | threaded = true )

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).

## ◆ dilateActiveValues()

template<typename TreeOrLeafManagerT>

void dilateActiveValues | ( | TreeOrLeafManagerT & | tree,
|  | const int | iterations = 1,
|  | const NearestNeighbors | nn = NN_FACE,
|  | const TilePolicy | mode = PRESERVE_TILES,
|  | const bool | threaded = true )

Topologically dilate all active values (i.e. both voxels and tiles) in a tree using one of three nearest neighbor connectivity patterns.

If the input is not a MaskTree OR if tiles are being preserved, this algorithm will copy the input tree topology onto a MaskTree, performs the dilation on the mask and copies the resulting topology back. This algorithm guarantees topology preservation (non-pruned leaf nodes will persists) EXCEPT for direct MaskTree dilation. MaskTree dilation is optimised for performance and may replace existing leaf nodes i.e. any held leaf node pointers may become invalid. See the Morphology class for more granular control.

Note
  This method is fully multi-threaded and support active tiles, however only the PRESERVE_TILES policy ensures a pruned topology. The values of any voxels are unchanged.

Parameters

  tree | tree or leaf manager to be dilated. The leaf manager will be synchronized with the result.
  iterations | number of iterations to apply the dilation
  nn | connectivity pattern of the dilation: either face-adjacent (6 nearest neighbors), face- and edge-adjacent (18 nearest neighbors) or face-, edge- and vertex-adjacent (26 nearest neighbors).
  mode | Defined the policy for handling active tiles (see above for details)
  threaded | Whether to multi-thread execution

## ◆ dilateSdf()

template<typename GridT>

GridT::Ptr dilateSdf | ( | const GridT & | sdfGrid,
|  | int | dilation,
|  | NearestNeighbors | nn = NN_FACE,
|  | int | nIter = 1,
|  | FastSweepingDomain | mode = FastSweepingDomain::SWEEP_ALL )

Dilates the narrow band of an existing signed distance field by a specified number of voxels (like adding "onion-rings").

Note
  This operation is not to be confused with morphological dilation of a level set, which is implemented in LevelSetFilter::offset, and involves actual interface tracking of the narrow band.

Returns
  A shared pointer to the dilated signed distance field.

Parameters

  sdfGrid | Input signed distance field to be dilated.
  dilation | Numer of voxels that the narrow band of the input SDF will be dilated.
  nn | Stencil-pattern used for dilation
  nIter | Number of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.
  mode | Determines the direction of the dilation. SWEEP_ALL will dilate in both sides of the signed distance function, SWEEP_GREATER_THAN_ISOVALUE will dilate in the positive side of the iso-surface, SWEEP_LESS_THAN_ISOVALUE will dilate in the negative side of the iso-surface.

Topology will change as a result of this dilation. E.g. if sdfGrid has a width of 3 and dilation = 6 then the grid returned by this method is a narrow band signed distance field with a total width of 9 units.

## ◆ divergence() [1/4]

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.

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.

## ◆ divergence() [2/4]

template<typename GridType>

VectorToScalarConverter< GridType >::Type::Ptr divergence | ( | const GridType & | grid,
|  | bool | threaded = true )

## ◆ divergence() [3/4]

template<typename GridType, typename MaskT, typename InterruptT>

VectorToScalarConverter< GridType >::Type::Ptr divergence | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded,
|  | InterruptT * | interrupt )

## ◆ divergence() [4/4]

template<typename GridType, typename MaskT>

VectorToScalarConverter< GridType >::Type::Ptr divergence | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded = true )

## ◆ doResampleToMatch()

template<typename Sampler, typename Interrupter, typename GridType>

void doResampleToMatch | ( | const GridType & | inGrid,
|  | GridType & | outGrid,
|  | Interrupter & | interrupter )

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.

## ◆ erodeActiveValues()

template<typename TreeOrLeafManagerT>

void erodeActiveValues | ( | TreeOrLeafManagerT & | tree,
|  | const int | iterations = 1,
|  | const NearestNeighbors | nn = NN_FACE,
|  | const TilePolicy | mode = PRESERVE_TILES,
|  | const bool | threaded = true )

Topologically erode all active values (i.e. both voxels and tiles) in a tree using one of three nearest neighbor connectivity patterns.

If tiles are being preserve, this algorithm will copy the input tree topology onto a MaskTree, performs the erosion on the mask and intersects the resulting topology back. This algorithm guarantees topology preservation (non-pruned leaf nodes will persists). See the Morphology class for more granular control.

Note
  This method is fully multi-threaded and support active tiles, however only the PRESERVE_TILES policy ensures a pruned topology. The values of any voxels are unchanged. Erosion by NN_FACE neighbors is usually faster than other neighbor schemes. NN_FACE_EDGE and NN_FACE_EDGE_VERTEX operate at comparable dilation speeds.

Parameters

  tree | tree or leaf manager to be eroded. The leaf manager will be synchronized with the result.
  iterations | number of iterations to apply the erosion
  nn | connectivity pattern of the erosion: either face-adjacent (6 nearest neighbors), face- and edge-adjacent (18 nearest neighbors) or face-, edge- and vertex-adjacent (26 nearest neighbors).
  mode | Defined the policy for handling active tiles (see above for details)
  threaded | Whether to multi-thread execution

## ◆ evaluateInteriorTest()

template<typename FloatTreeT, typename InteriorTest>

void evaluateInteriorTest | ( | FloatTreeT & | tree,
|  | InteriorTest | interiorTest,
|  | InteriorTestStrategy | interiorTestStrategy )

Sets the sign of voxel values of `tree` based on the `interiorTest`

Inside is set to positive and outside to negative. This is in reverse to the usual level set convention, but `meshToVolume` uses the opposite convention at certain point.

InteriorTest has to be a function `Coord -> bool` which evaluates true inside of the mesh and false outside.

Furthermore, InteriorTest does not have to be thread-safe, but it has to be copy constructible and evaluating different coppy has to be thread-safe.

Example of a interior test

auto acc = tree->getAccessor();

auto test = [acc = grid.getConstAccessor()](const Cood& coord) -> bool { return acc->get(coord) <= 0 ? true : false; }

## ◆ extractActiveVoxelSegmentMasks()

template<typename GridOrTreeType>

void extractActiveVoxelSegmentMasks | ( | const GridOrTreeType & | volume,
|  | std::vector< typename GridOrTreeType::template ValueConverter< bool >::Type::Ptr > & | masks )

Return a mask for each connected component of the given grid's active voxels.

Parameters

  volume | Input grid or tree
  masks | Output set of disjoint active topology masks sorted in descending order based on the active voxel count.

## ◆ extractEnclosedRegion()

template<typename GridOrTreeType>

GridOrTreeType::template ValueConverter< bool >::Type::Ptr extractEnclosedRegion | ( | const GridOrTreeType & | volume,
|  | typename GridOrTreeType::ValueType | isovalue = lsutilGridZero<GridOrTreeType>(),
|  | const typename TreeAdapter< GridOrTreeType >::TreeType::template ValueConverter< bool >::Type * | fillMask = nullptr )

Extracts the interior regions of a signed distance field and topologically enclosed (watertight) regions of value greater than the isovalue (cavities) that can arise as the result of CSG union operations between different shapes where at least one of the shapes has a concavity that is capped.

For example the enclosed region of a capped bottle would include the walls and the interior cavity.

Returns
  A shared pointer to either a boolean grid or tree with the same tree configuration and potentially transform as the input `volume` and whose active and `true` values correspond to the interior and enclosed regions in the input signed distance field.

Parameters

  volume | Signed distance field / level set volume.
  isovalue | Threshold below which values are considered part of the interior region.
  fillMask | Optional boolean tree, when provided enclosed cavity regions that are not completely filled by this mask are ignored.

For instance if the fill mask does not completely fill the bottle in the previous example only the walls and cap are returned and the interior cavity will be ignored.

## ◆ extractIsosurfaceMask()

template<typename GridOrTreeType>

GridOrTreeType::template ValueConverter< bool >::Type::Ptr extractIsosurfaceMask | ( | const GridOrTreeType & | volume,
|  | typename GridOrTreeType::ValueType | isovalue )

Return a mask of the voxels that intersect the implicit surface with the given isovalue.

Parameters

  volume | Signed distance field / level set volume.
  isovalue | The crossing point that is considered the surface.

## ◆ extractSparseTree()

template<typename OpType, typename DenseType>

OpType::ResultTreeType::Ptr extractSparseTree | ( | const DenseType & | dense,
|  | const OpType & | functor,
|  | const typename OpType::ResultValueType & | background,
|  | bool | threaded = true )

Selectively extract and transform data from a dense grid, producing a sparse tree with leaf nodes only (e.g. create a tree from the square of values greater than a cutoff.)

Parameters

  dense | A dense grid that acts as a data source
  functor | A functor that selects and transforms data for output
  background | The background value of the resulting sparse grid
  threaded | Option to use threaded or serial code path

Returns
  `Ptr` to tree with the valuetype and configuration defined by typedefs in the `functor`.

Note
  To achieve optimal sparsity consider calling the prune() method on the result.
  To simply copy the all the data from a Dense grid to a OpenVDB Grid, use tools::copyFromDense() for better performance.

The type of the sparse tree is determined by the specified OtpType functor by means of the typedef OptType::ResultTreeType

The OptType function is responsible for the the transformation of dense grid data to sparse grid data on a per-voxel basis.

Only leaf nodes with active values will be added to the sparse grid.

The OpType must struct that defines a the minimal form

struct ExampleOp
{
using ResultTreeType = DesiredTreeType;
template<typename IndexOrCoord>
void OpType::operator() (const DenseValueType a, const IndexOrCoord& ijk,
ResultTreeType::LeafNodeType* leaf);
};

For example, to generate a <ValueType, 5, 4, 3> tree with valuesOn at locations greater than a given maskvalue

template<typename ValueType>
class Rule
{
public:
// Standard tree type (e.g. MaskTree or FloatTree in openvdb.h)
using ResultTreeType = typename openvdb::tree::Tree4<ValueType, 5, 4, 3>::Type;
using ResultLeafNodeType = typename ResultTreeType::LeafNodeType;
using ResultValueType = typename ResultTreeType::ValueType;
using DenseValueType = float;
using Index = openvdb::Coord::ValueType;
Rule(const DenseValueType& value): mMaskValue(value){};
template<typename IndexOrCoord>
void operator()(const DenseValueType& a, const IndexOrCoord& offset,
ResultLeafNodeType* leaf) const
{
if (a > mMaskValue) {
leaf->setValueOn(offset, a);
}
}
private:
const DenseValueType mMaskValue;
};
openvdb::v12_0::math::Coord::ValueType
Int32 ValueType
Definition Coord.h:33
openvdb::v12_0::Index
Index32 Index
Definition Types.h:54

## ◆ extractSparseTreeWithMask()

template<typename DenseType, typename MaskTreeType>

DSConverter< DenseType, MaskTreeType >::Type::Ptr extractSparseTreeWithMask | ( | const DenseType & | dense,
|  | const MaskTreeType & | mask,
|  | const typename DenseType::ValueType & | background,
|  | bool | threaded = true )

Copy data from the intersection of a sparse tree and a dense input grid. The resulting tree has the same configuration as the sparse tree, but holds the data type specified by the dense input.

Parameters

  dense | A dense grid that acts as a data source
  mask | The active voxels and tiles intersected with dense define iteration mask
  background | The background value of the resulting sparse grid
  threaded | Option to use threaded or serial code path

Returns
  `Ptr` to tree with the same configuration as `mask` but of value type defined by `dense`.

## ◆ extrema() [1/2]

template<typename IterT>

math::Extrema extrema | ( | const IterT & | iter,
|  | bool | threaded = true )
| inline

Iterate over a scalar grid and compute extrema (min/max) of the values of the voxels that are visited, or iterate over a vector-valued grid and compute extrema of the magnitudes of the vectors.

Parameters

  iter | an iterator over the values of a grid or its tree (`Grid::ValueOnCIter`, `Tree::ValueOffIter`, etc.)
  threaded | if true, iterate over the grid in parallel

## ◆ extrema() [2/2]

template<typename IterT, typename ValueOp>

math::Extrema extrema | ( | const IterT & | iter,
|  | const ValueOp & | op,
|  | bool | threaded )
| inline

Iterate over a grid and compute extrema (min/max) of the values produced by applying the given functor at each voxel that is visited.

Parameters

  iter | an iterator over the values of a grid or its tree (`Grid::ValueOnCIter`, `Tree::ValueOffIter`, etc.)
  op | a 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
  threaded | if 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::Extrema& ex)
  {
  const float f = *iter;
  if (f > 0.0) {
  if (iter.isVoxelValue()) ex.add(f);
  else ex.add(f, iter.getVoxelCount());
  }
  }
  };
  FloatGrid grid = ...;
  math::Extrema stats =
  tools::extrema(grid.cbeginValueOn(), Local::addIfPositive, /*threaded=*/true);
  openvdb::v12_0::math::Extrema
  This class computes the minimum and maximum values of a population of floating-point values.
  Definition Stats.h:90
  openvdb::v12_0::math::Extrema::add
  void add(double val)
  Add a single sample.
  Definition Stats.h:103
  openvdb::v12_0::tools::extrema
  math::Extrema extrema(const IterT &iter, bool threaded=true)
  Iterate over a scalar grid and compute extrema (min/max) of the values of the voxels that are visited...
  Definition Statistics.h:354

## ◆ fillWithSpheres()

template<typename GridT, typename InterrupterT = util::NullInterrupter>

void fillWithSpheres | ( | const GridT & | grid,
|  | std::vector< openvdb::Vec4s > & | spheres,
|  | const Vec2i & | sphereCount = Vec2i(1, 50),
|  | bool | overlapping = false,
|  | float | minRadius = 1.0,
|  | float | maxRadius = std::numeric_limits<float>::max(),
|  | float | isovalue = 0.0,
|  | int | instanceCount = 10000,
|  | InterrupterT * | interrupter = nullptr )

Fill a closed level set or fog volume with adaptively-sized spheres.

Parameters

  grid | a scalar grid that defines the surface to be filled with spheres
  spheres | an output array of 4-tuples representing the fitted spheres The first three components of each tuple specify the sphere center, and the fourth specifies the radius. The spheres are ordered by radius, from largest to smallest.
  sphereCount | lower and upper bounds on the number of spheres to be generated The actual number will be somewhere within the bounds.
  overlapping | toggle to allow spheres to overlap/intersect
  minRadius | the smallest allowable sphere size, in voxel units
  maxRadius | the largest allowable sphere size, in voxel units
  isovalue | the voxel value that determines the surface of the volume The default value of zero works for signed distance fields, while fog volumes require a larger positive value (0.5 is a good initial guess).
  instanceCount | the number of interior points to consider for the sphere placement Increasing this count increases the chances of finding optimal sphere sizes.
  interrupter | pointer to an object adhering to the util::NullInterrupter interface

Note
  The minimum sphere count takes precedence over the minimum radius.

## ◆ findFeaturePoint()

Vec3d 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".

## ◆ floodFillLeafNode()

template<typename T, Index Log2Dim, typename InteriorTest>

void floodFillLeafNode | ( | tree::LeafNode< T, Log2Dim > & | leafNode,
|  | const InteriorTest & | interiorTest )

## ◆ fogToExt()

template<typename FogGridT, typename ExtOpT, typename ExtValueT>

FogGridT::template ValueConverter< ExtValueT >::Type::Ptr fogToExt | ( | const FogGridT & | fogGrid,
|  | const ExtOpT & | op,
|  | const ExtValueT & | background,
|  | typename FogGridT::ValueType | isoValue,
|  | int | nIter = 1,
|  | FastSweepingDomain | mode = FastSweepingDomain::SWEEP_ALL,
|  | const typename FogGridT::template ValueConverter< ExtValueT >::Type::ConstPtr | extGrid = nullptr )

Computes the extension of a field (scalar, vector, or int are supported), defined by the specified functor, off an iso-surface from an input FOG volume.

Returns
  A shared pointer to the extension field defined from the active values in the input fog volume.

Parameters

  fogGrid | Scalar (floating-point) volume from which an iso-surface can be defined.
  op | Functor with signature [](const Vec3R &xyz)->ExtValueT that defines the Dirichlet boundary condition, on the iso-surface, of the field to be extended.
  background | Background value of return grid with the extension field.
  isoValue | A value which defines a smooth iso-surface that intersects active voxels in fogGrid.
  nIter | Number of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.
  mode | Determines the mode of updating the extension field. SWEEP_ALL will update all voxels of the extension field affected by the fast sweeping algorithm. SWEEP_GREATER_THAN_ISOVALUE will update all voxels corresponding to fog values that are greater than a given isovalue. SWEEP_LESS_THAN_ISOVALUE will update all voxels corresponding to fog values that are less than a given isovalue. If a mode other than SWEEP_ALL is chosen, a user needs to supply extGrid.
  extGrid | Optional parameter required to supply a default value for the extension field when SWEEP_GREATER_THAN_ISOVALUE or SWEEP_LESS_THAN_ISOVALUE mode is picked for mode. When SWEEP_GREATER_THAN_ISOVALUE is supplied as an argument for mode, the extension field voxel will default to the value of the extGrid in that position if it corresponds to a fog value that is less than the isovalue. Otherwise, the extension field voxel value will be computed by the Fast Sweeping algorithm. The opposite convention is implemented when SWEEP_LESS_THAN_ISOVALUE is supplied as an argument for mode.

Note
  Strictly speaking a fog volume is normalized to the range [0,1] but this method accepts a scalar volume with an arbritary range, as long as the it includes the isoValue.

Topology of output grid is identical to that of the input grid, except active tiles in the input grid will be converted to active voxels in the output grid!

Warning
  If isoValue does not intersect any active values in fogGrid then the returned grid has all its active values set to background.

## ◆ fogToSdf()

template<typename GridT>

GridT::Ptr fogToSdf | ( | const GridT & | fogGrid,
|  | typename GridT::ValueType | isoValue,
|  | int | nIter = 1 )

Converts a scalar fog volume into a signed distance function. Active input voxels with scalar values above the given isoValue will have NEGATIVE distance values on output, i.e. they are assumed to be INSIDE the iso-surface.

Returns
  A shared pointer to a signed-distance field defined on the active values of the input fog volume.

Parameters

  fogGrid | Scalar (floating-point) volume from which an iso-surface can be defined.
  isoValue | A value which defines a smooth iso-surface that intersects active voxels in fogGrid.
  nIter | Number of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.

Note
  Strictly speaking a fog volume is normalized to the range [0,1] but this method accepts a scalar volume with an arbritary range, as long as the it includes the isoValue.

Topology of output grid is identical to that of the input grid, except active tiles in the input grid will be converted to active voxels in the output grid!

Warning
  If isoValue does not intersect any active values in fogGrid then the returned grid has all its active values set to plus or minus infinity, depending on if the input values are larger or smaller than isoValue.

## ◆ fogToSdfAndExt()

template<typename FogGridT, typename ExtOpT, typename ExtValueT>

std::pair< typename FogGridT::Ptr, typename FogGridT::template ValueConverter< ExtValueT >::Type::Ptr > fogToSdfAndExt | ( | const FogGridT & | fogGrid,
|  | const ExtOpT & | op,
|  | const ExtValueT & | background,
|  | typename FogGridT::ValueType | isoValue,
|  | int | nIter = 1,
|  | FastSweepingDomain | mode = FastSweepingDomain::SWEEP_ALL,
|  | const typename FogGridT::template ValueConverter< ExtValueT >::Type::ConstPtr | extGrid = nullptr )

Computes the signed distance field and the extension of a field (scalar, vector, or int are supported), defined by the specified functor, off an iso-surface from an input FOG volume.

Returns
  An pair of two shared pointers to respectively the SDF and extension field

Parameters

  fogGrid | Scalar (floating-point) volume from which an iso-surface can be defined.
  op | Functor with signature [](const Vec3R &xyz)->ExtValueT that defines the Dirichlet boundary condition, on the iso-surface, of the field to be extended.
  background | Background value of return grid with the extension field.
  isoValue | A value which defines a smooth iso-surface that intersects active voxels in fogGrid.
  nIter | Number of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.
  mode | Determines the mode of updating the extension field. SWEEP_ALL will update all voxels of the extension field affected by the fast sweeping algorithm. SWEEP_GREATER_THAN_ISOVALUE will update all voxels corresponding to fog values that are greater than a given isovalue. SWEEP_LESS_THAN_ISOVALUE will update all voxels corresponding to fog values that are less than a given isovalue. If a mode other than SWEEP_ALL is chosen, a user needs to supply extGrid.
  extGrid | Optional parameter required to supply a default value for the extension field when SWEEP_GREATER_THAN_ISOVALUE or SWEEP_LESS_THAN_ISOVALUE mode is picked for mode. When SWEEP_GREATER_THAN_ISOVALUE is supplied as an argument for mode, the extension field voxel will default to the value of the extGrid in that position if it corresponds to a fog value that is less than the isovalue. Otherwise, the extension field voxel value will be computed by the Fast Sweeping algorithm. The opposite convention is implemented when SWEEP_LESS_THAN_ISOVALUE is supplied as an argument for mode.

Note
  Strictly speaking a fog volume is normalized to the range [0,1] but this method accepts a scalar volume with an arbritary range, as long as the it includes the isoValue.

Topology of output grids are identical to that of the input grid, except active tiles in the input grid will be converted to active voxels in the output grids!

Warning
  If isoValue does not intersect any active values in fogGrid then a pair of the following grids is returned: The first is a signed distance grid with its active values set to plus or minus infinity depending of whether its input values are above or below isoValue. The second grid, which represents the extension field, has all its active values set to background.

## ◆ foreach() [1/2]

template<typename IterT, typename XformOp>

void foreach | ( | const IterT & | iter,
|  | const XformOp & | op,
|  | bool | threaded = true,
|  | bool | shareOp = true )
| inline

## ◆ foreach() [2/2]

template<typename IterT, typename XformOp>

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

  iter | an iterator over a grid or its tree (`Grid::ValueOnCIter`, `Tree::NodeIter`, etc.)
  op | a functor of the form `void op(const IterT&)`, where `IterT` is the type of iter
  threaded | if true, transform multiple values of the grid in parallel
  shareOp | if 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);
  openvdb::v12_0::Grid< FloatTree >::ValueAllIter
  typename FloatTree::ValueAllIter ValueAllIter
  Definition Grid.h:586
  openvdb::v12_0::tools::foreach
  void foreach(const IterT &iter, XformOp &op, bool threaded=true, bool shareOp=true)
  Definition ValueTransformer.h:382

Example:
  Rotate all active vectors of a vector grid by 45 degrees about the y axis.
  namespace {
  struct MatMul {
  math::Mat3s M;
  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, openvdb::math::pi<double>()/4.0)));
  }
  openvdb::v12_0::Grid< Vec3STree >::ValueOnIter
  typename Vec3STree::ValueOnIter ValueOnIter
  Definition Grid.h:582
  openvdb::v12_0::math::Mat3::transform
  Vec3< T0 > transform(const Vec3< T0 > &v) const
  Definition Mat3.h:505
  openvdb::v12_0::math::Mat3s
  Mat3< float > Mat3s
  Definition Mat3.h:833
  openvdb::v12_0::math::rotation
  MatType rotation(const Quat< typename MatType::value_type > &q, typename MatType::value_type eps=static_cast< typename MatType::value_type >(1.0e-8))
  Return the rotation matrix specified by the given quaternion.
  Definition Mat.h:172
  openvdb::v12_0::VectorGrid
  Vec3fGrid VectorGrid
  Definition openvdb.h:86
  openvdb::v12_0::tools::MatMul
  Definition VectorTransformer.h:47
  openvdb::v12_0::tools::MatMul::MatMul
  MatMul(const Mat4d &_mat)
  Definition VectorTransformer.h:49
  openvdb::v12_0::tools::MatMul::mat
  const Mat4d mat
  Definition VectorTransformer.h:48
  openvdb::v12_0::tools::MatMul::operator()
  void operator()(const TreeIterT &it) const
  Definition VectorTransformer.h:51

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.

## ◆ getValidPointIndexGrid() [1/2]

template<typename GridT, typename PointArrayT>

GridT::ConstPtr getValidPointIndexGrid | ( | const PointArrayT & | points,
|  | const typename GridT::ConstPtr & | grid )
| inline

Repartition the points if needed, otherwise return the input grid.

## ◆ getValidPointIndexGrid() [2/2]

template<typename GridT, typename PointArrayT>

GridT::Ptr getValidPointIndexGrid | ( | const PointArrayT & | points,
|  | const typename GridT::Ptr & | grid )
| inline

Repartition the points if needed, otherwise return the input grid.

## ◆ gradient() [1/4]

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.

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.

## ◆ gradient() [2/4]

template<typename GridType>

ScalarToVectorConverter< GridType >::Type::Ptr gradient | ( | const GridType & | grid,
|  | bool | threaded = true )

## ◆ gradient() [3/4]

template<typename GridType, typename MaskT, typename InterruptT>

ScalarToVectorConverter< GridType >::Type::Ptr gradient | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded,
|  | InterruptT * | interrupt )

## ◆ gradient() [4/4]

template<typename GridType, typename MaskT>

ScalarToVectorConverter< GridType >::Type::Ptr gradient | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded = true )

## ◆ histogram()

template<typename IterT>

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

  iter | an iterator over the values of a grid or its tree (`Grid::ValueOnCIter`, `Tree::ValueOffIter`, etc.)
  minVal | the smallest value that can be added to the histogram
  maxVal | the largest value that can be added to the histogram
  numBins | the number of histogram bins
  threaded | if true, iterate over the grid in parallel

## ◆ if()

if | ( | shared |  | ) |

## ◆ interiorMask()

template<typename GridType>

GridType::template ValueConverter< bool >::Type::Ptr interiorMask | ( | const GridType & | grid,
|  | const double | isovalue = 0.0 )

Given an input grid of any type, return a new, boolean grid whose active voxel topology matches the input grid's or, if the input grid is a level set, matches the input grid's interior.

Parameters

  grid | the grid from which to construct a mask
  isovalue | for a level set grid, the isovalue that defines the grid's interior

See also
  tools::sdfInteriorMask()

## ◆ isValidPartition()

template<typename PointArrayT, typename GridT>

bool isValidPartition | ( | const PointArrayT & | points,
|  | const GridT & | grid )
| inline

Return `true` if the given point index grid represents a valid partitioning of the given point array.

Parameters

  points | world-space point array conforming to the PointArray interface
  grid | point index grid to validate

## ◆ laplacian() [1/4]

template<typename GridType, typename InterruptT>

GridType::Ptr laplacian | ( | const GridType & | grid,
|  | bool | threaded,
|  | InterruptT * | interrupt )

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.

## ◆ laplacian() [2/4]

template<typename GridType>

GridType::Ptr laplacian | ( | const GridType & | grid,
|  | bool | threaded = true )

## ◆ laplacian() [3/4]

template<typename GridType, typename MaskT, typename InterruptT>

GridType::Ptr laplacian | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded,
|  | InterruptT * | interrupt )

## ◆ laplacian() [4/4]

template<typename GridType, typename MaskT>

GridType::Ptr laplacian | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded = true )

## ◆ levelSetArea() [1/2]

template<class GridT>

Real levelSetArea | ( | const GridT & | grid,
|  | bool | useWorldUnits )

## ◆ levelSetArea() [2/2]

template<class GridType>

Real levelSetArea | ( | const GridType & | grid,
|  | bool | useWorldSpace = true )

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

Parameters

  grid | a scalar, floating-point grid with one or more disjoint, closed level set surfaces
  useWorldSpace | if true the area is computed in world space units, else in voxel units.

Exceptions

  TypeError | if grid is not scalar or not floating-point or not a level set or empty.

## ◆ levelSetEulerCharacteristic() [1/2]

template<class GridT>

int levelSetEulerCharacteristic | ( | const GridT & | grid | ) |

## ◆ levelSetEulerCharacteristic() [2/2]

template<class GridType>

int levelSetEulerCharacteristic | ( | const GridType & | grid | ) |

Return the Euler Characteristics of a narrow-band level set surface (possibly disconnected).

Parameters

  grid | a scalar, floating-point grid with one or more disjoint, closed level set surfaces

Exceptions

  TypeError | if grid is not scalar or not floating-point or not a level set or empty.

## ◆ levelSetGenus() [1/2]

template<class GridT>

int levelSetGenus | ( | const GridT & | grid | ) |

## ◆ levelSetGenus() [2/2]

template<class GridType>

int levelSetGenus | ( | const GridType & | grid | ) |

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

Parameters

  grid | a scalar, floating-point grid with one or more disjoint, closed level set surfaces

Warning
  The genus is only well defined for a single connected surface

Exceptions

  TypeError | if grid is not scalar or not floating-point or not a level set or empty.

## ◆ levelSetRebuild() [1/3]

template<class GridType>

GridType::Ptr levelSetRebuild | ( | const GridType & | grid,
|  | float | isovalue,
|  | float | exBandWidth,
|  | float | inBandWidth,
|  | const math::Transform * | xform = nullptr )

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

Parameters

  grid | a scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
  isovalue | the isovalue that defines the implicit surface
  exBandWidth | the exterior narrow-band width in voxel units
  inBandWidth | the interior narrow-band width in voxel units
  xform | optional transform for the output grid (if not provided, the transform of the input grid will be matched)

Exceptions

  TypeError | if grid is not scalar or not floating-point

Note
  If the input grid contains overlapping isosurfaces, interior edges will be lost.

## ◆ levelSetRebuild() [2/3]

template<class GridType, typename InterruptT>

GridType::Ptr levelSetRebuild | ( | const GridType & | grid,
|  | float | isovalue,
|  | float | exBandWidth,
|  | float | inBandWidth,
|  | const math::Transform * | xform = nullptr,
|  | InterruptT * | interrupter = nullptr )

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

Parameters

  grid | a scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
  isovalue | the isovalue that defines the implicit surface
  exBandWidth | the exterior narrow-band width in voxel units
  inBandWidth | the interior narrow-band width in voxel units
  xform | optional transform for the output grid (if not provided, the transform of the input grid will be matched)
  interrupter | optional interrupter object

Exceptions

  TypeError | if grid is not scalar or not floating-point

Note
  If the input grid contains overlapping isosurfaces, interior edges will be lost.

## ◆ levelSetRebuild() [3/3]

template<class GridType>

GridType::Ptr levelSetRebuild | ( | const GridType & | grid,
|  | float | isovalue = 0,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH),
|  | const math::Transform * | xform = nullptr )

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

Parameters

  grid | a scalar, floating-point grid with one or more disjoint, closed isosurfaces at the given isovalue
  isovalue | the isovalue that defines the implicit surface (defaults to zero, which is typical if the input grid is already a level set or a SDF).
  halfWidth | half the width of the narrow band, in voxel units (defaults to 3 voxels, which is required for some level set operations)
  xform | optional transform for the output grid (if not provided, the transform of the input grid will be matched)

Exceptions

  TypeError | if grid is not scalar or not floating-point

Note
  If the input grid contains overlapping isosurfaces, interior edges will be lost.

## ◆ levelSetVolume() [1/2]

template<class GridT>

Real levelSetVolume | ( | const GridT & | grid,
|  | bool | useWorldUnits )

## ◆ levelSetVolume() [2/2]

template<class GridType>

Real levelSetVolume | ( | const GridType & | grid,
|  | bool | useWorldSpace = true )

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

Parameters

  grid | a scalar, floating-point grid with one or more disjoint, closed level set surfaces
  useWorldSpace | if true the volume is computed in world space units, else in voxel units.

Exceptions

  TypeError | if grid is not scalar or not floating-point or not a level set or empty.

## ◆ magnitude() [1/4]

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.

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.

## ◆ magnitude() [2/4]

template<typename GridType>

VectorToScalarConverter< GridType >::Type::Ptr magnitude | ( | const GridType & | grid,
|  | bool | threaded = true )

## ◆ magnitude() [3/4]

template<typename GridType, typename MaskT, typename InterruptT>

VectorToScalarConverter< GridType >::Type::Ptr magnitude | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded,
|  | InterruptT * | interrupt )

## ◆ magnitude() [4/4]

template<typename GridType, typename MaskT>

VectorToScalarConverter< GridType >::Type::Ptr magnitude | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded = true )

## ◆ maskPoints()

template<typename PointListT, typename GridT>

void maskPoints | ( | const PointListT & | points,
|  | GridT & | grid )
| inline

Makes every voxel of the `grid` active if it contains a point.

Parameters

  points | points that active the voxels of `grid`
  grid | on out its voxels with points are active

## ◆ maskSdf()

template<typename GridT, typename MaskTreeT>

GridT::Ptr maskSdf | ( | const GridT & | sdfGrid,
|  | const Grid< MaskTreeT > & | mask,
|  | bool | ignoreActiveTiles = false,
|  | int | nIter = 1 )

Fills mask by extending an existing signed distance field into the active values of this input ree of arbitrary value type.

Returns
  A shared pointer to the masked signed distance field.

Parameters

  sdfGrid | Input signed distance field to be extended into the mask.
  mask | Mask used to identify the topology of the output SDF. Note this mask is assume to overlap with the sdfGrid.
  ignoreActiveTiles | If false, active tiles in the mask are treated as active voxels. Else they are ignored.
  nIter | Number of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.

Topology of the output SDF is determined by the union of the active voxels (or optionally values) in sdfGrid and mask.

## ◆ meanCurvature() [1/4]

template<typename GridType, typename InterruptT>

GridType::Ptr meanCurvature | ( | const GridType & | grid,
|  | bool | threaded,
|  | InterruptT * | interrupt )

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.

## ◆ meanCurvature() [2/4]

template<typename GridType>

GridType::Ptr meanCurvature | ( | const GridType & | grid,
|  | bool | threaded = true )

## ◆ meanCurvature() [3/4]

template<typename GridType, typename MaskT, typename InterruptT>

GridType::Ptr meanCurvature | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded,
|  | InterruptT * | interrupt )

## ◆ meanCurvature() [4/4]

template<typename GridType, typename MaskT>

GridType::Ptr meanCurvature | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded = true )

## ◆ memUsage()

template<typename TreeT>

Index64 memUsage | ( | const TreeT & | tree,
|  | bool | threaded = true )

Return the total amount of memory in bytes occupied by this tree.

This method returns the total in-core memory usage which can be different to the maximum possible memory usage for trees which have not been fully deserialized (via delay-loading). Thus, this is the current true memory consumption.

## ◆ memUsageIfLoaded()

template<typename TreeT>

Index64 memUsageIfLoaded | ( | const TreeT & | tree,
|  | bool | threaded = true )

Return the deserialized memory usage of this tree. This is not necessarily equal to the current memory usage (returned by tools::memUsage) if delay-loading is enabled. See File::open.

## ◆ meshToLevelSet() [1/6]

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.

Returns
  a grid of type `GridType` containing a narrow-band level set representation of the input mesh.

Exceptions

  TypeError | if `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

  xform | transform for the output grid
  points | list of world space point positions
  triangles | triangle index list
  quads | quad index list
  halfWidth | half the width of the narrow band, in voxel units

## ◆ meshToLevelSet() [2/6]

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.

Returns
  a grid of type `GridType` containing a narrow-band level set representation of the input mesh.

Exceptions

  TypeError | if `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

  xform | transform for the output grid
  points | list of world space point positions
  triangles | triangle index list
  halfWidth | half the width of the narrow band, in voxel units

## ◆ meshToLevelSet() [3/6]

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.

Returns
  a grid of type `GridType` containing a narrow-band level set representation of the input mesh.

Exceptions

  TypeError | if `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

  xform | transform for the output grid
  points | list of world space point positions
  quads | quad index list
  halfWidth | half the width of the narrow band, in voxel units

## ◆ meshToLevelSet() [4/6]

template<typename GridType, typename Interrupter>

GridType::Ptr meshToLevelSet | ( | Interrupter & | interrupter,
|  | 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) )

Adds support for a interrupter callback used to cancel the conversion.

## ◆ meshToLevelSet() [5/6]

template<typename GridType, typename Interrupter>

GridType::Ptr meshToLevelSet | ( | Interrupter & | interrupter,
|  | const openvdb::math::Transform & | xform,
|  | const std::vector< Vec3s > & | points,
|  | const std::vector< Vec3I > & | triangles,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH) )

Adds support for a interrupter callback used to cancel the conversion.

## ◆ meshToLevelSet() [6/6]

template<typename GridType, typename Interrupter>

GridType::Ptr meshToLevelSet | ( | Interrupter & | interrupter,
|  | const openvdb::math::Transform & | xform,
|  | const std::vector< Vec3s > & | points,
|  | const std::vector< Vec4I > & | quads,
|  | float | halfWidth = float(LEVEL_SET_HALF_WIDTH) )

Adds support for a interrupter callback used to cancel the conversion.

## ◆ meshToSignedDistanceField() [1/2]

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.

Returns
  a grid of type `GridType` containing a narrow-band signed distance field representation of the input mesh.

Exceptions

  TypeError | if `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

  xform | transform for the output grid
  points | list of world space point positions
  triangles | triangle index list
  quads | quad index list
  exBandWidth | the exterior narrow-band width in voxel units
  inBandWidth | the interior narrow-band width in voxel units

## ◆ meshToSignedDistanceField() [2/2]

template<typename GridType, typename Interrupter>

GridType::Ptr meshToSignedDistanceField | ( | Interrupter & | interrupter,
|  | const openvdb::math::Transform & | xform,
|  | const std::vector< Vec3s > & | points,
|  | const std::vector< Vec3I > & | triangles,
|  | const std::vector< Vec4I > & | quads,
|  | float | exBandWidth,
|  | float | inBandWidth )

Adds support for a interrupter callback used to cancel the conversion.

## ◆ meshToUnsignedDistanceField() [1/2]

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.

Returns
  a grid of type `GridType` containing a narrow-band unsigned distance field representation of the input mesh.

Exceptions

  TypeError | if `GridType` is not scalar or not floating-point

Note
  Does not requires a closed surface.

Parameters

  xform | transform for the output grid
  points | list of world space point positions
  triangles | triangle index list
  quads | quad index list
  bandWidth | the width of the narrow band, in voxel units

## ◆ meshToUnsignedDistanceField() [2/2]

template<typename GridType, typename Interrupter>

GridType::Ptr meshToUnsignedDistanceField | ( | Interrupter & | interrupter,
|  | const openvdb::math::Transform & | xform,
|  | const std::vector< Vec3s > & | points,
|  | const std::vector< Vec3I > & | triangles,
|  | const std::vector< Vec4I > & | quads,
|  | float | bandWidth )

Adds support for a interrupter callback used to cancel the conversion.

## ◆ meshToVolume() [1/2]

template<typename GridType, typename MeshDataAdapter, typename InteriorTest = std::nullptr_t>

GridType::Ptr meshToVolume | ( | const MeshDataAdapter & | mesh,
|  | const math::Transform & | transform,
|  | float | exteriorBandWidth = 3.0f,
|  | float | interiorBandWidth = 3.0f,
|  | int | flags = 0,
|  | typename GridType::template ValueConverter< Int32 >::Type * | polygonIndexGrid = nullptr,
|  | InteriorTest | interiorTest = nullptr,
|  | InteriorTestStrategy | interiorTestStrat = EVAL_EVERY_VOXEL )

## ◆ meshToVolume() [2/2]

template<typename GridType, typename MeshDataAdapter, typename Interrupter, typename InteriorTest = std::nullptr_t>

GridType::Ptr meshToVolume | ( | Interrupter & | interrupter,
|  | const MeshDataAdapter & | mesh,
|  | const math::Transform & | transform,
|  | float | exteriorBandWidth = 3.0f,
|  | float | interiorBandWidth = 3.0f,
|  | int | flags = 0,
|  | typename GridType::template ValueConverter< Int32 >::Type * | polygonIndexGrid = nullptr,
|  | InteriorTest | interiorTest = nullptr,
|  | InteriorTestStrategy | interiorTestStrategy = EVAL_EVERY_VOXEL )

Convert polygonal meshes that consist of quads and/or triangles into signed or unsigned distance field volumes.

Parameters

  interrupter | a callback to interrupt the conversion process that conforms to the util::NullInterrupter interface
  mesh | mesh data access class that conforms to the MeshDataAdapter interface
  transform | world-to-index-space transform
  exteriorBandWidth | exterior narrow band width in voxel units
  interiorBandWidth | interior narrow band width in voxel units (set this value to std::numeric_limits<float>::max() to fill interior regions with distance values)
  flags | optional conversion flags defined in `MeshToVolumeFlags`
  polygonIndexGrid | optional grid output that will contain the closest-polygon index for each voxel in the active narrow band region
  interiorTest | function `Coord -> Bool` that evaluates to true inside of the mesh and false outside, for more see evaluatInteriorTest
  interiorTestStrat | determines how the interiorTest is used, see InteriorTestStrategy

## ◆ minMax()

template<typename TreeT>

math::MinMax< typename TreeT::ValueType > minMax | ( | const TreeT & | tree,
|  | bool | threaded = true )

Return the minimum and maximum active values in this tree.

Note
  Returns zeroVal<ValueType> for empty trees.

## ◆ noActiveValues()

template<typename TreeT>

bool noActiveValues | ( | const TreeT & | tree,
|  | const CoordBBox & | bbox )

Returns true if the bounding box intersects none of the active values in a tree, i.e. neither active voxels or active tiles.

Warning
  For repeated calls to this method consider instead creating an instance of FindActiveValues and then repeatedly call noActiveValues(). This assumes the tree to be constant between calls but is slightly faster.

Parameters

  tree | const tree to be tested for active values.
  bbox | index bounding box which is intersected against the active values.

## ◆ normalize() [1/4]

template<typename GridType, typename InterruptT>

GridType::Ptr normalize | ( | const GridType & | grid,
|  | bool | threaded,
|  | InterruptT * | interrupt )

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.

## ◆ normalize() [2/4]

template<typename GridType>

GridType::Ptr normalize | ( | const GridType & | grid,
|  | bool | threaded = true )

## ◆ normalize() [3/4]

template<typename GridType, typename MaskT, typename InterruptT>

GridType::Ptr normalize | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded,
|  | InterruptT * | interrupt )

## ◆ normalize() [4/4]

template<typename GridType, typename MaskT>

GridType::Ptr normalize | ( | const GridType & | grid,
|  | const MaskT & | mask,
|  | bool | threaded = true )

## ◆ OPENVDB_UBSAN_SUPPRESS()

template<typename InIterT, typename OutGridT, typename XformOp>

OPENVDB_UBSAN_SUPPRESS | ( | "undefined" |  | ) | const &
| 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

  inIter | a non-`const` or (preferably) `const` iterator over an input grid or its tree (`Grid::ValueOnCIter`, `Tree::NodeIter`, etc.)
  outGrid | an empty grid to be populated
  op | a functor of the form `void op(const InIterT&, OutGridT::ValueAccessor&)`, where `InIterT` is the type of inIter
  threaded | if true, transform multiple values of the input grid in parallel
  shareOp | if true and threaded is true, all threads use the same functor; otherwise, each thread gets its own copy of the original functor
  merge | how 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(
  const Vec3fGrid::ValueOnCIter& iter,
  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);
  openvdb::v12_0::math::CoordBBox
  Axis-aligned bounding box of signed integer coordinates.
  Definition Coord.h:252
  openvdb::v12_0::tools::outGrid
  OutGridT & outGrid
  Definition ValueTransformer.h:139
  openvdb::v12_0::Vec3fGrid
  Vec3SGrid Vec3fGrid
  Definition openvdb.h:85

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.

## ◆ operator<<()

std::ostream & operator<< | ( | std::ostream & | ostr,
|  | const MeshToVoxelEdgeData::EdgeData & | rhs )
| inline

## ◆ opExtrema()

template<typename OperatorT, typename IterT>

math::Extrema opExtrema | ( | const IterT & | iter,
|  | const OperatorT & | op = OperatorT(),
|  | bool | threaded = true )
| inline

Same as opStatistics except it returns a math::Extrema vs a math::Stats.

## ◆ opStatistics()

template<typename OperatorT, typename IterT>

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

  iter | an iterator over the values of a grid or its tree (`Grid::ValueOnCIter`, `Tree::ValueOffIter`, etc.)
  op | an operator object with a method of the form `double result(Accessor&, const Coord&)`
  threaded | if 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.
  using MapType = math::UniformScaleMap;
  // Specify a world-space gradient operator that uses first-order differencing.
  using GradientOp = math::Gradient<MapType, math::FD_1ST>;
  // Wrap the operator with an adapter that computes the magnitude of the gradient.
  using MagnitudeOp = math::OpMagnitude<GradientOp, MapType>;
  // Wrap the operator with an adapter that associates a map with it.
  using CompoundOp = math::MapAdapter<MapType, GradientOp, double>;
  if (MapType::Ptr map = grid.constTransform().constMap<MapType>()) {
  math::Stats stats = tools::opStatistics(grid.cbeginValueOn(), CompoundOp(*map));
  }
  openvdb::v12_0::GridBase::constTransform
  const math::Transform & constTransform() const
  Return a pointer to this grid's transform, which might be shared with other grids.
  Definition Grid.h:413
  openvdb::v12_0::Grid::cbeginValueOn
  ValueOnCIter cbeginValueOn() const
  Return an iterator over all of this grid's active values (tile and voxel).
  Definition Grid.h:759
  openvdb::v12_0::math::Transform::constMap
  MapType::ConstPtr constMap() const
  Definition Transform.h:189
  openvdb::v12_0::math::UniformScaleMap
  A specialized Affine transform that scales along the principal axis the scaling is uniform in the thr...
  Definition Maps.h:906
  openvdb::v12_0::tools::opStatistics
  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 ...
  Definition Statistics.h:398
  openvdb::v12_0::math::Gradient
  Center difference gradient operators, defined with respect to the range-space of the map.
  Definition Operators.h:620
  openvdb::v12_0::math::MapAdapter
  Adapter to associate a map with a world-space operator, giving it the same call signature as an index...
  Definition Operators.h:35
  openvdb::v12_0::math::OpMagnitude
  Adapter for vector-valued world-space operators to return the vector magnitude.
  Definition Operators.h:66

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.
  using MapType = math::UniformScaleMap;
  // Specify a world-space divergence operator that uses first-order differencing.
  using DivergenceOp = math::Divergence<MapType, math::FD_1ST>;
  // Wrap the operator with an adapter that associates a map with it.
  using CompoundOp = math::MapAdapter<MapType, DivergenceOp, double>;
  if (MapType::Ptr map = grid.constTransform().constMap<MapType>()) {
  math::Stats stats = tools::opStatistics(grid.cbeginValueOn(), CompoundOp(*map));
  }
  openvdb::v12_0::Vec3SGrid
  Grid< Vec3STree > Vec3SGrid
  Definition openvdb.h:81
  openvdb::v12_0::math::Divergence
  Compute the divergence of a vector-valued grid using differencing of various orders,...
  Definition Operators.h:950

Example:
  As above, but computing the divergence in index space.
  Vec3SGrid grid = ...;
  // Specify an index-space divergence operator that uses first-order differencing.
  using DivergenceOp = math::ISDivergence<math::FD_1ST>;
  math::Stats stats = tools::opStatistics(grid.cbeginValueOn(), DivergenceOp());
  openvdb::v12_0::math::ISDivergence
  Divergence operator defined in index space using various first derivative schemes.
  Definition Operators.h:473

## ◆ particlesToMask() [1/2]

template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>

void particlesToMask | ( | const ParticleListT & | plist,
|  | GridT & | grid,
|  | InterrupterT * | interrupt = nullptr )
| inline

Activate a boolean grid wherever it intersects the spheres described by the given particle positions and radii.

For more control over the output, including attribute transfer, use the ParticlesToLevelSet class directly.

## ◆ particlesToMask() [2/2]

template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>

void particlesToMask | ( | const ParticleListT & | plist,
|  | GridT & | grid,
|  | Real | radius,
|  | InterrupterT * | interrupt = nullptr )
| inline

Activate a boolean grid wherever it intersects the fixed-size spheres described by the given particle positions and the specified radius.

For more control over the output, including attribute transfer, use the ParticlesToLevelSet class directly.

## ◆ particlesToSdf() [1/2]

template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>

void particlesToSdf | ( | const ParticleListT & | plist,
|  | GridT & | grid,
|  | InterrupterT * | interrupt = nullptr )
| inline

Populate a scalar, floating-point grid with CSG-unioned level set spheres described by the given particle positions and radii.

For more control over the output, including attribute transfer, use the ParticlesToLevelSet class directly.

## ◆ particlesToSdf() [2/2]

template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>

void particlesToSdf | ( | const ParticleListT & | plist,
|  | GridT & | grid,
|  | Real | radius,
|  | InterrupterT * | interrupt = nullptr )
| inline

Populate a scalar, floating-point grid with fixed-size, CSG-unioned level set spheres described by the given particle positions and the specified radius.

For more control over the output, including attribute transfer, use the ParticlesToLevelSet class directly.

## ◆ particleTrailsToMask()

template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>

void particleTrailsToMask | ( | const ParticleListT & | plist,
|  | GridT & | grid,
|  | Real | delta = 1,
|  | InterrupterT * | interrupt = nullptr )
| inline

Activate a boolean grid wherever it intersects trails of spheres with decreasing radius, where the starting position and radius and the direction of each trail is given by particle attributes.

For more control over the output, including attribute transfer, use the ParticlesToLevelSet class directly.

Note
  The delta parameter controls the distance between spheres in a trail. Be careful not to use too small a value.

## ◆ particleTrailsToSdf()

template<typename GridT, typename ParticleListT, typename InterrupterT = util::NullInterrupter>

void particleTrailsToSdf | ( | const ParticleListT & | plist,
|  | GridT & | grid,
|  | Real | delta = 1,
|  | InterrupterT * | interrupt = nullptr )
| inline

Populate a scalar, floating-point grid with CSG-unioned trails of level set spheres with decreasing radius, where the starting position and radius and the direction of each trail is given by particle attributes.

For more control over the output, including attribute transfer, use the ParticlesToLevelSet class directly.

Note
  The delta parameter controls the distance between spheres in a trail. Be careful not to use too small a value.

## ◆ proc()

Processor proc | ( | inIter | ,
|  | Adapter::tree(outGrid) | ,
|  | op | ,
|  | merge | )

## ◆ process()

proc process | ( | threaded |  | ) |

## ◆ prune()

template<typename TreeT>

void prune | ( | TreeT & | tree,
|  | typename TreeT::ValueType | tolerance = zeroVal<typename TreeT::ValueType>(),
|  | bool | threaded = true,
|  | size_t | grainSize = 1 )

Reduce the memory footprint of a tree by replacing with tiles any nodes whose values are all the same (optionally to within a tolerance) and have the same active state.

Note
  For trees with non-boolean values a child node with (approximately) constant values are replaced with a tile value corresponding to the median of the values in said child node.

Parameters

  tree | the tree to be pruned
  tolerance | tolerance within which values are considered to be equal
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 1)

## ◆ pruneInactive()

template<typename TreeT>

void pruneInactive | ( | TreeT & | tree,
|  | bool | threaded = true,
|  | size_t | grainSize = 1 )

Reduce the memory footprint of a tree by replacing with background tiles any nodes whose values are all inactive.

Parameters

  tree | the tree to be pruned
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 1)

## ◆ pruneInactiveWithValue()

template<typename TreeT>

void pruneInactiveWithValue | ( | TreeT & | tree,
|  | const typename TreeT::ValueType & | value,
|  | bool | threaded = true,
|  | size_t | grainSize = 1 )

Reduce the memory footprint of a tree by replacing any nodes whose values are all inactive with tiles of the given value.

Parameters

  tree | the tree to be pruned
  value | value assigned to inactive tiles created during pruning
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 1)

## ◆ pruneLevelSet() [1/2]

template<typename TreeT>

void pruneLevelSet | ( | TreeT & | tree,
|  | bool | threaded = true,
|  | size_t | grainSize = 1 )

Reduce the memory footprint of a tree by replacing nodes whose values are all inactive with inactive tiles having a value equal to the first value encountered in the (inactive) child.

This method is faster than tolerance-based prune and useful for narrow-band level set applications where inactive values are limited to either an inside or an outside value.

Parameters

  tree | the tree to be pruned
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 1)

Exceptions

  ValueError | if the background of the tree is negative (as defined by math::isNegative)

## ◆ pruneLevelSet() [2/2]

template<typename TreeT>

void pruneLevelSet | ( | TreeT & | tree,
|  | const typename TreeT::ValueType & | outsideWidth,
|  | const typename TreeT::ValueType & | insideWidth,
|  | bool | threaded = true,
|  | size_t | grainSize = 1 )

Reduce the memory footprint of a tree by replacing nodes whose voxel values are all inactive with inactive tiles having the value -| insideWidth | if the voxel values are negative and | outsideWidth | otherwise.

This method is faster than tolerance-based prune and useful for narrow-band level set applications where inactive values are limited to either an inside or an outside value.

Parameters

  tree | the tree to be pruned
  outsideWidth | the width of the outside of the narrow band
  insideWidth | the width of the inside of the narrow band
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 1)

Exceptions

  ValueError | if outsideWidth is negative or insideWidth is not negative (as defined by math::isNegative).

## ◆ pruneTiles()

template<typename TreeT>

void pruneTiles | ( | TreeT & | tree,
|  | typename TreeT::ValueType | tolerance = zeroVal<typename TreeT::ValueType>(),
|  | bool | threaded = true,
|  | size_t | grainSize = 1 )

Reduce the memory footprint of a tree by replacing with tiles any non-leaf nodes whose values are all the same (optionally to within a tolerance) and have the same active state.

Parameters

  tree | the tree to be pruned
  tolerance | tolerance within which values are considered to be equal
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 1)

## ◆ rayTrace() [1/2]

template<typename GridT>

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

Ray-trace a volume.

## ◆ rayTrace() [2/2]

template<typename GridT, typename IntersectorT>

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

Ray-trace a volume using a given ray intersector.

## ◆ resampleToMatch() [1/2]

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.

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

Parameters

  inGrid | the grid to be resampled
  outGrid | the 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.
  FloatGrid::Ptr dest = FloatGrid::create();
  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);
  openvdb::v12_0::Grid< FloatTree >::ConstPtr
  SharedPtr< const Grid > ConstPtr
  Definition Grid.h:574
  openvdb::v12_0::Grid< FloatTree >::Ptr
  SharedPtr< Grid > Ptr
  Definition Grid.h:573
  openvdb::v12_0::Grid< FloatTree >::create
  static Ptr create()
  openvdb::v12_0::math::Transform::createLinearTransform
  static Transform::Ptr createLinearTransform(double voxelSize=1.0)
  Create and return a shared pointer to a new transform.
  openvdb::v12_0::tools::resampleToMatch
  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,...
  Definition GridTransformer.h:486

## ◆ resampleToMatch() [2/2]

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.

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

Parameters

  inGrid | the grid to be resampled
  outGrid | the grid into which to write the resampled voxel data
  interrupter | an 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.
  FloatGrid::Ptr dest = FloatGrid::create();
  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);

## ◆ sdfInteriorMask()

template<class GridOrTreeType>

GridOrTreeType::template ValueConverter< bool >::Type::Ptr sdfInteriorMask | ( | const GridOrTreeType & | volume,
|  | typename GridOrTreeType::ValueType | isovalue = lsutilGridZero<GridOrTreeType>() )

Threaded method to construct a boolean mask that represents interior regions in a signed distance field.

Returns
  A shared pointer to either a boolean grid or tree with the same tree configuration and potentially transform as the input `volume` and whose active and `true` values correspond to the interior of the input signed distance field.

Parameters

  volume | Signed distance field / level set volume.
  isovalue | Threshold below which values are considered part of the interior region.

## ◆ sdfToExt() [1/2]

template<typename SdfGridT, typename ExtOpT, typename ExtValueT>

SdfGridT::template ValueConverter< ExtValueT >::Type::Ptr sdfToExt | ( | const SdfGridT & | sdfGrid,
|  | const ExtOpT & | op,
|  | const ExtValueT & | background,
|  | typename SdfGridT::ValueType | isoValue = 0,
|  | int | nIter = 1,
|  | FastSweepingDomain | mode = FastSweepingDomain::SWEEP_ALL,
|  | const typename SdfGridT::template ValueConverter< ExtValueT >::Type::ConstPtr | extGrid = nullptr )

Computes the extension of a field (scalar, vector, or int are supported), defined by the specified functor, off an iso-surface from an input SDF volume.

Returns
  A shared pointer to the extension field defined on the active values in the input signed distance field.

Parameters

  sdfGrid | An approximate signed distance field to the specified iso-surface.
  op | Functor with signature [](const Vec3R &xyz)->ExtValueT that defines the Dirichlet boundary condition, on the iso-surface, of the field to be extended.
  background | Background value of return grid with the extension field.
  isoValue | A value which defines a smooth iso-surface that intersects active voxels in sdfGrid.
  nIter | Number of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.
  mode | Determines the mode of updating the extension field. SWEEP_ALL will update all voxels of the extension field affected by the fast sweeping algorithm. SWEEP_GREATER_THAN_ISOVALUE will update all voxels corresponding to level set values that are greater than a given isovalue. SWEEP_LESS_THAN_ISOVALUE will update all voxels corresponding to level set values that are less than a given isovalue. If a mode other than SWEEP_ALL is chosen, a user needs to supply extGrid.
  extGrid | Optional parameter required to supply a default value for the extension field when SWEEP_GREATER_THAN_ISOVALUE or SWEEP_LESS_THAN_ISOVALUE mode is picked for mode. When SWEEP_GREATER_THAN_ISOVALUE is supplied as an argument for mode, the extension field voxel will default to the value of the extGrid in that position if it corresponds to a level-set value that is less than the isovalue. Otherwise, the extension field voxel value will be computed by the Fast Sweeping algorithm. The opposite convention is implemented when SWEEP_LESS_THAN_ISOVALUE is supplied as an argument for mode.

Note
  The only difference between this method and fogToExt, defined above, is the convention of the sign of the signed distance field.

Topology of output grid is identical to that of the input grid, except active tiles in the input grid will be converted to active voxels in the output grid!

Warning
  If isoValue does not intersect any active values in sdfGrid then the returned grid has all its active values set to background.

## ◆ sdfToExt() [2/2]

template<typename SdfGridT, typename OpT, typename ExtValueT>

SdfGridT::template ValueConverter< ExtValueT >::Type::Ptr sdfToExt | ( | const SdfGridT & | sdfGrid,
|  | const OpT & | op,
|  | const ExtValueT & | background,
|  | typename SdfGridT::ValueType | isoValue,
|  | int | nIter,
|  | FastSweepingDomain | mode,
|  | const typename SdfGridT::template ValueConverter< ExtValueT >::Type::ConstPtr | extGrid )

## ◆ sdfToFogVolume() [1/2]

template<class GridType>

OPENVDB_DOCS_INTERNAL void sdfToFogVolume | ( | GridType & | grid,
|  | typename GridType::ValueType | cutoffDistance = lsutilGridMax< GridType >() )

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

  grid | level set/SDF grid to transform
  cutoffDistance | optional world space cutoff distance for the ramp (automatically clamped if greater than the interior narrow band width)

## ◆ sdfToFogVolume() [2/2]

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.

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

  grid | level set/SDF grid to transform
  cutoffDistance | optional world space cutoff distance for the ramp (automatically clamped if greater than the interior narrow band width)

## ◆ sdfToSdf()

template<typename GridT>

GridT::Ptr sdfToSdf | ( | const GridT & | sdfGrid,
|  | typename GridT::ValueType | isoValue = 0,
|  | int | nIter = 1 )

Given an existing approximate SDF it solves the Eikonal equation for all its active voxels. Active input voxels with a signed distance value above the given isoValue will have POSITIVE distance values on output, i.e. they are assumed to be OUTSIDE the iso-surface.

Returns
  A shared pointer to a signed-distance field defined on the active values of the input sdf volume.

Parameters

  sdfGrid | An approximate signed distance field to the specified iso-surface.
  isoValue | A value which defines a smooth iso-surface that intersects active voxels in sdfGrid.
  nIter | Number of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.

Note
  The only difference between this method and fogToSdf, defined above, is the convention of the sign of the output distance field.

Topology of output grid is identical to that of the input grid, except active tiles in the input grid will be converted to active voxels in the output grid!

Warning
  If isoValue does not intersect any active values in sdfGrid then the returned grid has all its active values set to plus or minus infinity, depending on if the input values are larger or smaller than isoValue.

## ◆ sdfToSdfAndExt()

template<typename SdfGridT, typename ExtOpT, typename ExtValueT>

std::pair< typename SdfGridT::Ptr, typename SdfGridT::template ValueConverter< ExtValueT >::Type::Ptr > sdfToSdfAndExt | ( | const SdfGridT & | sdfGrid,
|  | const ExtOpT & | op,
|  | const ExtValueT & | background,
|  | typename SdfGridT::ValueType | isoValue = 0,
|  | int | nIter = 1,
|  | FastSweepingDomain | mode = FastSweepingDomain::SWEEP_ALL,
|  | const typename SdfGridT::template ValueConverter< ExtValueT >::Type::ConstPtr | extGrid = nullptr )

Computes the signed distance field and the extension of a field (scalar, vector, or int are supported), defined by the specified functor, off an iso-surface from an input SDF volume.

Returns
  A pair of two shared pointers to respectively the SDF and extension field

Parameters

  sdfGrid | Scalar (floating-point) volume from which an iso-surface can be defined.
  op | Functor with signature [](const Vec3R &xyz)->ExtValueT that defines the Dirichlet boundary condition, on the iso-surface, of the field to be extended.
  background | Background value of return grid with the extension field.
  isoValue | A value which defines a smooth iso-surface that intersects active voxels in sdfGrid.
  nIter | Number of iterations of the fast sweeping algorithm. Each iteration performs 2^3 = 8 individual sweeps.
  mode | Determines the mode of updating the extension field. SWEEP_ALL will update all voxels of the extension field affected by the fast sweeping algorithm. SWEEP_GREATER_THAN_ISOVALUE will update all voxels corresponding to level set values that are greater than a given isovalue. SWEEP_LESS_THAN_ISOVALUE will update all voxels corresponding to level set values that are less than a given isovalue. If a mode other than SWEEP_ALL is chosen, a user needs to supply extGrid.
  extGrid | Optional parameter required to supply a default value for the extension field when SWEEP_GREATER_THAN_ISOVALUE or SWEEP_LESS_THAN_ISOVALUE mode is picked for mode. When SWEEP_GREATER_THAN_ISOVALUE is supplied as an argument for mode, the extension field voxel will default to the value of the extGrid in that position if it corresponds to a level-set value that is less than the isovalue. Otherwise, the extension field voxel value will be computed by the Fast Sweeping algorithm. The opposite convention is implemented when SWEEP_LESS_THAN_ISOVALUE is supplied as an argument for mode.

Note
  Strictly speaking a fog volume is normalized to the range [0,1] but this method accepts a scalar volume with an arbritary range, as long as the it includes the isoValue.

Topology of output grids are identical to that of the input grid, except active tiles in the input grid will be converted to active voxels in the output grids!

Warning
  If isoValue does not intersect any active values in sdfGrid then a pair of the following grids is returned: The first is a signed distance grid with its active values set to plus or minus infinity depending of whether its input values are above or below isoValue. The second grid, which represents the extension field, has all its active values set to background.

## ◆ segmentActiveVoxels()

template<typename GridOrTreeType>

void segmentActiveVoxels | ( | const GridOrTreeType & | volume,
|  | std::vector< typename GridOrTreeType::Ptr > & | segments )

Separates disjoint active topology components into distinct grids or trees.

Supports volumes with active tiles.

Parameters

  volume | Input grid or tree
  segments | Output set of disjoint active topology components sorted in descending order based on the active voxel count.

## ◆ segmentSDF()

template<typename GridOrTreeType>

void segmentSDF | ( | const GridOrTreeType & | volume,
|  | std::vector< typename GridOrTreeType::Ptr > & | segments )

Separates disjoint SDF surfaces into distinct grids or trees.

Supports asymmetric interior / exterior narrowband widths and SDF volumes with dense interior regions.

Parameters

  volume | Input signed distance field / level set volume
  segments | Output set of disjoint SDF surfaces found in volume sorted in descending order based on the surface intersecting voxel count.

## ◆ setValueOnMax()

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.

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

Note
  TreeT can be either a Tree or a ValueAccessor.

## ◆ setValueOnMin()

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.

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

Note
  TreeT can be either a Tree or a ValueAccessor.

## ◆ setValueOnMult()

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.

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

Note
  TreeT can be either a Tree or a ValueAccessor.

## ◆ setValueOnSum()

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.

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

Note
  TreeT can be either a Tree or a ValueAccessor.

## ◆ signedFloodFill()

template<typename TreeOrLeafManagerT>

void signedFloodFill | ( | TreeOrLeafManagerT & | tree,
|  | bool | threaded = true,
|  | size_t | grainSize = 1,
|  | Index | minLevel = 0 )

Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting outside values to +background and inside values to -background.

Warning
  This method should only be used on closed, symmetric narrow-band level sets.

Note
  If a LeafManager is used the cached leaf nodes are reused, resulting in slightly better overall performance.

Parameters

  tree | Tree or LeafManager that will be flood filled.
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 1)
  minLevel | Specify the lowest tree level to process (leafnode level = 0)

Exceptions

  TypeError | if the ValueType of tree is not floating-point.

## ◆ signedFloodFillWithValues()

template<typename TreeOrLeafManagerT>

void signedFloodFillWithValues | ( | TreeOrLeafManagerT & | tree,
|  | const typename TreeOrLeafManagerT::ValueType & | outsideWidth,
|  | const typename TreeOrLeafManagerT::ValueType & | insideWidth,
|  | bool | threaded = true,
|  | size_t | grainSize = 1,
|  | Index | minLevel = 0 )

Set the values of all inactive voxels and tiles of a narrow-band level set from the signs of the active voxels, setting exterior values to outsideWidth and interior values to insideWidth. Set the background value of this tree to outsideWidth.

Warning
  This method should only be used on closed, narrow-band level sets.

Note
  If a LeafManager is used the cached leaf nodes are reused resulting in slightly better overall performance.

Parameters

  tree | Tree or LeafManager that will be flood filled
  outsideWidth | the width of the outside of the narrow band
  insideWidth | the width of the inside of the narrow band
  threaded | enable or disable threading (threading is enabled by default)
  grainSize | used to control the threading granularity (default is 1)
  minLevel | Specify the lowest tree level to process (leafnode level = 0)

Exceptions

  TypeError | if the ValueType of tree is not floating-point.

## ◆ statistics() [1/2]

template<typename IterT>

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

  iter | an iterator over the values of a grid or its tree (`Grid::ValueOnCIter`, `Tree::ValueOffIter`, etc.)
  threaded | if true, iterate over the grid in parallel

## ◆ statistics() [2/2]

template<typename IterT, typename ValueOp>

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

  iter | an iterator over the values of a grid or its tree (`Grid::ValueOnCIter`, `Tree::ValueOffIter`, etc.)
  op | a 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
  threaded | if 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);
  openvdb::v12_0::tools::statistics
  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 ...
  Definition Statistics.h:362

## ◆ topologyToLevelSet() [1/2]

template<typename GridT>

GridT::template ValueConverter< float >::Type::Ptr topologyToLevelSet | ( | const GridT & | grid,
|  | int | halfWidth = 3,
|  | int | closingSteps = 1,
|  | int | dilation = 0,
|  | int | smoothingSteps = 0 )

Compute the narrow-band signed distance to the interface between active and inactive voxels in the input grid.

Returns
  A shared pointer to a new sdf / level set grid of type `float`

Parameters

  grid | Input grid of arbitrary type whose active voxels are used in constructing the level set.
  halfWidth | Half the width of the narrow band in voxel units.
  closingSteps | Number of morphological closing steps used to fill gaps in the active voxel region.
  dilation | Number of voxels to expand the active voxel region.
  smoothingSteps | Number of smoothing interations.

## ◆ topologyToLevelSet() [2/2]

template<typename GridT, typename InterrupterT>

GridT::template ValueConverter< float >::Type::Ptr topologyToLevelSet | ( | const GridT & | grid,
|  | int | halfWidth = 3,
|  | int | closingSteps = 1,
|  | int | dilation = 0,
|  | int | smoothingSteps = 0,
|  | InterrupterT * | interrupt = nullptr )

Compute the narrow-band signed distance to the interface between active and inactive voxels in the input grid.

Returns
  A shared pointer to a new sdf / level set grid of type `float`

Parameters

  grid | Input grid of arbitrary type whose active voxels are used in constructing the level set.
  halfWidth | Half the width of the narrow band in voxel units.
  closingSteps | Number of morphological closing steps used to fill gaps in the active voxel region.
  dilation | Number of voxels to expand the active voxel region.
  smoothingSteps | Number of smoothing interations.
  interrupt | Optional object adhering to the util::NullInterrupter interface.

## ◆ traceExteriorBoundaries()

template<typename FloatTreeT>

void traceExteriorBoundaries | ( | FloatTreeT & | tree | ) |

Traces the exterior voxel boundary of closed objects in the input volume tree. Exterior voxels are marked with a negative sign, voxels with a value below `0.75` are left unchanged and act as the boundary layer.

Note
  Does not propagate sign information into tile regions.

## ◆ transformDense() [1/2]

template<typename ValueT, typename OpType>

void transformDense | ( | Dense< ValueT, openvdb::tools::LayoutZYX > & | dense,
|  | const openvdb::CoordBBox & | bbox,
|  | const OpType & | op,
|  | bool | parallel = true )

Apply a point-wise functor to the intersection of a dense grid and a given bounding box

Parameters

  dense | A dense grid to be transformed
  bbox | Index space bounding box, define region where the transformation is applied
  op | A functor that acts on the dense grid value type
  parallel | Used to select multithreaded or single threaded Minimally, the `op` class has to support a `operator()` method, // Square values in a grid struct Op { ValueT operator()(const ValueT& in) const { // do work ValueT result = in * in; return result; } }; NB: only Dense grids with memory layout zxy are supported

## ◆ transformDense() [2/2]

template<typename ValueT, typename PointwiseOpT>

void transformDense | ( | Dense< ValueT, openvdb::tools::LayoutZYX > & | dense,
|  | const openvdb::CoordBBox & | bbox,
|  | const PointwiseOpT & | functor,
|  | bool | parallel )

Apply a point-wise functor to the intersection of a dense grid and a given bounding box.

## ◆ transformVectors()

template<typename GridType>

void transformVectors | ( | GridType & | grid,
|  | const Mat4d & | mat )

Apply an affine transform to the voxel values of a vector-valued grid in accordance with the grid's vector type (covariant, contravariant, etc.).

Exceptions

  TypeError | if the grid is not vector-valued

## ◆ uniqueInactiveValues()

template<class GridType>

bool uniqueInactiveValues | ( | const GridType & | grid,
|  | std::vector< typename GridType::ValueType > & | values,
|  | size_t | numValues )

Threaded method to find unique inactive values.

Parameters

  grid | A VDB volume.
  values | List of unique inactive values, returned by this method.
  numValues | Number of values to look for.

Returns
  `false` if the grid has more than numValues inactive values.

## ◆ visitNodesDepthFirst()

template<typename TreeT, typename OpT>

size_t visitNodesDepthFirst | ( | TreeT & | tree,
|  | OpT & | op,
|  | size_t | idx = 0 )

Visit all nodes in the tree depth-first and apply a user-supplied functor to each node.

Parameters

  tree | tree to be visited.
  op | user-supplied functor, see examples for interface details.
  idx | optional offset to start sequential node indexing from a non-zero index.

Warning
  This method is single-threaded. Use the NodeManager or DynamicNodeManager for much greater threaded performance.

Example:
  Functor to offset all the active values of a tree.
  struct OffsetOp
  {
  OffsetOp(float v): mOffset(v) { }
  template<typename NodeT>
  void operator()(NodeT& node, size_t) const
  {
  for (auto iter = node.beginValueOn(); iter; ++iter) {
  iter.setValue(iter.getValue() + mOffset);
  }
  }
  private:
  const float mOffset;
  };
  // usage:
  OffsetOp op(3.0f);
  visitNodesDepthFirst(tree, op);
  // Functor to offset all the active values of a tree. Note
  // this implementation also illustrates how different
  // computation can be applied to the different node types.
  template<typename TreeT>
  struct OffsetByLevelOp
  {
  using ValueT = typename TreeT::ValueType;
  using RootT = typename TreeT::RootNodeType;
  using LeafT = typename TreeT::LeafNodeType;
  OffsetByLevelOp(const ValueT& v) : mOffset(v) {}
  // Processes the root node.
  void operator()(RootT& root, size_t) const
  {
  for (auto iter = root.beginValueOn(); iter; ++iter) {
  iter.setValue(iter.getValue() + mOffset);
  }
  }
  // Processes the leaf nodes.
  void operator()(LeafT& leaf, size_t) const
  {
  for (auto iter = leaf.beginValueOn(); iter; ++iter) {
  iter.setValue(iter.getValue() + mOffset);
  }
  }
  // Processes the internal nodes.
  template<typename NodeT>
  void operator()(NodeT& node, size_t) const
  {
  for (auto iter = node.beginValueOn(); iter; ++iter) {
  iter.setValue(iter.getValue() + mOffset);
  }
  }
  private:
  const ValueT mOffset;
  };
  // usage:
  OffsetByLevelOp<FloatTree> op(3.0f);
  visitNodesDepthFirst(tree, op);
  openvdb::v12_0::tools::mOffset
  const Coord FastSweeping< SdfGridT, ExtValueT >::mOffset[6]
  Definition FastSweeping.h:714
  openvdb::v12_0::tools::visitNodesDepthFirst
  size_t visitNodesDepthFirst(TreeT &tree, OpT &op, size_t idx=0)
  Visit all nodes in the tree depth-first and apply a user-supplied functor to each node.
  Definition NodeVisitor.h:229
  openvdb::v12_0::tree
  Definition PointDataGrid.h:170

Here is an example when migrating from using the deprecated Tree::visit()
  method. The main difference between the Tree::visit() method and this new method is that the Tree::visit() method expected an object that can visit tiles, values and nodes. In contrast, the visitNodesDepthFirst() method visits only nodes and expects you to provide iteration over tiles and voxels.

Tree::visit() operator methods:

template <typename IterT>
bool operator()(IterT &iter)
{
typename IterT::NonConstValueType value;
typename IterT::ChildNodeType *child = iter.probeChild(value);
if (child)
{
// If it is a leaf, process it now
if (child->getLevel() == 0)
{
processNode(*child);
return true;
}
// Otherwise, we want to keep digging down
return false;
}
// No child, this is a constant node!
if (iter.isValueOn())
{
openvdb::CoordBBox b;
b.min() = iter.getCoord();
b.max() = b.min().offsetBy(IterT::ChildNodeType::DIM);
processNodeBlock(b);
}
// No need to dig further as there is no child.
return true;
}
bool operator()(typename GridType::TreeType::LeafNodeType::ChildAllIter &)
{ return true; }
bool operator()(typename GridType::TreeType::LeafNodeType::ChildAllCIter &)
{ return true; }
openvdb::v12_0::math::CoordBBox::min
const Coord & min() const
Definition Coord.h:324
openvdb::v12_0::math::CoordBBox::max
const Coord & max() const
Definition Coord.h:325
openvdb::v12_0::math::Coord::offsetBy
Coord offsetBy(Int32 dx, Int32 dy, Int32 dz) const
Definition Coord.h:92

tools::visitNodesDepthFirst() operator methods:

using LeafT = typename GridType::TreeType::LeafNodeType;
template <typename NodeT>
void operator()(const NodeT &node, size_t)
{
// iterate over active tiles
for (auto iter = node.beginValueOn(); iter; ++iter)
{
openvdb::CoordBBox b;
b.min() = iter.getCoord();
b.max() = b.min().offsetBy(NodeT::ChildNodeType::DIM);
processNodeBlock(b);
}
}
void operator()(const LeafT &leaf, size_t)
{
processNode(leaf);
}

## ◆ volumeToMesh() [1/2]

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,
|  | bool | relaxDisorientedTriangles = true )

Adaptively mesh any scalar grid that has a continuous isosurface.

When converting to polygons, the adaptivity threshold determines how closely the isosurface is matched by the resulting mesh. Higher thresholds will allow more variation in polygon size, using fewer polygons to express the surface. Triangles will only be created for areas of the mesh which hit the adaptivity threshold and can't be represented as quads.

Note
  Do not use this method just to get a triangle mesh - use the above method and post process the quad index list.

Parameters

  grid | a scalar grid to mesh
  points | output list of world space points
  triangles | output triangle index list
  quads | output quad index list
  isovalue | determines which isosurface to mesh
  adaptivity | surface adaptivity threshold [0 to 1]
  relaxDisorientedTriangles | toggle relaxing disoriented triangles during adaptive meshing.

Exceptions

  TypeError | if grid does not have a scalar value type

## ◆ volumeToMesh() [2/2]

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.

Parameters

  grid | a scalar grid to mesh
  points | output list of world space points
  quads | output quad index list
  isovalue | determines which isosurface to mesh

Exceptions

  TypeError | if grid does not have a scalar value type

## Variable Documentation

## ◆ bool

OutGridT const XformOp bool bool

## ◆ else

else

Initial value:
{
using Processor = typename valxform::CopyableOpTransformer<InIterT, OutTreeT, XformOp>
openvdb::v12_0::tools::valxform::CopyableOpTransformer
Definition ValueTransformer.h:496
openvdb::v12_0::tools::Processor
typename valxform::SharedOpTransformer< InIterT, OutTreeT, const XformOp > Processor
Definition ValueTransformer.h:615

## ◆ FastSweeping< SdfGridT, ExtValueT >::mOffset

template<typename SdfGridT, typename ExtValueT>

const Coord FastSweeping< SdfGridT, ExtValueT >::mOffset[6]

Initial value:
= {{-1,0,0},{1,0,0},
{0,-1,0},{0,1,0},
{0,0,-1},{0,0,1}}

## ◆ merge

OutGridT const XformOp bool MergePolicy merge = MERGE_ACTIVE_STATES)

## ◆ op

OutGridT const XformOp & op

## ◆ outGrid

OutGridT & outGrid

## ◆ shared

OutGridT XformOp bool bool shared

## ◆ shareOp

OutGridT const XformOp bool bool shareOp = true

## ◆ threaded

OutGridT const XformOp bool threaded = true