OpenVDB  9.0.1
Public Types | Public Member Functions | List of all members
GridSampler< GridOrTreeType, SamplerType > Class Template Reference

Class that provides the interface for continuous sampling of values in a tree. More...

#include <openvdb/tools/Interpolation.h>

Public Types

using Ptr = SharedPtr< GridSampler >
 
using ValueType = typename GridOrTreeType::ValueType
 
using GridType = typename TreeAdapter< GridOrTreeType >::GridType
 
using TreeType = typename TreeAdapter< GridOrTreeType >::TreeType
 
using AccessorType = typename TreeAdapter< GridOrTreeType >::AccessorType
 

Public Member Functions

 GridSampler (const GridType &grid)
 
 GridSampler (const TreeType &tree, const math::Transform &transform)
 
const math::Transformtransform () const
 
template<typename RealType >
ValueType sampleVoxel (const RealType &x, const RealType &y, const RealType &z) const
 Sample a point in index space in the grid. More...
 
ValueType sampleVoxel (typename Coord::ValueType i, typename Coord::ValueType j, typename Coord::ValueType k) const
 Sample value in integer index space. More...
 
ValueType isSample (const Coord &ijk) const
 Sample value in integer index space. More...
 
ValueType isSample (const Vec3d &ispoint) const
 Sample in fractional index space. More...
 
ValueType wsSample (const Vec3d &wspoint) const
 Sample in world space. More...
 

Detailed Description

template<typename GridOrTreeType, typename SamplerType>
class openvdb::v9_0::tools::GridSampler< GridOrTreeType, SamplerType >

Class that provides the interface for continuous sampling of values in a tree.

Since trees support only discrete voxel sampling, TreeSampler must be used to sample arbitrary continuous points in (world or index) space.

Warning
This implementation of the GridSampler stores a pointer to a Tree for value access. While this is thread-safe it is uncached and hence slow compared to using a ValueAccessor. Consequently it is normally advisable to use the template specialization below that employs a ValueAccessor. However, care must be taken when dealing with multi-threading (see warning below).

Member Typedef Documentation

using AccessorType = typename TreeAdapter<GridOrTreeType>::AccessorType
using GridType = typename TreeAdapter<GridOrTreeType>::GridType
using TreeType = typename TreeAdapter<GridOrTreeType>::TreeType
using ValueType = typename GridOrTreeType::ValueType

Constructor & Destructor Documentation

GridSampler ( const GridType grid)
inlineexplicit
Parameters
grida grid to be sampled
GridSampler ( const TreeType tree,
const math::Transform transform 
)
inline
Parameters
treea tree to be sampled, or a ValueAccessor for the tree
transformis used when sampling world space locations.

Member Function Documentation

ValueType isSample ( const Coord &  ijk) const
inline

Sample value in integer index space.

Parameters
ijkthe location in index space
ValueType isSample ( const Vec3d &  ispoint) const
inline

Sample in fractional index space.

Parameters
ispointthe location in index space
ValueType sampleVoxel ( const RealType &  x,
const RealType &  y,
const RealType &  z 
) const
inline

Sample a point in index space in the grid.

Parameters
xFractional x-coordinate of point in index-coordinates of grid
yFractional y-coordinate of point in index-coordinates of grid
zFractional z-coordinate of point in index-coordinates of grid
ValueType sampleVoxel ( typename Coord::ValueType  i,
typename Coord::ValueType  j,
typename Coord::ValueType  k 
) const
inline

Sample value in integer index space.

Parameters
iInteger x-coordinate in index space
jInteger y-coordinate in index space
kInteger x-coordinate in index space
const math::Transform& transform ( ) const
inline
ValueType wsSample ( const Vec3d &  wspoint) const
inline

Sample in world space.

Parameters
wspointthe location in world space