OpenVDB 11.0.0
Loading...
Searching...
No Matches
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.
 
ValueType sampleVoxel (typename Coord::ValueType i, typename Coord::ValueType j, typename Coord::ValueType k) const
 Sample value in integer index space.
 
ValueType isSample (const Coord &ijk) const
 Sample value in integer index space.
 
ValueType isSample (const Vec3d &ispoint) const
 Sample in fractional index space.
 
ValueType wsSample (const Vec3d &wspoint) const
 Sample in world space.
 

Detailed Description

template<typename GridOrTreeType, typename SamplerType>
class openvdb::v11_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

◆ AccessorType

template<typename GridOrTreeType , typename SamplerType >
using AccessorType = typename TreeAdapter<GridOrTreeType>::AccessorType

◆ GridType

template<typename GridOrTreeType , typename SamplerType >
using GridType = typename TreeAdapter<GridOrTreeType>::GridType

◆ Ptr

template<typename GridOrTreeType , typename SamplerType >
using Ptr = SharedPtr<GridSampler>

◆ TreeType

template<typename GridOrTreeType , typename SamplerType >
using TreeType = typename TreeAdapter<GridOrTreeType>::TreeType

◆ ValueType

template<typename GridOrTreeType , typename SamplerType >
using ValueType = typename GridOrTreeType::ValueType

Constructor & Destructor Documentation

◆ GridSampler() [1/2]

template<typename GridOrTreeType , typename SamplerType >
GridSampler ( const GridType & grid)
inlineexplicit
Parameters
grida grid to be sampled

◆ GridSampler() [2/2]

template<typename GridOrTreeType , typename SamplerType >
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

◆ isSample() [1/2]

template<typename GridOrTreeType , typename SamplerType >
ValueType isSample ( const Coord & ijk) const
inline

Sample value in integer index space.

Parameters
ijkthe location in index space

◆ isSample() [2/2]

template<typename GridOrTreeType , typename SamplerType >
ValueType isSample ( const Vec3d & ispoint) const
inline

Sample in fractional index space.

Parameters
ispointthe location in index space

◆ sampleVoxel() [1/2]

template<typename GridOrTreeType , typename SamplerType >
template<typename RealType >
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

◆ sampleVoxel() [2/2]

template<typename GridOrTreeType , typename SamplerType >
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

◆ transform()

template<typename GridOrTreeType , typename SamplerType >
const math::Transform & transform ( ) const
inline

◆ wsSample()

template<typename GridOrTreeType , typename SamplerType >
ValueType wsSample ( const Vec3d & wspoint) const
inline

Sample in world space.

Parameters
wspointthe location in world space