OpenVDB 11.0.0

Loading...
Searching...
No Matches
openvdb::v11_0::points Namespace Reference

## Namespaces
namespace | attribute_traits
namespace | future
| A container for ABI=5 to help ease introduction of upcoming features.
namespace | index
namespace | internal
namespace | point_attribute_internal
namespace | point_move_internal
namespace | point_rasterize_internal
namespace | transfer_internal

## Classes
struct | AccessorEval
| Accessor to call unsafe get and set methods based on templated Codec and Value. More...
struct | AccessorEval< UnknownCodec, ValueType >
| Partial specialization when Codec is not known at compile-time to use the supplied functor instead. More...
class | AttributeArray
| Base class for storing attribute data. More...
class | AttributeHandle
class | AttributeHashFilter
class | AttributeSet
| Ordered collection of uniquely-named attribute arrays. More...
class | AttributeWriteHandle
| Write-able version of AttributeHandle. More...
class | BBoxFilter
class | BinaryFilter
class | CachedDeformer
| A Deformer that caches the resulting positions from evaluating another Deformer. More...
struct | DeformerTraits
| Deformer Traits for optionally configuring deformers to be applied in index-space. The default is world-space. More...
struct | DummySampleType
struct | FilterTraits
struct | FilterTraits< BBoxFilter >
struct | FilterTraits< BinaryFilter< T0, T1, And > >
struct | FilterTraits< LevelSetFilter< T > >
struct | FixedPointCodec
class | FrustumRasterizer
| Efficient rasterization of one or more VDB Points grids into a linear or frustum volume with the option to bake in camera or geometry motion blur. More...
struct | FrustumRasterizerMask
struct | FrustumRasterizerSettings
| A group of shared settings to be used in the Volume Rasterizer. More...
struct | GroupCodec
class | GroupFilter
| Index filtering on group membership. More...
class | GroupHandle
class | GroupWriteHandle
class | IndexIter
| A forward iterator over array indices with filtering IteratorT can be either IndexIter or ValueIndexIter (or some custom index iterator) FilterT should be a struct or class with a valid() method than can be evaluated per index Here's a simple filter example that only accepts even indices: More...
class | LevelSetFilter
class | MultiGroupFilter
struct | NullCodec
struct | NullDeformer
| No-op deformer (adheres to the deformer interface documented in PointMove.h) More...
class | NullFilter
| A no-op filter that can be used when iterating over all indices. More...
class | PointAttributeVector
| Point-partitioner compatible STL vector attribute wrapper for convenience. More...
class | PointDataLeafNode
struct | PositionRange
class | RandomLeafFilter
class | RasterCamera
| A camera class that provides an interface for camera motion blur when rasterizing. More...
struct | RasterGroups
| A struct that stores all include/exclude attribute names as strings and is internally converted into the resolved MultiGroupFilter. More...
struct | SampleWithRounding
class | StringAttributeHandle
class | StringAttributeWriteHandle
struct | StringCodec
class | StringMetaCache
| Class to compute a string->index map from all string:N metadata. More...
class | StringMetaInserter
| Class to help with insertion of keyed string values into metadata. More...
struct | TransformTransfer
| The TransformTransfer module should be used if the source transform of the input points and the target transforms of the destination volumes differ. The default rasterizer will skip index to world (and vice versa) transformations unless a transfer scheme derives from a TransformTransfer. More...
struct | TreeConverter
| Similiar to ValueConverter, but allows for tree configuration conversion to a PointDataTree. ValueConverter<PointDataIndex32> cannot be used as a PointDataLeafNode is not a specialization of LeafNode. More...
struct | TrilinearTraits
struct | TrilinearTraits< ValueT, false >
struct | TruncateCodec
class | TypedAttributeArray
| Typed class for storing attribute data. More...
struct | UnitRange
struct | UnitVecCodec
struct | UnknownCodec
class | ValueMaskFilter
| Index filtering on active / inactive state of host voxel. More...
class | ValueVoxelCIter
| A forward iterator over array indices in a single voxel. More...
struct | VolumeTransfer
| The VolumeTransfer module provides methods to automatically setup and access destination buffers for multiple target volumes of arbitrary types. Deriving from a VolumeTransfer ensures that the available buffers correlate to the order of the provided tree arguments. More...
struct | VolumeTransfer< TreeT >
| VolumeTransfer specialization for a single target volume. More...

## Typedefs
using | StringAttributeArray = TypedAttributeArray<Index, StringCodec<false>>
using | GroupAttributeArray = TypedAttributeArray<GroupType, GroupCodec>
using | GroupType = uint8_t
using | ActiveFilter = ValueMaskFilter<true>
using | InactiveFilter = ValueMaskFilter<false>
using | PointDataTree
| Point index tree configured to match the default VDB configurations.
using | PointDataGrid = Grid<PointDataTree>
| Point data grid.

## Enumerations
enum class | RasterMode { ACCUMULATE = 0 , MAXIMUM , AVERAGE }
| How to composite points into a volume. More...

## Functions
template<typename IntegerT, typename FloatT>
IntegerT | floatingPointToFixedPoint (const FloatT s)
template<typename FloatT, typename IntegerT>
FloatT | fixedPointToFloatingPoint (const IntegerT s)
template<typename IntegerVectorT, typename FloatT>
IntegerVectorT | floatingPointToFixedPoint (const math::Vec3< FloatT > &v)
template<typename FloatVectorT, typename IntegerT>
FloatVectorT | fixedPointToFloatingPoint (const math::Vec3< IntegerT > &v)
bool | isString (const AttributeArray &array)
bool | isGroup (const AttributeArray &array)
template<typename IterT>
Index64 | iterCount (const IterT &iter)
| Count up the number of times the iterator can iterate.
template<typename PointDataGridT, typename VelGridT, typename AdvectFilterT = NullFilter, typename FilterT = NullFilter>
void | advectPoints (PointDataGridT &points, const VelGridT &velocity, const Index integrationOrder, const double dt, const Index timeSteps, const AdvectFilterT &advectFilter=NullFilter(), const FilterT &filter=NullFilter(), const bool cached=true)
| Advect points in a PointDataGrid through a velocity grid.
template<typename PointDataTreeT>
void | appendAttribute (PointDataTreeT &tree, const Name &name, const NamePair &type, const Index strideOrTotalSize=1, const bool constantStride=true, const Metadata *defaultValue=nullptr, const bool hidden=false, const bool transient=false)
| Appends a new attribute to the VDB tree (this method does not require a templated AttributeType)
template<typename ValueType, typename CodecType = NullCodec, typename PointDataTreeT>
void | appendAttribute (PointDataTreeT &tree, const std::string &name, const ValueType &uniformValue=point_attribute_internal::Default< ValueType >::value(), const Index strideOrTotalSize=1, const bool constantStride=true, const TypedMetadata< ValueType > *defaultValue=nullptr, const bool hidden=false, const bool transient=false)
| Appends a new attribute to the VDB tree.
template<typename ValueType, typename PointDataTreeT>
void | collapseAttribute (PointDataTreeT &tree, const Name &name, const ValueType &uniformValue=point_attribute_internal::Default< ValueType >::value())
| Collapse the attribute into a uniform value.
template<typename PointDataTreeT>
void | dropAttributes (PointDataTreeT &tree, const std::vector< size_t > &indices)
| Drops attributes from the VDB tree.
template<typename PointDataTreeT>
void | dropAttributes (PointDataTreeT &tree, const std::vector< Name > &names)
| Drops attributes from the VDB tree.
template<typename PointDataTreeT>
void | dropAttribute (PointDataTreeT &tree, const size_t &index)
| Drop one attribute from the VDB tree (convenience method).
template<typename PointDataTreeT>
void | dropAttribute (PointDataTreeT &tree, const Name &name)
| Drop one attribute from the VDB tree (convenience method).
template<typename PointDataTreeT>
void | renameAttributes (PointDataTreeT &tree, const std::vector< Name > &oldNames, const std::vector< Name > &newNames)
| Rename attributes in a VDB tree.
template<typename PointDataTreeT>
void | renameAttribute (PointDataTreeT &tree, const Name &oldName, const Name &newName)
| Rename an attribute in a VDB tree.
template<typename PointDataTreeT>
void | compactAttributes (PointDataTreeT &tree)
| Compact attributes in a VDB tree (if possible).
template<typename CompressionT, typename PointDataGridT, typename PositionArrayT, typename PointIndexGridT>
PointDataGridT::Ptr | createPointDataGrid (const PointIndexGridT &pointIndexGrid, const PositionArrayT &positions, const math::Transform &xform, const Metadata *positionDefaultValue=nullptr)
| Localises points with position into a `PointDataGrid` into two stages: allocation of the leaf attribute data and population of the positions.
template<typename CompressionT, typename PointDataGridT, typename ValueT>
PointDataGridT::Ptr | createPointDataGrid (const std::vector< ValueT > &positions, const math::Transform &xform, const Metadata *positionDefaultValue=nullptr)
| Convenience method to create a `PointDataGrid` from a std::vector of point positions.
template<typename PointDataTreeT, typename PointIndexTreeT, typename PointArrayT>
void | populateAttribute (PointDataTreeT &tree, const PointIndexTreeT &pointIndexTree, const openvdb::Name &attributeName, const PointArrayT &data, const Index stride=1, const bool insertMetadata=true)
| Stores point attribute data in an existing `PointDataGrid` attribute.
template<typename PositionAttribute, typename PointDataGridT, typename FilterT = NullFilter>
void | convertPointDataGridPosition (PositionAttribute &positionAttribute, const PointDataGridT &grid, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const FilterT &filter=NullFilter(), const bool inCoreOnly=false)
| Convert the position attribute from a Point Data Grid.
template<typename TypedAttribute, typename PointDataTreeT, typename FilterT = NullFilter>
void | convertPointDataGridAttribute (TypedAttribute &attribute, const PointDataTreeT &tree, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const unsigned arrayIndex, const Index stride=1, const FilterT &filter=NullFilter(), const bool inCoreOnly=false)
| Convert the attribute from a PointDataGrid.
template<typename Group, typename PointDataTreeT, typename FilterT = NullFilter>
void | convertPointDataGridGroup (Group &group, const PointDataTreeT &tree, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const AttributeSet::Descriptor::GroupIndex index, const FilterT &filter=NullFilter(), const bool inCoreOnly=false)
| Convert the group from a PointDataGrid.
template<typename PositionWrapper, typename InterrupterT = openvdb::util::NullInterrupter, typename VecT = typename internal::ValueTypeTraits<PositionWrapper>::Type>
float | computeVoxelSize (const PositionWrapper &positions, const uint32_t pointsPerVoxel, const math::Mat4d transform=math::Mat4d::identity(), const Index decimalPlaces=5, InterrupterT *const interrupter=nullptr)
template<typename PointDataTreeT, typename FilterT = NullFilter>
Index64 | pointCount (const PointDataTreeT &tree, const FilterT &filter=NullFilter(), const bool inCoreOnly=false, const bool threaded=true)
| Count the total number of points in a PointDataTree.
template<typename PointDataTreeT, typename FilterT = NullFilter>
Index64 | pointOffsets (std::vector< Index64 > &pointOffsets, const PointDataTreeT &tree, const FilterT &filter=NullFilter(), const bool inCoreOnly=false, const bool threaded=true)
| Populate an array of cumulative point offsets per leaf node.
template<typename PointDataGridT, typename GridT = typename PointDataGridT::template ValueConverter<Int32>::Type, typename FilterT = NullFilter>
GridT::Ptr | pointCountGrid (const PointDataGridT &grid, const FilterT &filter=NullFilter())
| Generate a new grid with voxel values to store the number of points per voxel.
template<typename PointDataGridT, typename GridT = typename PointDataGridT::template ValueConverter<Int32>::Type, typename FilterT = NullFilter>
GridT::Ptr | pointCountGrid (const PointDataGridT &grid, const openvdb::math::Transform &transform, const FilterT &filter=NullFilter())
| Generate a new grid that uses the supplied transform with voxel values to store the number of points per voxel.
template<typename PointDataTreeT>
AttributeSet::Descriptor::Ptr | makeDescriptorUnique (PointDataTreeT &tree)
| Deep copy the descriptor across all leaf nodes.
template<typename PointDataTreeT>
void | setStreamingMode (PointDataTreeT &tree, bool on=true)
| Toggle the streaming mode on all attributes in the tree to collapse the attributes after deconstructing a bound AttributeHandle to each array. This results in better memory efficiency when the data is streamed into another data structure (typically for rendering).
template<typename PointDataTreeT>
void | prefetch (PointDataTreeT &tree, bool position=true, bool otherAttributes=true)
| Sequentially pre-fetch all delayed-load voxel and attribute data from disk in order to accelerate subsequent random access.
template<typename PointDataTreeT>
void | deleteFromGroups (PointDataTreeT &pointTree, const std::vector< std::string > &groups, bool invert=false, bool drop=true)
| Delete points that are members of specific groups.
template<typename PointDataTreeT>
void | deleteFromGroup (PointDataTreeT &pointTree, const std::string &group, bool invert=false, bool drop=true)
| Delete points that are members of a group.
void | deleteMissingPointGroups (std::vector< std::string > &groups, const AttributeSet::Descriptor &descriptor)
| Delete any group that is not present in the Descriptor.
template<typename PointDataTreeT>
void | appendGroup (PointDataTreeT &tree, const Name &group)
| Appends a new empty group to the VDB tree.
template<typename PointDataTreeT>
void | appendGroups (PointDataTreeT &tree, const std::vector< Name > &groups)
| Appends new empty groups to the VDB tree.
template<typename PointDataTreeT>
void | dropGroup (PointDataTreeT &tree, const Name &group, const bool compact=true)
| Drops an existing group from the VDB tree.
template<typename PointDataTreeT>
void | dropGroups (PointDataTreeT &tree, const std::vector< Name > &groups)
| Drops existing groups from the VDB tree, the tree is compacted after dropping.
template<typename PointDataTreeT>
void | dropGroups (PointDataTreeT &tree)
| Drops all existing groups from the VDB tree, the tree is compacted after dropping.
template<typename PointDataTreeT>
void | compactGroups (PointDataTreeT &tree)
| Compacts existing groups of a VDB Tree to use less memory if possible.
template<typename PointDataTreeT, typename PointIndexTreeT>
void | setGroup (PointDataTreeT &tree, const PointIndexTreeT &indexTree, const std::vector< short > &membership, const Name &group, const bool remove=false)
| Sets group membership from a PointIndexTree-ordered vector.
template<typename PointDataTreeT>
void | setGroup (PointDataTreeT &tree, const Name &group, const bool member=true)
| Sets membership for the specified group for all points (on/off).
template<typename PointDataTreeT, typename FilterT>
void | setGroupByFilter (PointDataTreeT &tree, const Name &group, const FilterT &filter)
| Sets group membership based on a provided filter.
template<typename PointDataTreeT, typename MaskTreeT = typename PointDataTreeT::template ValueConverter<bool>::Type, typename FilterT = NullFilter>
std::enable_if< std::is_base_of< TreeBase, PointDataTreeT >::value &&std::is_same< typenameMaskTreeT::ValueType, bool >::value, typenameMaskTreeT::Ptr >::type | convertPointsToMask (const PointDataTreeT &tree, const FilterT &filter=NullFilter(), bool threaded=true)
| Extract a Mask Tree from a Point Data Tree.
template<typename PointDataGridT, typename MaskGridT = typename PointDataGridT::template ValueConverter<bool>::Type, typename FilterT = NullFilter>
std::enable_if< std::is_base_of< GridBase, PointDataGridT >::value &&std::is_same< typenameMaskGridT::ValueType, bool >::value, typenameMaskGridT::Ptr >::type | convertPointsToMask (const PointDataGridT &grid, const FilterT &filter=NullFilter(), bool threaded=true)
| Extract a Mask Grid from a Point Data Grid.
template<typename PointDataGridT, typename MaskT = typename PointDataGridT::template ValueConverter<bool>::Type, typename FilterT = NullFilter>
std::enable_if< std::is_same< typenameMaskT::ValueType, bool >::value, typenameMaskT::Ptr >::type | convertPointsToMask (const PointDataGridT &grid, const openvdb::math::Transform &transform, const FilterT &filter=NullFilter(), bool threaded=true)
| Extract a Mask Grid from a Point Data Grid using a new transform.
template<typename PointDataGridT, typename DeformerT, typename FilterT = NullFilter>
void | movePoints (PointDataGridT &points, DeformerT &deformer, const FilterT &filter=NullFilter(), future::Advect *objectNotInUse=nullptr, bool threaded=true)
| Move points in a PointDataGrid using a custom deformer.
template<typename PointDataGridT, typename DeformerT, typename FilterT = NullFilter>
void | movePoints (PointDataGridT &points, const math::Transform &transform, DeformerT &deformer, const FilterT &filter=NullFilter(), future::Advect *objectNotInUse=nullptr, bool threaded=true)
| Move points in a PointDataGrid using a custom deformer and a new transform.
template<typename PointDataGridT, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
SdfT::Ptr | rasterizeSpheres (const PointDataGridT &points, const Real radius, const Real halfband=LEVEL_SET_HALF_WIDTH, math::Transform::Ptr transform=nullptr, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
| Narrow band sphere stamping with a uniform radius.
template<typename PointDataGridT, typename RadiusT = float, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
SdfT::Ptr | rasterizeSpheres (const PointDataGridT &points, const std::string &radius, const Real scale=1.0, const Real halfband=LEVEL_SET_HALF_WIDTH, math::Transform::Ptr transform=nullptr, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
| Narrow band sphere stamping with a varying radius.
template<typename PointDataGridT, typename AttributeTypes, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
GridPtrVec | rasterizeSpheres (const PointDataGridT &points, const Real radius, const std::vector< std::string > &attributes, const Real halfband=LEVEL_SET_HALF_WIDTH, math::Transform::Ptr transform=nullptr, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
| Narrow band sphere stamping with a uniform radius and closest point attribute transfer.
template<typename PointDataGridT, typename AttributeTypes, typename RadiusT = float, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
GridPtrVec | rasterizeSpheres (const PointDataGridT &points, const std::string &radius, const std::vector< std::string > &attributes, const Real scale=1.0, const Real halfband=LEVEL_SET_HALF_WIDTH, math::Transform::Ptr transform=nullptr, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
| Narrow band sphere stamping with a varying radius and closest point attribute transfer.
template<typename PointDataGridT, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
SdfT::Ptr | rasterizeSmoothSpheres (const PointDataGridT &points, const Real radius, const Real searchRadius, const Real halfband=LEVEL_SET_HALF_WIDTH, math::Transform::Ptr transform=nullptr, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
| Smoothed point distribution based sphere stamping with a uniform radius.
template<typename PointDataGridT, typename RadiusT = float, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
SdfT::Ptr | rasterizeSmoothSpheres (const PointDataGridT &points, const std::string &radius, const Real radiusScale, const Real searchRadius, const Real halfband=LEVEL_SET_HALF_WIDTH, math::Transform::Ptr transform=nullptr, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
| Smoothed point distribution based sphere stamping with a varying radius.
template<typename PointDataGridT, typename AttributeTypes, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
GridPtrVec | rasterizeSmoothSpheres (const PointDataGridT &points, const Real radius, const Real searchRadius, const std::vector< std::string > &attributes, const Real halfband=LEVEL_SET_HALF_WIDTH, math::Transform::Ptr transform=nullptr, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
| Smoothed point distribution based sphere stamping with a uniform radius and closest point attribute transfer.
template<typename PointDataGridT, typename AttributeTypes, typename RadiusT = float, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
GridPtrVec | rasterizeSmoothSpheres (const PointDataGridT &points, const std::string &radius, const Real radiusScale, const Real searchRadius, const std::vector< std::string > &attributes, const Real halfband=LEVEL_SET_HALF_WIDTH, math::Transform::Ptr transform=nullptr, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
| Smoothed point distribution based sphere stamping with a varying radius and closest point attribute transfer.
template<bool Staggered, typename ValueT, typename FilterT = NullFilter, typename PointDataTreeT = PointDataTree>
auto | rasterizeTrilinear (const PointDataTreeT &points, const std::string &attribute, const FilterT &filter=NullFilter())
| Perform weighted trilinear rasterization of all points within a voxel. This method takes and returns a tree i.e. ignores grid transformations.
template<typename PointDataGridT>
PointDataGridT::Ptr | replicate (const PointDataGridT &source, const Index multiplier, const std::vector< std::string > &attributes, const std::string &scaleAttribute="", const std::string &replicationIndex="")
| Replicates points provided in a source grid into a new grid, transfering and creating attributes found in a provided attribute vector. If an attribute doesn't exist, it is ignored. Position is always replicated, leaving the new points exactly over the top of the source points.
template<typename PointDataGridT>
PointDataGridT::Ptr | replicate (const PointDataGridT &source, const Index multiplier, const std::string &scaleAttribute="", const std::string &replicationIndex="")
| Replicates points provided in a source grid into a new grid, transfering and creating all attributes from the source grid. Position is always replicated, leaving the new points exactly over the top of the source points.
template<typename PointDataGridT, typename SourceGridT, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
void | pointSample (PointDataGridT &points, const SourceGridT &sourceGrid, const Name &targetAttribute="", const FilterT &filter=NullFilter(), InterrupterT *const interrupter=nullptr)
| Performs closest point sampling from a VDB grid onto a VDB Points attribute.
template<typename PointDataGridT, typename SourceGridT, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
void | boxSample (PointDataGridT &points, const SourceGridT &sourceGrid, const Name &targetAttribute="", const FilterT &filter=NullFilter(), InterrupterT *const interrupter=nullptr)
| Performs tri-linear sampling from a VDB grid onto a VDB Points attribute.
template<typename PointDataGridT, typename SourceGridT, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
void | quadraticSample (PointDataGridT &points, const SourceGridT &sourceGrid, const Name &targetAttribute="", const FilterT &filter=NullFilter(), InterrupterT *const interrupter=nullptr)
| Performs tri-quadratic sampling from a VDB grid onto a VDB Points attribute.
template<typename PointDataGridT, typename SourceGridT, typename TargetValueT = DummySampleType, typename SamplerT = SampleWithRounding, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
void | sampleGrid (size_t order, PointDataGridT &points, const SourceGridT &sourceGrid, const Name &targetAttribute, const FilterT &filter=NullFilter(), const SamplerT &sampler=SampleWithRounding(), InterrupterT *const interrupter=nullptr, const bool threaded=true)
| Performs sampling and conversion from a VDB grid onto a VDB Points attribute.
template<typename GridT, typename RandGenT = std::mt19937, typename PositionArrayT = TypedAttributeArray<Vec3f, NullCodec>, typename PointDataGridT = Grid< typename points::TreeConverter<typename GridT::TreeType>::Type>, typename InterrupterT = util::NullInterrupter>
PointDataGridT::Ptr | uniformPointScatter (const GridT &grid, const Index64 count, const unsigned int seed=0, const float spread=1.0f, InterrupterT *interrupter=nullptr)
| The free functions depend on the following class:
template<typename GridT, typename RandGenT = std::mt19937, typename PositionArrayT = TypedAttributeArray<Vec3f, NullCodec>, typename PointDataGridT = Grid< typename points::TreeConverter<typename GridT::TreeType>::Type>, typename InterrupterT = util::NullInterrupter>
PointDataGridT::Ptr | denseUniformPointScatter (const GridT &grid, const float pointsPerVoxel, const unsigned int seed=0, const float spread=1.0f, InterrupterT *interrupter=nullptr)
| Uniformly scatter a fixed number of points per active voxel. If the pointsPerVoxel value provided is a fractional value, each voxel calculates a delta value of how likely it is to contain an extra point.
template<typename GridT, typename RandGenT = std::mt19937, typename PositionArrayT = TypedAttributeArray<Vec3f, NullCodec>, typename PointDataGridT = Grid< typename points::TreeConverter<typename GridT::TreeType>::Type>, typename InterrupterT = util::NullInterrupter>
PointDataGridT::Ptr | nonUniformPointScatter (const GridT &grid, const float pointsPerVoxel, const unsigned int seed=0, const float spread=1.0f, InterrupterT *interrupter=nullptr)
| Non uniformly scatter points per active voxel. The pointsPerVoxel value is used to weight each grids cell value to compute a fixed number of points for every active voxel. If the computed result is a fractional value, each voxel calculates a delta value of how likely it is to contain an extra point.
template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT>
std::pair< ValueT, ValueT > | evalMinMax (const PointDataTreeT &points, const std::string &attribute, const FilterT &filter=NullFilter())
| Evaluates the minimum and maximum values of a point attribute.
template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT>
ConvertElementType< ValueT, double >::Type | evalAverage (const PointDataTreeT &points, const std::string &attribute, const FilterT &filter=NullFilter())
| Evaluates the average value of a point attribute.
template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT>
PromoteType< ValueT >::Highest | accumulate (const PointDataTreeT &points, const std::string &attribute, const FilterT &filter=NullFilter())
| Evaluates the total value of a point attribute.
template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT>
bool | evalMinMax (const PointDataTreeT &points, const std::string &attribute, ValueT &min, ValueT &max, const FilterT &filter=NullFilter(), typename PointDataTreeT::template ValueConverter< ValueT >::Type *minTree=nullptr, typename PointDataTreeT::template ValueConverter< ValueT >::Type *maxTree=nullptr)
| Evaluates the minimum and maximum values of a point attribute and returns whether the values are valid. Optionally constructs localised min and max value trees.
template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT, typename ResultTreeT = typename ConvertElementType<ValueT, double>::Type>
bool | evalAverage (const PointDataTreeT &points, const std::string &attribute, typename ConvertElementType< ValueT, double >::Type &average, const FilterT &filter=NullFilter(), typename PointDataTreeT::template ValueConverter< ResultTreeT >::Type *averageTree=nullptr)
| Evaluates the average value of a point attribute and returns whether the value is valid. Optionally constructs localised average value trees.
template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT, typename ResultTreeT = typename PromoteType<ValueT>::Highest>
bool | accumulate (const PointDataTreeT &points, const std::string &attribute, typename PromoteType< ValueT >::Highest &total, const FilterT &filter=NullFilter(), typename PointDataTreeT::template ValueConverter< ResultTreeT >::Type *totalTree=nullptr)
| Evaluates the total value of a point attribute and returns whether the value is valid. Optionally constructs localised total value trees.
template<typename PointDataTreeOrGridT, typename TransferT, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>
void | rasterize (const PointDataTreeOrGridT &points, TransferT &transfer, const FilterT &filter=NullFilter(), InterrupterT *interrupter=nullptr)
| Perform potentially complex rasterization from a user defined transfer scheme.
template<typename PointDataTreeT>
void | setGroupByRandomTarget (PointDataTreeT &tree, const Name &group, const Index64 targetPoints, const unsigned int seed=0)
template<typename PointDataTreeT>
void | setGroupByRandomPercentage (PointDataTreeT &tree, const Name &group, const float percentage=10.0f, const unsigned int seed=0)

## Typedef Documentation

## ◆ ActiveFilter

using ActiveFilter = ValueMaskFilter<true>

## ◆ GroupAttributeArray

using GroupAttributeArray = TypedAttributeArray<GroupType, GroupCodec>

## ◆ GroupType

using GroupType = uint8_t

## ◆ InactiveFilter

using InactiveFilter = ValueMaskFilter<false>

## ◆ PointDataGrid

using PointDataGrid = Grid<PointDataTree>

Point data grid.

## ◆ PointDataTree

using PointDataTree

Initial value:
tree::Tree<tree::RootNode<tree::InternalNode<tree::InternalNode
<PointDataLeafNode<PointDataIndex32, 3>, 4>, 5>>>
openvdb::v11_0::points::PointDataLeafNode
Definition PointDataGrid.h:239
openvdb::v11_0::tree::InternalNode
Definition InternalNode.h:34
openvdb::v11_0::tree::RootNode
Definition RootNode.h:39
openvdb::v11_0::tree::Tree
Definition Tree.h:178

Point index tree configured to match the default VDB configurations.

## ◆ StringAttributeArray

using StringAttributeArray = TypedAttributeArray<Index, StringCodec<false>>

## Enumeration Type Documentation

## ◆ RasterMode

enum class RasterMode
| strong

How to composite points into a volume.

Enumerator
ACCUMULATE |
MAXIMUM |
AVERAGE |

## Function Documentation

## ◆ accumulate() [1/2]

template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT>

PromoteType< ValueT >::Highest accumulate | ( | const PointDataTreeT & | points,
|  | const std::string & | attribute,
|  | const FilterT & | filter = NullFilter() )

Evaluates the total value of a point attribute.

Performs parallel reduction by summing all values. The reduction arithmetic and return value precision evaluates to: PromoteType<ValueT>::Highest which, for POD and VDB math types, is ValueT at its highest bit precision. If the PointDataGrid is empty or the filter evalutes to empty, zeroVal<ValueT>() is returned.

Note
  The PromoteType of the attribute must be copy constructible, support the same type + operator. This method will throw if ValueT does not match the given attribute. The function is deterministic.

Warning
  if "P" is provided, the result is undefined.

Parameters

  points | the point tree
  attribute | the attribute to reduce
  filter | a filter to apply to points

Returns
  the total value

## ◆ accumulate() [2/2]

template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT, typename ResultTreeT = typename PromoteType<ValueT>::Highest>

bool accumulate | ( | const PointDataTreeT & | points,
|  | const std::string & | attribute,
|  | typename PromoteType< ValueT >::Highest & | total,
|  | const FilterT & | filter = NullFilter(),
|  | typename PointDataTreeT::template ValueConverter< ResultTreeT >::Type * | totalTree = nullptr )

Evaluates the total value of a point attribute and returns whether the value is valid. Optionally constructs localised total value trees.

Performs parallel reduction by summing all values. The reduction arithmetic and return value precision evaluates to: PromoteType<ValueT>::Highest which, for POD and VDB math types, is ValueT at its highest bit precision. This method will return true total has been set, false otherwise (when no points existed or a filter evaluated to empty).

Note
  The PromoteType of the attribute must be copy constructible, support the same type + operator. This method will throw if ValueT does not match the given attribute. The function is deterministic.

Warning
  if "P" is provided, the result is undefined.

Parameters

  points | the point tree
  attribute | the attribute to reduce
  total | the computed total value
  filter | a filter to apply to points
  totalTree | if provided, builds a tiled tree of localised total results.

Returns
  true if total has been set, false otherwise. Can be false if no points were processed or if the tree was empty.

Example:
  using namespace openvdb;
  using namespace openvdb::points;
  // accumulate and store per leaf values in a new tree
  PromoteType<uint8_t>::Highest total; // evaluates to uint64_t
  PointDataTree::ValueConverter<decltype(total)>::Type totalTree; // uint64_t tree of totals
  bool success = accumulate<uint8_t>(tree, "attrib", total, NullFilter(), &totalTree);
  openvdb::v11_0::points::NullFilter
  A no-op filter that can be used when iterating over all indices.
  Definition IndexIterator.h:51
  openvdb::v11_0::points
  Definition AttributeArray.h:41
  openvdb::v11_0::points::accumulate
  PromoteType< ValueT >::Highest accumulate(const PointDataTreeT &points, const std::string &attribute, const FilterT &filter=NullFilter())
  Evaluates the total value of a point attribute.
  Definition PointStatisticsImpl.h:530
  openvdb::v11_0::tree
  Definition PointDataGrid.h:169
  openvdb
  Definition Exceptions.h:13
  openvdb::v11_0::PromoteType::Highest
  typename TypeT< 64ul >::type Highest
  Definition Types.h:371

## ◆ advectPoints()

template<typename PointDataGridT, typename VelGridT, typename AdvectFilterT = NullFilter, typename FilterT = NullFilter>

void advectPoints | ( | PointDataGridT & | points,
|  | const VelGridT & | velocity,
|  | const Index | integrationOrder,
|  | const double | dt,
|  | const Index | timeSteps,
|  | const AdvectFilterT & | advectFilter = NullFilter(),
|  | const FilterT & | filter = NullFilter(),
|  | const bool | cached = true )
| inline

Advect points in a PointDataGrid through a velocity grid.

Parameters

  points | the PointDataGrid containing the points to be advected.
  velocity | a velocity grid to be sampled.
  integrationOrder | the integration scheme to use (1 is forward euler, 4 is runge-kutta 4th)
  dt | delta time.
  timeSteps | number of advection steps to perform.
  advectFilter | an optional advection index filter (moves a subset of the points)
  filter | an optional index filter (deletes a subset of the points)
  cached | caches velocity interpolation for faster performance, disable to use less memory (default is on).

## ◆ appendAttribute() [1/2]

template<typename PointDataTreeT>

void appendAttribute | ( | PointDataTreeT & | tree,
|  | const Name & | name,
|  | const NamePair & | type,
|  | const Index | strideOrTotalSize = 1,
|  | const bool | constantStride = true,
|  | const Metadata * | defaultValue = nullptr,
|  | const bool | hidden = false,
|  | const bool | transient = false )
| inline

Appends a new attribute to the VDB tree (this method does not require a templated AttributeType)

Parameters

  tree | the PointDataTree to be appended to.
  name | name for the new attribute.
  type | the type of the attibute.
  strideOrTotalSize | the stride of the attribute
  constantStride | if `false`, stride is interpreted as total size of the array
  defaultValue | metadata default attribute value
  hidden | mark attribute as hidden
  transient | mark attribute as transient

## ◆ appendAttribute() [2/2]

template<typename ValueType, typename CodecType = NullCodec, typename PointDataTreeT>

void appendAttribute | ( | PointDataTreeT & | tree,
|  | const std::string & | name,
|  | const ValueType & | uniformValue = point_attribute_internal::Default<ValueType>::value(),
|  | const Index | strideOrTotalSize = 1,
|  | const bool | constantStride = true,
|  | const TypedMetadata< ValueType > * | defaultValue = nullptr,
|  | const bool | hidden = false,
|  | const bool | transient = false )
| inline

Appends a new attribute to the VDB tree.

Parameters

  tree | the PointDataTree to be appended to.
  name | name for the new attribute
  uniformValue | the initial value of the attribute
  strideOrTotalSize | the stride of the attribute
  constantStride | if `false`, stride is interpreted as total size of the array
  defaultValue | metadata default attribute value
  hidden | mark attribute as hidden
  transient | mark attribute as transient

## ◆ appendGroup()

template<typename PointDataTreeT>

void appendGroup | ( | PointDataTreeT & | tree,
|  | const Name & | group )
| inline

Appends a new empty group to the VDB tree.

Parameters

  tree | the PointDataTree to be appended to.
  group | name of the new group.

## ◆ appendGroups()

template<typename PointDataTreeT>

void appendGroups | ( | PointDataTreeT & | tree,
|  | const std::vector< Name > & | groups )
| inline

Appends new empty groups to the VDB tree.

Parameters

  tree | the PointDataTree to be appended to.
  groups | names of the new groups.

## ◆ boxSample()

template<typename PointDataGridT, typename SourceGridT, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

void boxSample | ( | PointDataGridT & | points,
|  | const SourceGridT & | sourceGrid,
|  | const Name & | targetAttribute = "",
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT *const | interrupter = nullptr )
| inline

Performs tri-linear sampling from a VDB grid onto a VDB Points attribute.

Parameters

  points | the PointDataGrid whose points will be sampled on to
  sourceGrid | VDB grid which will be sampled
  targetAttribute | a target attribute on the points which will hold samples. This attribute will be created with the source grid type if it does not exist, and with the source grid name if the name is empty
  filter | an optional index filter
  interrupter | an optional interrupter

Note
  The target attribute may exist provided it can be cast to the SourceGridT ValueType

## ◆ collapseAttribute()

template<typename ValueType, typename PointDataTreeT>

void collapseAttribute | ( | PointDataTreeT & | tree,
|  | const Name & | name,
|  | const ValueType & | uniformValue = point_attribute_internal::Default<ValueType>::value() )
| inline

Collapse the attribute into a uniform value.

Parameters

  tree | the PointDataTree in which to collapse the attribute.
  name | name for the attribute.
  uniformValue | value of the attribute

## ◆ compactAttributes()

template<typename PointDataTreeT>

void compactAttributes | ( | PointDataTreeT & | tree | ) |
| inline

Compact attributes in a VDB tree (if possible).

Parameters

  tree | the PointDataTree.

## ◆ compactGroups()

template<typename PointDataTreeT>

void compactGroups | ( | PointDataTreeT & | tree | ) |
| inline

Compacts existing groups of a VDB Tree to use less memory if possible.

Parameters

  tree | the PointDataTree to be compacted.

## ◆ computeVoxelSize()

template<typename PositionWrapper, typename InterrupterT = openvdb::util::NullInterrupter, typename VecT = typename internal::ValueTypeTraits<PositionWrapper>::Type>

float computeVoxelSize | ( | const PositionWrapper & | positions,
|  | const uint32_t | pointsPerVoxel,
|  | const math::Mat4d | transform = math::Mat4d::identity(),
|  | const Index | decimalPlaces = 5,
|  | InterrupterT *const | interrupter = nullptr )
| inline

@ brief Given a container of world space positions and a target points per voxel, compute a uniform voxel size that would best represent the storage of the points in a grid. This voxel size is typically used for conversion of the points into a PointDataGrid.

Parameters

  positions | array of world space positions
  pointsPerVoxel | the target number of points per voxel, must be positive and non-zero
  transform | voxel size will be computed using this optional transform if provided
  decimalPlaces | for readability, truncate voxel size to this number of decimals
  interrupter | an optional interrupter

Note
  VecT will be PositionWrapper::value_type or Vec3R (if there is no value_type defined)
  if none or one point provided in positions, the default voxel size of 0.1 will be returned

## ◆ convertPointDataGridAttribute()

template<typename TypedAttribute, typename PointDataTreeT, typename FilterT = NullFilter>

void convertPointDataGridAttribute | ( | TypedAttribute & | attribute,
|  | const PointDataTreeT & | tree,
|  | const std::vector< Index64 > & | pointOffsets,
|  | const Index64 | startOffset,
|  | const unsigned | arrayIndex,
|  | const Index | stride = 1,
|  | const FilterT & | filter = NullFilter(),
|  | const bool | inCoreOnly = false )
| inline

Convert the attribute from a PointDataGrid.

Parameters

  attribute | the attribute to be populated.
  tree | the PointDataTree to be converted.
  pointOffsets | a vector of cumulative point offsets for each leaf.
  startOffset | a value to shift all the point offsets by
  arrayIndex | the index in the Descriptor of the array to be converted.
  stride | the stride of the attribute
  filter | an index filter
  inCoreOnly | true if out-of-core leaf nodes are to be ignored

## ◆ convertPointDataGridGroup()

template<typename Group, typename PointDataTreeT, typename FilterT = NullFilter>

void convertPointDataGridGroup | ( | Group & | group,
|  | const PointDataTreeT & | tree,
|  | const std::vector< Index64 > & | pointOffsets,
|  | const Index64 | startOffset,
|  | const AttributeSet::Descriptor::GroupIndex | index,
|  | const FilterT & | filter = NullFilter(),
|  | const bool | inCoreOnly = false )
| inline

Convert the group from a PointDataGrid.

Parameters

  group | the group to be populated.
  tree | the PointDataTree to be converted.
  pointOffsets | a vector of cumulative point offsets for each leaf
  startOffset | a value to shift all the point offsets by
  index | the group index to be converted.
  filter | an index filter
  inCoreOnly | true if out-of-core leaf nodes are to be ignored

## ◆ convertPointDataGridPosition()

template<typename PositionAttribute, typename PointDataGridT, typename FilterT = NullFilter>

void convertPointDataGridPosition | ( | PositionAttribute & | positionAttribute,
|  | const PointDataGridT & | grid,
|  | const std::vector< Index64 > & | pointOffsets,
|  | const Index64 | startOffset,
|  | const FilterT & | filter = NullFilter(),
|  | const bool | inCoreOnly = false )
| inline

Convert the position attribute from a Point Data Grid.

Parameters

  positionAttribute | the position attribute to be populated.
  grid | the PointDataGrid to be converted.
  pointOffsets | a vector of cumulative point offsets for each leaf
  startOffset | a value to shift all the point offsets by
  filter | an index filter
  inCoreOnly | true if out-of-core leaf nodes are to be ignored

## ◆ convertPointsToMask() [1/3]

template<typename PointDataGridT, typename MaskGridT = typename PointDataGridT::template ValueConverter<bool>::Type, typename FilterT = NullFilter>

std::enable_if< std::is_base_of< GridBase, PointDataGridT >::value &&std::is_same< typenameMaskGridT::ValueType, bool >::value, typenameMaskGridT::Ptr >::type convertPointsToMask | ( | const PointDataGridT & | grid,
|  | const FilterT & | filter = NullFilter(),
|  | bool | threaded = true )
| inline

Extract a Mask Grid from a Point Data Grid.

Parameters

  grid | the PointDataGrid to extract the mask from.
  filter | an optional index filter
  threaded | enable or disable threading (threading is enabled by default)

Note
  this method is only available for Bool Grids and Mask Grids

## ◆ convertPointsToMask() [2/3]

template<typename PointDataGridT, typename MaskT = typename PointDataGridT::template ValueConverter<bool>::Type, typename FilterT = NullFilter>

std::enable_if< std::is_same< typenameMaskT::ValueType, bool >::value, typenameMaskT::Ptr >::type convertPointsToMask | ( | const PointDataGridT & | grid,
|  | const openvdb::math::Transform & | transform,
|  | const FilterT & | filter = NullFilter(),
|  | bool | threaded = true )
| inline

Extract a Mask Grid from a Point Data Grid using a new transform.

Parameters

  grid | the PointDataGrid to extract the mask from.
  transform | target transform for the mask.
  filter | an optional index filter
  threaded | enable or disable threading (threading is enabled by default)

Note
  this method is only available for Bool Grids and Mask Grids

## ◆ convertPointsToMask() [3/3]

template<typename PointDataTreeT, typename MaskTreeT = typename PointDataTreeT::template ValueConverter<bool>::Type, typename FilterT = NullFilter>

std::enable_if< std::is_base_of< TreeBase, PointDataTreeT >::value &&std::is_same< typenameMaskTreeT::ValueType, bool >::value, typenameMaskTreeT::Ptr >::type convertPointsToMask | ( | const PointDataTreeT & | tree,
|  | const FilterT & | filter = NullFilter(),
|  | bool | threaded = true )
| inline

Extract a Mask Tree from a Point Data Tree.

Parameters

  tree | the PointDataTree to extract the mask from.
  filter | an optional index filter
  threaded | enable or disable threading (threading is enabled by default)

## ◆ createPointDataGrid() [1/2]

template<typename CompressionT, typename PointDataGridT, typename PositionArrayT, typename PointIndexGridT>

PointDataGridT::Ptr createPointDataGrid | ( | const PointIndexGridT & | pointIndexGrid,
|  | const PositionArrayT & | positions,
|  | const math::Transform & | xform,
|  | const Metadata * | positionDefaultValue = nullptr )
| inline

Localises points with position into a `PointDataGrid` into two stages: allocation of the leaf attribute data and population of the positions.

Parameters

  pointIndexGrid | a PointIndexGrid into the points.
  positions | list of world space point positions.
  xform | world to index space transform.
  positionDefaultValue | metadata default position value

Note
  The position data must be supplied in a Point-Partitioner compatible data structure. A convenience PointAttributeVector class is offered.
  The position data is populated separately to perform world space to voxel space conversion and apply quantisation.
  A `PointIndexGrid` to the points must be supplied to perform this operation. Typically this is built implicitly by the PointDataGrid constructor.

## ◆ createPointDataGrid() [2/2]

template<typename CompressionT, typename PointDataGridT, typename ValueT>

PointDataGridT::Ptr createPointDataGrid | ( | const std::vector< ValueT > & | positions,
|  | const math::Transform & | xform,
|  | const Metadata * | positionDefaultValue = nullptr )
| inline

Convenience method to create a `PointDataGrid` from a std::vector of point positions.

Parameters

  positions | list of world space point positions.
  xform | world to index space transform.
  positionDefaultValue | metadata default position value

Note
  This method implicitly wraps the std::vector for a Point-Partitioner compatible data structure and creates the required `PointIndexGrid` to the points.

## ◆ deleteFromGroup()

template<typename PointDataTreeT>

void deleteFromGroup | ( | PointDataTreeT & | pointTree,
|  | const std::string & | group,
|  | bool | invert = false,
|  | bool | drop = true )
| inline

Delete points that are members of a group.

This method will delete points which are members of the supplied group and will optionally drop the group from the tree. An invert flag can be used to delete points that belong to none of the groups.

Parameters

  pointTree | the point tree with the group to delete
  group | the name of the group to delete
  invert | if enabled, points not belonging to any of the groups will be deleted
  drop | if enabled and invert is disabled, the group will be dropped from the tree

Note
  If the invert flag is true, the group will not be dropped after deleting points regardless of the value of the drop parameter.

## ◆ deleteFromGroups()

template<typename PointDataTreeT>

void deleteFromGroups | ( | PointDataTreeT & | pointTree,
|  | const std::vector< std::string > & | groups,
|  | bool | invert = false,
|  | bool | drop = true )
| inline

Delete points that are members of specific groups.

This method will delete points which are members of any of the supplied groups and will optionally drop the groups from the tree. An invert flag can be used to delete points that belong to none of the groups.

Parameters

  pointTree | the point tree
  groups | the groups from which to delete points
  invert | if enabled, points not belonging to any of the groups will be deleted
  drop | if enabled and invert is disabled, the groups will be dropped from the tree

Note
  If the invert flag is true, none of the groups will be dropped after deleting points regardless of the value of the drop parameter.

## ◆ deleteMissingPointGroups()

void deleteMissingPointGroups | ( | std::vector< std::string > & | groups,
|  | const AttributeSet::Descriptor & | descriptor )
| inline

Delete any group that is not present in the Descriptor.

Parameters

  groups | the vector of group names.
  descriptor | the descriptor that holds the group map.

## ◆ denseUniformPointScatter()

template<typename GridT, typename RandGenT = std::mt19937, typename PositionArrayT = TypedAttributeArray<Vec3f, NullCodec>, typename PointDataGridT = Grid< typename points::TreeConverter<typename GridT::TreeType>::Type>, typename InterrupterT = util::NullInterrupter>

PointDataGridT::Ptr denseUniformPointScatter | ( | const GridT & | grid,
|  | const float | pointsPerVoxel,
|  | const unsigned int | seed = 0,
|  | const float | spread = 1.0f,
|  | InterrupterT * | interrupter = nullptr )
| inline

Uniformly scatter a fixed number of points per active voxel. If the pointsPerVoxel value provided is a fractional value, each voxel calculates a delta value of how likely it is to contain an extra point.

Parameters

  grid | A source grid. The resulting PointDataGrid will copy this grids transform and scatter in its active voxelized topology.
  pointsPerVoxel | The number of points to scatter per voxel
  seed | A seed for the RandGenT
  spread | The spread of points as a scale from each voxels center. A value of 1.0f indicates points can be placed anywhere within the voxel, where as a value of 0.0f will force all points to be created exactly at the centers of each voxel.
  interrupter | An optional interrupter

Note
  returns the scattered PointDataGrid

## ◆ dropAttribute() [1/2]

template<typename PointDataTreeT>

void dropAttribute | ( | PointDataTreeT & | tree,
|  | const Name & | name )
| inline

Drop one attribute from the VDB tree (convenience method).

Parameters

  tree | the PointDataTree to be dropped from.
  name | name of the attribute to drop.

## ◆ dropAttribute() [2/2]

template<typename PointDataTreeT>

void dropAttribute | ( | PointDataTreeT & | tree,
|  | const size_t & | index )
| inline

Drop one attribute from the VDB tree (convenience method).

Parameters

  tree | the PointDataTree to be dropped from.
  index | index of the attribute to drop.

## ◆ dropAttributes() [1/2]

template<typename PointDataTreeT>

void dropAttributes | ( | PointDataTreeT & | tree,
|  | const std::vector< Name > & | names )
| inline

Drops attributes from the VDB tree.

Parameters

  tree | the PointDataTree to be dropped from.
  names | names of the attributes to drop.

## ◆ dropAttributes() [2/2]

template<typename PointDataTreeT>

void dropAttributes | ( | PointDataTreeT & | tree,
|  | const std::vector< size_t > & | indices )
| inline

Drops attributes from the VDB tree.

Parameters

  tree | the PointDataTree to be dropped from.
  indices | indices of the attributes to drop.

## ◆ dropGroup()

template<typename PointDataTreeT>

void dropGroup | ( | PointDataTreeT & | tree,
|  | const Name & | group,
|  | const bool | compact = true )
| inline

Drops an existing group from the VDB tree.

Parameters

  tree | the PointDataTree to be dropped from.
  group | name of the group.
  compact | compact attributes if possible to reduce memory - if dropping more than one group, compacting once at the end will be faster

## ◆ dropGroups() [1/2]

template<typename PointDataTreeT>

void dropGroups | ( | PointDataTreeT & | tree | ) |
| inline

Drops all existing groups from the VDB tree, the tree is compacted after dropping.

Parameters

  tree | the PointDataTree to be dropped from.

## ◆ dropGroups() [2/2]

template<typename PointDataTreeT>

void dropGroups | ( | PointDataTreeT & | tree,
|  | const std::vector< Name > & | groups )
| inline

Drops existing groups from the VDB tree, the tree is compacted after dropping.

Parameters

  tree | the PointDataTree to be dropped from.
  groups | names of the groups.

## ◆ evalAverage() [1/2]

template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT>

ConvertElementType< ValueT, double >::Type evalAverage | ( | const PointDataTreeT & | points,
|  | const std::string & | attribute,
|  | const FilterT & | filter = NullFilter() )

Evaluates the average value of a point attribute.

Performs parallel reduction by cumulative moving average. The reduction arithmetic and return value precision evaluates to: ConvertElementType<ValueT, double>::Type which, for POD and VDB math types, is ValueT at double precision. If the PointDataGrid is empty or the filter evalutes to empty, zeroVal<ValueT>() is returned.

Note
  The ConvertElementType of the attribute must be copy constructible, support the same type + - * operators and * / operators from a double. This method will throw if ValueT does not match the given attribute. The function is deterministic.

Warning
  if "P" is provided, the result is undefined.

Parameters

  points | the point tree
  attribute | the attribute to reduce
  filter | a filter to apply to points

Returns
  the average value

## ◆ evalAverage() [2/2]

template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT, typename ResultTreeT = typename ConvertElementType<ValueT, double>::Type>

bool evalAverage | ( | const PointDataTreeT & | points,
|  | const std::string & | attribute,
|  | typename ConvertElementType< ValueT, double >::Type & | average,
|  | const FilterT & | filter = NullFilter(),
|  | typename PointDataTreeT::template ValueConverter< ResultTreeT >::Type * | averageTree = nullptr )

Evaluates the average value of a point attribute and returns whether the value is valid. Optionally constructs localised average value trees.

Performs parallel reduction by cumulative moving average. The reduction arithmetic and return value precision evaluates to: ConvertElementType<ValueT, double>::Type which, for POD and VDB math types, is ValueT at double precision. This method will return true average has been set, false otherwise (when no points existed or a filter evaluated to empty).

Note
  The ConvertElementType of the attribute must be copy constructible, support the same type + - * operators and * / operators from a double. This method will throw if ValueT does not match the given attribute. The function is deterministic.

Warning
  if "P" is provided, the result is undefined.

Parameters

  points | the point tree
  attribute | the attribute to reduce
  average | the computed averaged value at double precision
  filter | a filter to apply to points
  averageTree | if provided, builds a tiled tree of localised avg results.

Returns
  true if average has been set, false otherwise. Can be false if no points were processed or if the tree was empty.

Example:
  using namespace openvdb;
  using namespace openvdb::points
  // average and store per leaf values in a new tree
  ConvertElementType<uint8_t, double>::Type avg; // evaluates to double
  PointDataTree::ValueConverter<decltype(avg)>::Type avgTree; // double tree of averages
  bool success = evalAverage<uint8_t>(tree, "attrib", avg, NullFilter(), &avgTree);
  openvdb::v11_0::points::evalAverage
  ConvertElementType< ValueT, double >::Type evalAverage(const PointDataTreeT &points, const std::string &attribute, const FilterT &filter=NullFilter())
  Evaluates the average value of a point attribute.
  Definition PointStatisticsImpl.h:515
  openvdb::v11_0::ConvertElementType::Type
  SubT Type
  Definition Types.h:320

## ◆ evalMinMax() [1/2]

template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT>

std::pair< ValueT, ValueT > evalMinMax | ( | const PointDataTreeT & | points,
|  | const std::string & | attribute,
|  | const FilterT & | filter = NullFilter() )

Evaluates the minimum and maximum values of a point attribute.

Performs parallel reduction by comparing values using their less than and greater than operators. If the PointDataGrid is empty or the filter evalutes to empty, zeroVal<ValueT>() is returned for both values.

Note
  The ValueT of the attribute must be copy constructible. This method will throw if the templated ValueT does not match the given attribute. For vectors and matrices, this results in per component comparisons. See evalExtents for magnitudes or more custom control.

Warning
  if "P" is provided, the result is undefined.

Parameters

  points | the point tree
  attribute | the attribute to reduce
  filter | a filter to apply to points

Returns
  min,max value pair

## ◆ evalMinMax() [2/2]

template<typename ValueT, typename CodecT = UnknownCodec, typename FilterT = NullFilter, typename PointDataTreeT>

bool evalMinMax | ( | const PointDataTreeT & | points,
|  | const std::string & | attribute,
|  | ValueT & | min,
|  | ValueT & | max,
|  | const FilterT & | filter = NullFilter(),
|  | typename PointDataTreeT::template ValueConverter< ValueT >::Type * | minTree = nullptr,
|  | typename PointDataTreeT::template ValueConverter< ValueT >::Type * | maxTree = nullptr )

Evaluates the minimum and maximum values of a point attribute and returns whether the values are valid. Optionally constructs localised min and max value trees.

Performs parallel reduction by comparing values using their less than and greater than operators. This method will return true if min and max have been set, false otherwise (when no points existed or a filter evaluated to empty).

Note
  The ValueT of the attribute must also be copy constructible. This method will throw if the templated ValueT does not match the given attribute. For vectors and matrices, this results in per component comparisons. See evalExtents for magnitudes or more custom control.

Warning
  if "P" is provided, the result is undefined.

Parameters

  points | the point tree
  attribute | the attribute to reduce
  min | the computed min value
  max | the computed max value
  filter | a filter to apply to points
  minTree | if provided, builds a tiled tree of localised min results
  maxTree | if provided, builds a tiled tree of localised max results

Returns
  true if min and max have been set, false otherwise. Can be false if no points were processed or if the tree was empty.

## ◆ fixedPointToFloatingPoint() [1/2]

template<typename FloatT, typename IntegerT>

FloatT fixedPointToFloatingPoint | ( | const IntegerT | s | ) |
| inline

## ◆ fixedPointToFloatingPoint() [2/2]

template<typename FloatVectorT, typename IntegerT>

FloatVectorT fixedPointToFloatingPoint | ( | const math::Vec3< IntegerT > & | v | ) |
| inline

## ◆ floatingPointToFixedPoint() [1/2]

template<typename IntegerT, typename FloatT>

IntegerT floatingPointToFixedPoint | ( | const FloatT | s | ) |
| inline

## ◆ floatingPointToFixedPoint() [2/2]

template<typename IntegerVectorT, typename FloatT>

IntegerVectorT floatingPointToFixedPoint | ( | const math::Vec3< FloatT > & | v | ) |
| inline

## ◆ isGroup()

bool isGroup | ( | const AttributeArray & | array | ) |
| inline

## ◆ isString()

bool isString | ( | const AttributeArray & | array | ) |
| inline

## ◆ iterCount()

template<typename IterT>

Index64 iterCount | ( | const IterT & | iter | ) |
| inline

Count up the number of times the iterator can iterate.

Parameters

  iter | the iterator.

Note
  counting by iteration only performed where a dynamic filter is in use,

## ◆ makeDescriptorUnique()

template<typename PointDataTreeT>

AttributeSet::Descriptor::Ptr makeDescriptorUnique | ( | PointDataTreeT & | tree | ) |
| inline

Deep copy the descriptor across all leaf nodes.

Parameters

  tree | the PointDataTree.

Returns
  the new descriptor.

Note
  This method will fail if the Descriptors in the tree are not all identical.

## ◆ movePoints() [1/2]

template<typename PointDataGridT, typename DeformerT, typename FilterT = NullFilter>

void movePoints | ( | PointDataGridT & | points,
|  | const math::Transform & | transform,
|  | DeformerT & | deformer,
|  | const FilterT & | filter = NullFilter(),
|  | future::Advect * | objectNotInUse = nullptr,
|  | bool | threaded = true )
| inline

Move points in a PointDataGrid using a custom deformer and a new transform.

Parameters

  points | the PointDataGrid containing the points to be moved.
  transform | target transform to use for the resulting points.
  deformer | a custom deformer that defines how to move the points.
  filter | an optional index filter
  objectNotInUse | for future use, this object is currently ignored
  threaded | enable or disable threading (threading is enabled by default)

## ◆ movePoints() [2/2]

template<typename PointDataGridT, typename DeformerT, typename FilterT = NullFilter>

void movePoints | ( | PointDataGridT & | points,
|  | DeformerT & | deformer,
|  | const FilterT & | filter = NullFilter(),
|  | future::Advect * | objectNotInUse = nullptr,
|  | bool | threaded = true )
| inline

Move points in a PointDataGrid using a custom deformer.

Parameters

  points | the PointDataGrid containing the points to be moved.
  deformer | a custom deformer that defines how to move the points.
  filter | an optional index filter
  objectNotInUse | for future use, this object is currently ignored
  threaded | enable or disable threading (threading is enabled by default)

## ◆ nonUniformPointScatter()

template<typename GridT, typename RandGenT = std::mt19937, typename PositionArrayT = TypedAttributeArray<Vec3f, NullCodec>, typename PointDataGridT = Grid< typename points::TreeConverter<typename GridT::TreeType>::Type>, typename InterrupterT = util::NullInterrupter>

PointDataGridT::Ptr nonUniformPointScatter | ( | const GridT & | grid,
|  | const float | pointsPerVoxel,
|  | const unsigned int | seed = 0,
|  | const float | spread = 1.0f,
|  | InterrupterT * | interrupter = nullptr )
| inline

Non uniformly scatter points per active voxel. The pointsPerVoxel value is used to weight each grids cell value to compute a fixed number of points for every active voxel. If the computed result is a fractional value, each voxel calculates a delta value of how likely it is to contain an extra point.

Parameters

  grid | A source grid. The resulting PointDataGrid will copy this grids transform, voxelized topology and use its values to compute a target points per voxel. The grids ValueType must be convertible to a scalar value. Only active and larger than zero values will contain points.
  pointsPerVoxel | The number of points to scatter per voxel
  seed | A seed for the RandGenT
  spread | The spread of points as a scale from each voxels center. A value of 1.0f indicates points can be placed anywhere within the voxel, where as a value of 0.0f will force all points to be created exactly at the centers of each voxel.
  interrupter | An optional interrupter

Note
  returns the scattered PointDataGrid

## ◆ pointCount()

template<typename PointDataTreeT, typename FilterT = NullFilter>

Index64 pointCount | ( | const PointDataTreeT & | tree,
|  | const FilterT & | filter = NullFilter(),
|  | const bool | inCoreOnly = false,
|  | const bool | threaded = true )
| inline

Count the total number of points in a PointDataTree.

Parameters

  tree | the PointDataTree in which to count the points
  filter | an optional index filter
  inCoreOnly | if true, points in out-of-core leaf nodes are not counted
  threaded | enable or disable threading (threading is enabled by default)

## ◆ pointCountGrid() [1/2]

template<typename PointDataGridT, typename GridT = typename PointDataGridT::template ValueConverter<Int32>::Type, typename FilterT = NullFilter>

GridT::Ptr pointCountGrid | ( | const PointDataGridT & | grid,
|  | const FilterT & | filter = NullFilter() )
| inline

Generate a new grid with voxel values to store the number of points per voxel.

Parameters

  grid | the PointDataGrid to use to compute the count grid
  filter | an optional index filter

Note
  The return type of the grid must be an integer or floating-point scalar grid.

## ◆ pointCountGrid() [2/2]

template<typename PointDataGridT, typename GridT = typename PointDataGridT::template ValueConverter<Int32>::Type, typename FilterT = NullFilter>

GridT::Ptr pointCountGrid | ( | const PointDataGridT & | grid,
|  | const openvdb::math::Transform & | transform,
|  | const FilterT & | filter = NullFilter() )
| inline

Generate a new grid that uses the supplied transform with voxel values to store the number of points per voxel.

Parameters

  grid | the PointDataGrid to use to compute the count grid
  transform | the transform to use to compute the count grid
  filter | an optional index filter

Note
  The return type of the grid must be an integer or floating-point scalar grid.

## ◆ pointOffsets()

template<typename PointDataTreeT, typename FilterT = NullFilter>

Index64 pointOffsets | ( | std::vector< Index64 > & | pointOffsets,
|  | const PointDataTreeT & | tree,
|  | const FilterT & | filter = NullFilter(),
|  | const bool | inCoreOnly = false,
|  | const bool | threaded = true )
| inline

Populate an array of cumulative point offsets per leaf node.

Parameters

  pointOffsets | array of offsets to be populated
  tree | the PointDataTree from which to populate the offsets
  filter | an optional index filter
  inCoreOnly | if true, points in out-of-core leaf nodes are ignored
  threaded | enable or disable threading (threading is enabled by default)

Returns
  The final cumulative point offset.

## ◆ pointSample()

template<typename PointDataGridT, typename SourceGridT, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

void pointSample | ( | PointDataGridT & | points,
|  | const SourceGridT & | sourceGrid,
|  | const Name & | targetAttribute = "",
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT *const | interrupter = nullptr )
| inline

Performs closest point sampling from a VDB grid onto a VDB Points attribute.

Parameters

  points | the PointDataGrid whose points will be sampled on to
  sourceGrid | VDB grid which will be sampled
  targetAttribute | a target attribute on the points which will hold samples. This attribute will be created with the source grid type if it does not exist, and with the source grid name if the name is empty
  filter | an optional index filter
  interrupter | an optional interrupter

Note
  The target attribute may exist provided it can be cast to the SourceGridT ValueType

## ◆ populateAttribute()

template<typename PointDataTreeT, typename PointIndexTreeT, typename PointArrayT>

void populateAttribute | ( | PointDataTreeT & | tree,
|  | const PointIndexTreeT & | pointIndexTree,
|  | const openvdb::Name & | attributeName,
|  | const PointArrayT & | data,
|  | const Index | stride = 1,
|  | const bool | insertMetadata = true )
| inline

Stores point attribute data in an existing `PointDataGrid` attribute.

Parameters

  tree | the PointDataGrid to be populated.
  pointIndexTree | a PointIndexTree into the points.
  attributeName | the name of the VDB Points attribute to be populated.
  data | a wrapper to the attribute data.
  stride | the stride of the attribute
  insertMetadata | true if strings are to be automatically inserted as metadata.

Note
  A `PointIndexGrid` to the points must be supplied to perform this operation. This is required to ensure the same point index ordering.

## ◆ prefetch()

template<typename PointDataTreeT>

void prefetch | ( | PointDataTreeT & | tree,
|  | bool | position = true,
|  | bool | otherAttributes = true )
| inline

Sequentially pre-fetch all delayed-load voxel and attribute data from disk in order to accelerate subsequent random access.

Parameters

  tree | the PointDataTree.
  position | if enabled, prefetch the position attribute (default is on)
  otherAttributes | if enabled, prefetch all other attributes (default is on)

## ◆ quadraticSample()

template<typename PointDataGridT, typename SourceGridT, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

void quadraticSample | ( | PointDataGridT & | points,
|  | const SourceGridT & | sourceGrid,
|  | const Name & | targetAttribute = "",
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT *const | interrupter = nullptr )
| inline

Performs tri-quadratic sampling from a VDB grid onto a VDB Points attribute.

Parameters

  points | the PointDataGrid whose points will be sampled on to
  sourceGrid | VDB grid which will be sampled
  targetAttribute | a target attribute on the points which will hold samples. This attribute will be created with the source grid type if it does not exist, and with the source grid name if the name is empty
  filter | an optional index filter
  interrupter | an optional interrupter

Note
  The target attribute may exist provided it can be cast to the SourceGridT ValueType

## ◆ rasterize()

template<typename PointDataTreeOrGridT, typename TransferT, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

void rasterize | ( | const PointDataTreeOrGridT & | points,
|  | TransferT & | transfer,
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT * | interrupter = nullptr )
| inline

Perform potentially complex rasterization from a user defined transfer scheme.

A transfer scheme must be configured to call the provided
  rasterize methods. See below for an example or PointRasterizeSDF.h/PointRasterizeTrilinear.h for implementations.
  struct Transfer
  {
  /// @return Returns the tree topology to loop over. This can be different
  /// from the destination tree i.e. This can act as a mask.
  inline auto& topology();
  /// @brief The maximum lookup range of this transfer scheme in index
  /// space of the source points.
  /// @details The return value represent how far away from the destination
  /// leaf node points should be accessed.
  /// @param origin The leaf origin of the topology being accessed
  /// @param idx The leaf index of the topology being accessed
  inline Int32 range(const Coord& origin, size_t idx) const;
  /// @brief The initialize function, called on each leaf which has valid
  /// topology to write to.
  /// @param origin The leaf origin of the topology being accessed
  /// @param idx The leaf index of the topology being accessed
  /// @param bounds The active voxel bounds of the leaf
  inline void initialize(const Coord& origin, size_t idx, const CoordBBox& bounds);
  /// @brief Run each time a point leaf is accessed. Typically this is
  /// where attribute handles can be constructed
  /// @param leaf The PointDataLeafNode which is being accessed.
  /// @return Return true to continue rasterization, false to early exit
  /// and skip the current leaf's contribution to the destination volume.
  inline bool startPointLeaf(const PointDataTree::LeafNodeType& leaf);
  /// @brief The point stamp function. Each point which contributes to
  /// the current leaf will call this function exactly once.
  /// @param ijk The current voxel containing the point being rasterized.
  /// May be outside the destination leaf node depending on the range()
  /// @param id The point index being rasterized
  /// @param bounds The active bounds of the leaf node.
  void rasterizePoint(const Coord& ijk,
  const Index id,
  const CoordBBox& bounds);
  /// @brief Run each time a point leaf is finished with.
  /// @param leaf The PointDataLeafNode which was being accessed.
  /// @return Return true to continue rasterization, false to early exit
  /// and stop rasterization to the destination leaf node.
  inline bool endPointLeaf(const PointDataTree::LeafNodeType& leaf);
  /// @brief The finalization function for the given destination tree(s).
  /// @param origin The leaf origin of the topology being accessed
  /// @param idx The leaf index of the topology being accessed
  /// @return Return true to stop, false to recursively rasterize
  inline bool finalize(const Coord& origin, size_t idx);
  };
  openvdb::v11_0::math::CoordBBox
  Axis-aligned bounding box of signed integer coordinates.
  Definition Coord.h:251
  openvdb::v11_0::math::Coord
  Signed (x, y, z) 32-bit integer coordinates.
  Definition Coord.h:25
  openvdb::v11_0::tree::Tree< tree::RootNode< tree::InternalNode< tree::InternalNode< PointDataLeafNode< PointDataIndex32, 3 >, 4 >, 5 > > >::LeafNodeType
  typename RootNodeType::LeafNodeType LeafNodeType
  Definition Tree.h:186
  openvdb::v11_0::Index
  Index32 Index
  Definition Types.h:54
  openvdb::v11_0::initialize
  OPENVDB_IMPORT void initialize()
  Global registration of native Grid, Transform, Metadata and Point attribute types....
  openvdb::v11_0::Int32
  int32_t Int32
  Definition Types.h:56

Below is a full example using the native components.

/// @brief Sum point distances into a target float tree
/// Note: Using TransformTransfer to handle different index spaces, and
/// VolumeTransfer for automatic buffer setup
struct MyTransfer :
public TransformTransfer,
public VolumeTransfer<FloatTree>
{
MyTransfer(FloatGrid& dest, const PointDataGrid& source)
: TransformTransfer(source.transform(), dest.transform())
, VolumeTransfer(dest.tree())
, mHandle(nullptr) {}
MyTransfer(const MyTransfer& other)
: TransformTransfer(other)
, VolumeTransfer(other)
, mHandle(nullptr) {}
/// @brief Range in index space of the source points
Int32 range(const Coord&, size_t) const { return Int32(1); }
/// @brief Every time we start a new point leaf, init the position array.
/// Always return true as we don't skip any leaf nodes.
bool startPointLeaf(const PointDataTree::LeafNodeType& leaf)
{
mHandle.reset(new AttributeHandle<Vec3f>(leaf.constAttributeArray("P"));
return true;
}
/// @brief For each point, compute its relative index space position in
/// the destination tree and sum the length of its distance
void rasterizePoint(const Coord& ijk, const Index id, const CoordBBox& bounds)
{
Vec3d P = ijk.asVec3d() + Vec3d(this->mHandle->get(id));
P = this->transformSourceToTarget(P); // TransformTransfer::transformSourceToTarget
// for each active voxel, accumulate distance
const auto* mask = this->mask(); // VolumeTransfer::mask
for (auto& coord : bounds) {
const Index voxel = FloatTree::LeafNodeType::coordToOffset(coord);
if (!mask->isOn(voxel)) continue;
Vec3d dist = coord.asVec3d() - P;
this->buffer()[voxel] += dist.length(); // VolumeTransfer::buffer
}
}
/// @brief Return true for endPointLeaf() to continue, false for finalize() so
/// we don't recurse.
bool endPointLeaf(const PointDataTree::LeafNodeType&) { return true; }
bool finalize(const Coord&, size_t) { return false; }
private:
std::unique_ptr<AttributeHandle<Vec3f>> mHandle;
};
openvdb::v11_0::math::Vec3::length
T length() const
Length of the vector.
Definition Vec3.h:200
openvdb::v11_0::math::Vec3d
Vec3< double > Vec3d
Definition Vec3.h:664
openvdb::v11_0::points::PointDataGrid
Grid< PointDataTree > PointDataGrid
Point data grid.
Definition PointDataGrid.h:194
openvdb::v11_0::FloatGrid
Grid< FloatTree > FloatGrid
Definition openvdb.h:75
openvdb::v11_0::points::TransformTransfer
The TransformTransfer module should be used if the source transform of the input points and the targe...
Definition PointTransfer.h:181
openvdb::v11_0::points::VolumeTransfer
The VolumeTransfer module provides methods to automatically setup and access destination buffers for ...
Definition PointTransfer.h:215

The method works by looping over a single Tree topology, looking up point data at a position relative to that topology and passing that data to a transfer scheme TransferT.

Note
  Each thread receives a copy of the transfer scheme object.

Parameters

  points | the point data grid to rasterize
  transfer | the transfer scheme
  filter | optional point filter
  interrupter | optional interrupter

## ◆ rasterizeSmoothSpheres() [1/4]

template<typename PointDataGridT, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

SdfT::Ptr rasterizeSmoothSpheres | ( | const PointDataGridT & | points,
|  | const Real | radius,
|  | const Real | searchRadius,
|  | const Real | halfband = LEVEL_SET_HALF_WIDTH,
|  | math::Transform::Ptr | transform = nullptr,
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT * | interrupter = nullptr )

Smoothed point distribution based sphere stamping with a uniform radius.

Rasterizes points into a level set using [Zhu Bridson 05] sphere stamping with a uniform radius. The radius and search radius parameters are given in world space units and are applied to every point to generate a fixed surface mask and consequent distance values. The search radius is each points points maximum contribution to the target level set. The search radius should always have a value equal to or larger than the point radius.

Warning
  The width of the exterior half band may be smaller than the specified half band if the search radius is less than the equivalent world space halfband distance.

Parameters

  points | the point data grid to rasterize
  radius | the world space radius of every point
  searchRadius | the maximum search distance of every point
  halfband | the half band width
  transform | the target transform for the surface
  filter | a filter to apply to points
  interrupter | optional interrupter

Returns
  The signed distance field.

## ◆ rasterizeSmoothSpheres() [2/4]

template<typename PointDataGridT, typename AttributeTypes, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

GridPtrVec rasterizeSmoothSpheres | ( | const PointDataGridT & | points,
|  | const Real | radius,
|  | const Real | searchRadius,
|  | const std::vector< std::string > & | attributes,
|  | const Real | halfband = LEVEL_SET_HALF_WIDTH,
|  | math::Transform::Ptr | transform = nullptr,
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT * | interrupter = nullptr )

Smoothed point distribution based sphere stamping with a uniform radius and closest point attribute transfer.

Rasterizes points into a level set using [Zhu Bridson 05] sphere stamping with a uniform radius. The radius and search radius parameters are given in world space units and are applied to every point to generate a fixed surface mask and consequent distance values. The search radius is each points points maximum contribution to the target level set. The search radius should always be larger than the point radius. Every voxel's closest point is used to transfer each attribute in the attributes parameter to a new grid of matching topology. The destination types of these grids is equal to the ValueConverter result of the attribute type applied to the PointDataGridT.

Note
  The AttributeTypes template parameter should be a TypeList of the required or possible attributes types. i.e. TypeList<int, float, double>. A runtime error will be thrown if no equivalent type for a given attribute is found in the AttributeTypes TypeList.

Warning
  The width of the exterior half band may be smaller than the specified half band if the search radius is less than the equivalent world space halfband distance.

Parameters

  points | the point data grid to rasterize
  radius | the world space radius of every point
  searchRadius | the maximum search distance of every point
  attributes | list of attributes to transfer
  halfband | the half band width
  transform | the target transform for the surface
  filter | a filter to apply to points
  interrupter | optional interrupter

Returns
  A vector of grids. The signed distance field is guaranteed to be first and at the type specified by SdfT. Successive grids are the closest point attribute grids. These grids are guaranteed to have a topology and transform equal to the surface.

## ◆ rasterizeSmoothSpheres() [3/4]

template<typename PointDataGridT, typename RadiusT = float, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

SdfT::Ptr rasterizeSmoothSpheres | ( | const PointDataGridT & | points,
|  | const std::string & | radius,
|  | const Real | radiusScale,
|  | const Real | searchRadius,
|  | const Real | halfband = LEVEL_SET_HALF_WIDTH,
|  | math::Transform::Ptr | transform = nullptr,
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT * | interrupter = nullptr )

Smoothed point distribution based sphere stamping with a varying radius.

Rasterizes points into a level set using [Zhu Bridson 05] sphere stamping with a variable radius. The radius string parameter expects a point attribute of type RadiusT to exist. The radiusScale parameter is multiplier for radius values held on the radius attribute. The searchRadius parameter remains a fixed size value which represents each points points maximum contribution to the target level set. The radius scale and search radius parameters are given in world space units and are applied to every point to generate a fixed surface mask and consequent distance values. The search radius should always have a value equal to or larger than the point radii.

Warning
  The width of the exterior half band may be smaller than the specified half band if the search radius is less than the equivalent world space halfband distance.

Parameters

  points | the point data grid to rasterize
  radius | the attribute containing the world space radius
  radiusScale | the scale applied to every world space radius value
  searchRadius | the maximum search distance of every point
  halfband | the half band width
  transform | the target transform for the surface
  filter | a filter to apply to points
  interrupter | optional interrupter

Returns
  The signed distance field.

## ◆ rasterizeSmoothSpheres() [4/4]

template<typename PointDataGridT, typename AttributeTypes, typename RadiusT = float, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

GridPtrVec rasterizeSmoothSpheres | ( | const PointDataGridT & | points,
|  | const std::string & | radius,
|  | const Real | radiusScale,
|  | const Real | searchRadius,
|  | const std::vector< std::string > & | attributes,
|  | const Real | halfband = LEVEL_SET_HALF_WIDTH,
|  | math::Transform::Ptr | transform = nullptr,
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT * | interrupter = nullptr )

Smoothed point distribution based sphere stamping with a varying radius and closest point attribute transfer.

Rasterizes points into a level set using [Zhu Bridson 05] sphere stamping with a variable radius. The radius string parameter expects a point attribute of type RadiusT to exist. The radiusScale parameter is multiplier for radius values held on the radius attribute. The searchRadius parameter remains a fixed size value which represents each points points maximum contribution to the target level set. The radius scale and search radius parameters are given in world space units and are applied to every point to generate a fixed surface mask and consequent distance values. The search radius should always have a value equal to or larger than the point radii. Every voxel's closest point is used to transfer each attribute in the attributes parameter to a new grid of matching topology. The destination types of these grids is equal to the ValueConverter result of the attribute type applied to the PointDataGridT.

Note
  The AttributeTypes template parameter should be a TypeList of the required or possible attributes types. i.e. TypeList<int, float, double>. A runtime error will be thrown if no equivalent type for a given attribute is found in the AttributeTypes TypeList.

Warning
  The width of the exterior half band may be smaller than the specified half band if the search radius is less than the equivalent world space halfband distance.

Parameters

  points | the point data grid to rasterize
  radius | the attribute containing the world space radius
  radiusScale | the scale applied to every world space radius value
  searchRadius | the maximum search distance of every point
  attributes | list of attributes to transfer
  halfband | the half band width
  transform | the target transform for the surface
  filter | a filter to apply to points
  interrupter | optional interrupter

Returns
  A vector of grids. The signed distance field is guaranteed to be first and at the type specified by SdfT. Successive grids are the closest point attribute grids. These grids are guaranteed to have a topology and transform equal to the surface.

## ◆ rasterizeSpheres() [1/4]

template<typename PointDataGridT, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

SdfT::Ptr rasterizeSpheres | ( | const PointDataGridT & | points,
|  | const Real | radius,
|  | const Real | halfband = LEVEL_SET_HALF_WIDTH,
|  | math::Transform::Ptr | transform = nullptr,
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT * | interrupter = nullptr )

Narrow band sphere stamping with a uniform radius.

Rasterizes points into a level set using basic sphere stamping with a uniform radius. The radius parameter is given in world space units and is applied to every point to generate a fixed surface mask and consequent distance values.

Parameters

  points | the point data grid to rasterize
  radius | the world space radius of every point
  halfband | the half band width
  transform | the target transform for the surface
  filter | a filter to apply to points
  interrupter | optional interrupter

Returns
  The signed distance field.

## ◆ rasterizeSpheres() [2/4]

template<typename PointDataGridT, typename AttributeTypes, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

GridPtrVec rasterizeSpheres | ( | const PointDataGridT & | points,
|  | const Real | radius,
|  | const std::vector< std::string > & | attributes,
|  | const Real | halfband = LEVEL_SET_HALF_WIDTH,
|  | math::Transform::Ptr | transform = nullptr,
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT * | interrupter = nullptr )

Narrow band sphere stamping with a uniform radius and closest point attribute transfer.

Rasterizes points into a level set using basic sphere stamping with a uniform radius. The radius parameter is given in world space units and is applied to every point to generate a fixed surface mask and consequent distance values. Every voxel's closest point is used to transfer each attribute in the attributes parameter to a new grid of matching topology. The destination types of these grids is equal to the ValueConverter result of the attribute type applied to the PointDataGridT.

Note
  The AttributeTypes template parameter should be a TypeList of the required or possible attributes types. i.e. TypeList<int, float, double>. A runtime error will be thrown if no equivalent type for a given attribute is found in the AttributeTypes TypeList.

Parameters

  points | the point data grid to rasterize
  radius | the world space radius of every point
  attributes | list of attributes to transfer
  halfband | the half band width
  transform | the target transform for the surface
  filter | a filter to apply to points
  interrupter | optional interrupter

Returns
  A vector of grids. The signed distance field is guaranteed to be first and at the type specified by SdfT. Successive grids are the closest point attribute grids. These grids are guaranteed to have a topology and transform equal to the surface.

## ◆ rasterizeSpheres() [3/4]

template<typename PointDataGridT, typename RadiusT = float, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

SdfT::Ptr rasterizeSpheres | ( | const PointDataGridT & | points,
|  | const std::string & | radius,
|  | const Real | scale = 1.0,
|  | const Real | halfband = LEVEL_SET_HALF_WIDTH,
|  | math::Transform::Ptr | transform = nullptr,
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT * | interrupter = nullptr )

Narrow band sphere stamping with a varying radius.

Rasterizes points into a level set using basic sphere stamping with a variable radius. The radius string parameter expects a point attribute of type RadiusT to exist.

Parameters

  points | the point data grid to rasterize
  radius | the name of the radius attribute
  scale | an optional scale to apply to each per point radius
  halfband | the half band width
  transform | the target transform for the surface
  filter | a filter to apply to points
  interrupter | optional interrupter

Returns
  The signed distance field.

## ◆ rasterizeSpheres() [4/4]

template<typename PointDataGridT, typename AttributeTypes, typename RadiusT = float, typename SdfT = typename PointDataGridT::template ValueConverter<float>::Type, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

GridPtrVec rasterizeSpheres | ( | const PointDataGridT & | points,
|  | const std::string & | radius,
|  | const std::vector< std::string > & | attributes,
|  | const Real | scale = 1.0,
|  | const Real | halfband = LEVEL_SET_HALF_WIDTH,
|  | math::Transform::Ptr | transform = nullptr,
|  | const FilterT & | filter = NullFilter(),
|  | InterrupterT * | interrupter = nullptr )

Narrow band sphere stamping with a varying radius and closest point attribute transfer.

Rasterizes points into a level set using basic sphere stamping with a variable radius. The radius string parameter expects a point attribute of type RadiusT to exist. Every voxel's closest point is used to transfer each attribute in the attributes parameter to a new grid of matching topology. The destination types of these grids is equal to the ValueConverter result of the attribute type applied to the PointDataGridT.

Note
  The AttributeTypes template parameter should be a TypeList of the required or possible attributes types. i.e. TypeList<int, float, double>. A runtime error will be thrown if no equivalent type for a given attribute is found in the AttributeTypes TypeList.

Parameters

  points | the point data grid to rasterize
  radius | the name of the radius attribute
  attributes | list of attributes to transfer
  scale | scale to apply to each per point radius
  halfband | the half band width
  transform | the target transform for the surface
  filter | a filter to apply to points
  interrupter | optional interrupter

Returns
  A vector of grids. The signed distance field is guaranteed to be first and at the type specified by SdfT. Successive grids are the closest point attribute grids. These grids are guaranteed to have a topology and transform equal to the surface.

## ◆ rasterizeTrilinear()

template<bool Staggered, typename ValueT, typename FilterT = NullFilter, typename PointDataTreeT = PointDataTree>

auto rasterizeTrilinear | ( | const PointDataTreeT & | points,
|  | const std::string & | attribute,
|  | const FilterT & | filter = NullFilter() )
| inline

Perform weighted trilinear rasterization of all points within a voxel. This method takes and returns a tree i.e. ignores grid transformations.

Accumulates values and weights according to a simple 0-1-0 weighted hat function. This algorithm is an exact inverse of a trilinear interpolation and thus a key method used in PIC/FLIP style simulations. Returns a tree of the same precision as the input source attribute, but may be of a different math type depending on the value of the Staggered template attribute. If Staggered is true, this method produces values at each voxels negative faces, causing scalar attributes to produce math::Vec3<ValueT> tree types. The result Tree type is equal to: TrilinearTraits<ValueT, Staggered>::template TreeT<PointDataTreeT>

Template Parameters

  Staggered | whether to perform a staggered or collocated rasterization
  ValueT | the value type of the point attribute to rasterize

Parameters

  points | the point tree to be rasterized
  attribute | the name of the attribute to rasterize. Must be a scalar or Vec3 attribute.
  filter | an optional point filter to use

## ◆ renameAttribute()

template<typename PointDataTreeT>

void renameAttribute | ( | PointDataTreeT & | tree,
|  | const Name & | oldName,
|  | const Name & | newName )
| inline

Rename an attribute in a VDB tree.

Parameters

  tree | the PointDataTree.
  oldName | the old attribute name to rename from.
  newName | the new attribute name to rename to.

Note
  newName must not already exist and must not be a group attribute.

## ◆ renameAttributes()

template<typename PointDataTreeT>

void renameAttributes | ( | PointDataTreeT & | tree,
|  | const std::vector< Name > & | oldNames,
|  | const std::vector< Name > & | newNames )
| inline

Rename attributes in a VDB tree.

Parameters

  tree | the PointDataTree.
  oldNames | a list of old attribute names to rename from.
  newNames | a list of new attribute names to rename to.

Note
  Number of oldNames must match the number of newNames.
  Duplicate names and renaming group attributes are not allowed.

## ◆ replicate() [1/2]

template<typename PointDataGridT>

PointDataGridT::Ptr replicate | ( | const PointDataGridT & | source,
|  | const Index | multiplier,
|  | const std::string & | scaleAttribute = "",
|  | const std::string & | replicationIndex = "" )

Replicates points provided in a source grid into a new grid, transfering and creating all attributes from the source grid. Position is always replicated, leaving the new points exactly over the top of the source points.

Note
  The position attribute must exist

Parameters

  source | The source grid to replicate points from
  multiplier | The base number of points to replicate per point
  scaleAttribute | A scale float attribute which multiplies the base multiplier to vary the point count per point.
  replicationIndex | When provided, creates a replication attribute of the given name which holds the replication index. This can be subsequently used to modify the replicated points as a post process.

## ◆ replicate() [2/2]

template<typename PointDataGridT>

PointDataGridT::Ptr replicate | ( | const PointDataGridT & | source,
|  | const Index | multiplier,
|  | const std::vector< std::string > & | attributes,
|  | const std::string & | scaleAttribute = "",
|  | const std::string & | replicationIndex = "" )

Replicates points provided in a source grid into a new grid, transfering and creating attributes found in a provided attribute vector. If an attribute doesn't exist, it is ignored. Position is always replicated, leaving the new points exactly over the top of the source points.

Note
  The position attribute must exist

Parameters

  source | The source grid to replicate points from
  multiplier | The base number of points to replicate per point
  attributes | Attributes to transfer to the new grid
  scaleAttribute | A scale float attribute which multiplies the base multiplier to vary the point count per point.
  replicationIndex | When provided, creates a replication attribute of the given name which holds the replication index. This can be subsequently used to modify the replicated points as a post process.

## ◆ sampleGrid()

template<typename PointDataGridT, typename SourceGridT, typename TargetValueT = DummySampleType, typename SamplerT = SampleWithRounding, typename FilterT = NullFilter, typename InterrupterT = util::NullInterrupter>

void sampleGrid | ( | size_t | order,
|  | PointDataGridT & | points,
|  | const SourceGridT & | sourceGrid,
|  | const Name & | targetAttribute,
|  | const FilterT & | filter = NullFilter(),
|  | const SamplerT & | sampler = SampleWithRounding(),
|  | InterrupterT *const | interrupter = nullptr,
|  | const bool | threaded = true )
| inline

Performs sampling and conversion from a VDB grid onto a VDB Points attribute.

Parameters

  order | the sampling order - 0 = closest-point, 1 = trilinear, 2 = triquadratic
  points | the PointDataGrid whose points will be sampled on to
  sourceGrid | VDB grid which will be sampled
  targetAttribute | a target attribute on the points which will hold samples. This attribute will be created with the source grid type if it does not exist, and with the source grid name if the name is empty
  filter | an optional index filter
  sampler | handles sampling and conversion into the target attribute type, which by default this uses the SampleWithRounding struct.
  interrupter | an optional interrupter
  threaded | enable or disable threading (threading is enabled by default)

Note
  The target attribute may exist provided it can be cast to the SourceGridT ValueType

## ◆ setGroup() [1/2]

template<typename PointDataTreeT>

void setGroup | ( | PointDataTreeT & | tree,
|  | const Name & | group,
|  | const bool | member = true )
| inline

Sets membership for the specified group for all points (on/off).

Parameters

  tree | the PointDataTree.
  group | the name of the group.
  member | true / false for membership of the group.

## ◆ setGroup() [2/2]

template<typename PointDataTreeT, typename PointIndexTreeT>

void setGroup | ( | PointDataTreeT & | tree,
|  | const PointIndexTreeT & | indexTree,
|  | const std::vector< short > & | membership,
|  | const Name & | group,
|  | const bool | remove = false )
| inline

Sets group membership from a PointIndexTree-ordered vector.

Parameters

  tree | the PointDataTree.
  indexTree | the PointIndexTree.
  membership | `1` if the point is in the group, 0 otherwise.
  group | the name of the group.
  remove | if `true` also perform removal of points from the group.

Note
  vector<bool> is not thread-safe on concurrent write, so use vector<short> instead

## ◆ setGroupByFilter()

template<typename PointDataTreeT, typename FilterT>

void setGroupByFilter | ( | PointDataTreeT & | tree,
|  | const Name & | group,
|  | const FilterT & | filter )
| inline

Sets group membership based on a provided filter.

Parameters

  tree | the PointDataTree.
  group | the name of the group.
  filter | filter data that is used to create a per-leaf filter

## ◆ setGroupByRandomPercentage()

template<typename PointDataTreeT>

void setGroupByRandomPercentage | ( | PointDataTreeT & | tree,
|  | const Name & | group,
|  | const float | percentage = 10.0f,
|  | const unsigned int | seed = 0 )
| inline

## ◆ setGroupByRandomTarget()

template<typename PointDataTreeT>

void setGroupByRandomTarget | ( | PointDataTreeT & | tree,
|  | const Name & | group,
|  | const Index64 | targetPoints,
|  | const unsigned int | seed = 0 )
| inline

## ◆ setStreamingMode()

template<typename PointDataTreeT>

void setStreamingMode | ( | PointDataTreeT & | tree,
|  | bool | on = true )
| inline

Toggle the streaming mode on all attributes in the tree to collapse the attributes after deconstructing a bound AttributeHandle to each array. This results in better memory efficiency when the data is streamed into another data structure (typically for rendering).

Parameters

  tree | the PointDataTree.
  on | `true` to enable streaming

Note
  Multiple threads cannot safely access the same AttributeArray when using streaming.

## ◆ uniformPointScatter()

template<typename GridT, typename RandGenT = std::mt19937, typename PositionArrayT = TypedAttributeArray<Vec3f, NullCodec>, typename PointDataGridT = Grid< typename points::TreeConverter<typename GridT::TreeType>::Type>, typename InterrupterT = util::NullInterrupter>

PointDataGridT::Ptr uniformPointScatter | ( | const GridT & | grid,
|  | const Index64 | count,
|  | const unsigned int | seed = 0,
|  | const float | spread = 1.0f,
|  | InterrupterT * | interrupter = nullptr )
| inline

The free functions depend on the following class:

The `InterrupterT` template argument below refers to any class with the following interface:

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

Note
  If no template argument is provided for this InterrupterT the util::NullInterrupter is used which implies that all interrupter calls are no-ops (i.e. incurs no computational overhead).

Uniformly scatter a total amount of points in active regions

Parameters

  grid | A source grid. The resulting PointDataGrid will copy this grids transform and scatter in its active voxelized topology.
  count | The total number of points to scatter
  seed | A seed for the RandGenT
  spread | The spread of points as a scale from each voxels center. A value of 1.0f indicates points can be placed anywhere within the voxel, where as a value of 0.0f will force all points to be created exactly at the centers of each voxel.
  interrupter | An optional interrupter

Note
  returns the scattered PointDataGrid