OpenVDB  12.0.0
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
GridTransformer Class Reference

A GridTransformer applies a geometric transformation to an input grid using one of several sampling schemes, and stores the result in an output grid. More...

#include <openvdb/tools/GridTransformer.h>

Inherits GridResampler.

Classes

struct  MatrixTransform
 

Public Types

using Ptr = SharedPtr< GridTransformer >
 
using InterruptFunc = std::function< bool(void)>
 

Public Member Functions

 GridTransformer (const Mat4R &xform)
 
 GridTransformer (const Vec3R &pivot, const Vec3R &scale, const Vec3R &rotate, const Vec3R &translate, const std::string &xformOrder="tsr", const std::string &rotationOrder="zyx")
 
 ~GridTransformer () override=default
 
 GridTransformer (const GridTransformer &)=default
 
GridTransformeroperator= (const GridTransformer &)=default
 
const Mat4RgetTransform () const
 
template<class Sampler , class GridT >
void transformGrid (const GridT &inGrid, GridT &outGrid) const
 
void setThreaded (bool b)
 Enable or disable threading. (Threading is enabled by default.) More...
 
bool threaded () const
 Return true if threading is enabled. More...
 
void setTransformTiles (bool b)
 Enable or disable processing of tiles. (Enabled by default, except for level set grids.) More...
 
bool transformTiles () const
 Return true if tile processing is enabled. More...
 
template<typename InterrupterType >
void setInterrupter (InterrupterType &)
 Allow processing to be aborted by providing an interrupter object. The interrupter will be queried periodically during processing. More...
 
template<typename Sampler , typename GridT , typename Transformer >
void transformGrid (const Transformer &, const GridT &inGrid, GridT &outGrid) const
 

Protected Member Functions

template<typename Sampler , typename GridT , typename Transformer >
void applyTransform (const Transformer &, const GridT &inGrid, GridT &outGrid) const
 
bool interrupt () const
 

Detailed Description

A GridTransformer applies a geometric transformation to an input grid using one of several sampling schemes, and stores the result in an output grid.

Note
GridTransformer is optimized for affine transformations.

Usage:

Mat4R xform = ...;
GridTransformer transformer(xform);
transformer.transformGrid<BoxSampler>(inGrid, outGrid);

or

Vec3R pivot = ..., scale = ..., rotate = ..., translate = ...;
GridTransformer transformer(pivot, scale, rotate, translate);
transformer.transformGrid<QuadraticSampler>(inGrid, outGrid);

Member Typedef Documentation

using InterruptFunc = std::function<bool (void)>
inherited

Constructor & Destructor Documentation

GridTransformer ( const Mat4R xform)
inline
GridTransformer ( const Vec3R pivot,
const Vec3R scale,
const Vec3R rotate,
const Vec3R translate,
const std::string &  xformOrder = "tsr",
const std::string &  rotationOrder = "zyx" 
)
inline
~GridTransformer ( )
overridedefault
GridTransformer ( const GridTransformer )
default

Member Function Documentation

void applyTransform ( const Transformer &  xform,
const GridT &  inGrid,
GridT &  outGrid 
) const
protectedinherited
const Mat4R& getTransform ( ) const
inline
bool interrupt ( ) const
inlineprotectedinherited
GridTransformer& operator= ( const GridTransformer )
default
void setInterrupter ( InterrupterType &  interrupter)
inherited

Allow processing to be aborted by providing an interrupter object. The interrupter will be queried periodically during processing.

See also
util/NullInterrupter.h for interrupter interface requirements.
void setThreaded ( bool  b)
inlineinherited

Enable or disable threading. (Threading is enabled by default.)

void setTransformTiles ( bool  b)
inlineinherited

Enable or disable processing of tiles. (Enabled by default, except for level set grids.)

bool threaded ( ) const
inlineinherited

Return true if threading is enabled.

void transformGrid ( const Transformer &  xform,
const GridT &  inGrid,
GridT &  outGrid 
) const
inherited
void transformGrid ( const GridT &  inGrid,
GridT &  outGrid 
) const
bool transformTiles ( ) const
inlineinherited

Return true if tile processing is enabled.