OpenVDB: GridSampler< GridOrTreeType, SamplerType > Class Template Reference

OpenVDB 9.0.0

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::Transform & | transform () 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

## ◆ AccessorType

using AccessorType = typename TreeAdapter<GridOrTreeType>::AccessorType

## ◆ GridType

using GridType = typename TreeAdapter<GridOrTreeType>::GridType

## ◆ Ptr

using Ptr = SharedPtr<GridSampler>

## ◆ TreeType

using TreeType = typename TreeAdapter<GridOrTreeType>::TreeType

## ◆ ValueType

using ValueType = typename GridOrTreeType::ValueType

## Constructor & Destructor Documentation

## ◆ GridSampler() [1/2]

GridSampler | ( | const GridType & | grid | ) |
| inlineexplicit

Parameters

  grid | a grid to be sampled

## ◆ GridSampler() [2/2]

GridSampler | ( | const TreeType & | tree,
|  | const math::Transform & | transform
| ) |  |
| inline

Parameters

  tree | a tree to be sampled, or a ValueAccessor for the tree
  transform | is used when sampling world space locations.

## Member Function Documentation

## ◆ isSample() [1/2]

ValueType isSample | ( | const Coord & | ijk | ) | const
| inline

Sample value in integer index space.

Parameters

  ijk | the location in index space

## ◆ isSample() [2/2]

ValueType isSample | ( | const Vec3d & | ispoint | ) | const
| inline

Sample in fractional index space.

Parameters

  ispoint | the location in index space

## ◆ sampleVoxel() [1/2]

ValueType sampleVoxel | ( | const RealType & | x,
|  | const RealType & | y,
|  | const RealType & | z
| ) |  | const
| inline

Sample a point in index space in the grid.

Parameters

  x | Fractional x-coordinate of point in index-coordinates of grid
  y | Fractional y-coordinate of point in index-coordinates of grid
  z | Fractional z-coordinate of point in index-coordinates of grid

## ◆ sampleVoxel() [2/2]

ValueType sampleVoxel | ( | typename Coord::ValueType | i,
|  | typename Coord::ValueType | j,
|  | typename Coord::ValueType | k
| ) |  | const
| inline

Sample value in integer index space.

Parameters

  i | Integer x-coordinate in index space
  j | Integer y-coordinate in index space
  k | Integer x-coordinate in index space

## ◆ transform()

const math::Transform & transform | ( |  | ) | const
| inline

## ◆ wsSample()

ValueType wsSample | ( | const Vec3d & | wspoint | ) | const
| inline

Sample in world space.

Parameters

  wspoint | the location in world space