11#ifndef OPENVDB_TOOLS_ChangeBACKGROUND_HAS_BEEN_INCLUDED 
   12#define OPENVDB_TOOLS_ChangeBACKGROUND_HAS_BEEN_INCLUDED 
   36template<
typename TreeOrLeafManagerT>
 
   39    TreeOrLeafManagerT& tree,
 
   40    const typename TreeOrLeafManagerT::ValueType& background,
 
   42    size_t grainSize = 32);
 
   62template<
typename TreeOrLeafManagerT>
 
   65    TreeOrLeafManagerT& tree,
 
   66    const typename TreeOrLeafManagerT::ValueType& halfWidth,
 
   68    size_t grainSize = 32);
 
   90template<
typename TreeOrLeafManagerT>
 
   93    TreeOrLeafManagerT& tree,
 
   94    const typename TreeOrLeafManagerT::ValueType& outsideWidth,
 
   95    const typename TreeOrLeafManagerT::ValueType& insideWidth,
 
   97    size_t grainSize = 32);
 
  104template<
typename TreeOrLeafManagerT>
 
  108    typedef typename TreeOrLeafManagerT::ValueType    
ValueT;
 
  109    typedef typename TreeOrLeafManagerT::RootNodeType 
RootT;
 
  110    typedef typename TreeOrLeafManagerT::LeafNodeType 
LeafT;
 
  114        : mOldValue(
tree.root().background())
 
  115        , mNewValue(newValue)
 
 
  120        for (
typename RootT::ValueOffIter it = root.beginValueOff(); it; ++it) this->set(it);
 
  121        root.setBackground(mNewValue, 
false);
 
 
  125        for (
typename LeafT::ValueOffIter it = node.beginValueOff(); it; ++it) this->set(it);
 
 
  127    template<
typename NodeT>
 
  130        typename NodeT::NodeMaskType mask = node.getValueOffMask();
 
  131        for (
typename NodeT::ValueOnIter it(mask.beginOn(), &node); it; ++it) this->set(it);
 
 
  135    template<
typename IterT>
 
  136    inline void set(IterT& iter)
 const 
  139            iter.setValue(mNewValue);
 
  144    const ValueT mOldValue, mNewValue;
 
 
  152template<
typename TreeOrLeafManagerT>
 
  156    typedef typename TreeOrLeafManagerT::ValueType    
ValueT;
 
  157    typedef typename TreeOrLeafManagerT::RootNodeType 
RootT;
 
  158    typedef typename TreeOrLeafManagerT::LeafNodeType 
LeafT;
 
  167                          "ChangeLevelSetBackgroundOp: the outside value cannot be negative!");
 
  171                          "ChangeLevelSetBackgroundOp: the inside value must be negative!");
 
 
  176        for (
typename RootT::ValueOffIter it = root.beginValueOff(); it; ++it) this->set(it);
 
  177        root.setBackground(mOutside, 
false);
 
 
  181        for(
typename LeafT::ValueOffIter it = node.beginValueOff(); it; ++it) this->set(it);
 
 
  183    template<
typename NodeT>
 
  186        typedef typename NodeT::ValueOffIter IterT;
 
  187        for (IterT it(node.getChildMask().beginOff(), &node); it; ++it) this->set(it);
 
 
  191    template<
typename IterT>
 
  192    inline void set(IterT& iter)
 const 
  195        ValueT& v = 
const_cast<ValueT&
>(*iter);
 
  196        v = v < 0 ? mInside : mOutside;
 
  198    const ValueT mOutside, mInside;
 
 
  202template<
typename TreeOrLeafManagerT>
 
  205    TreeOrLeafManagerT& 
tree,
 
  206    const typename TreeOrLeafManagerT::ValueType& background,
 
 
  216template<
typename TreeOrLeafManagerT>
 
  219    TreeOrLeafManagerT& 
tree,
 
  220    const typename TreeOrLeafManagerT::ValueType& outsideValue,
 
  221    const typename TreeOrLeafManagerT::ValueType& insideValue,
 
 
  232template<
typename TreeOrLeafManagerT>
 
  235    TreeOrLeafManagerT& 
tree,
 
  236    const typename TreeOrLeafManagerT::ValueType& background,
 
 
  250#ifdef OPENVDB_USE_EXPLICIT_INSTANTIATION 
  252#ifdef OPENVDB_INSTANTIATE_CHANGEBACKGROUND 
  256#define _FUNCTION(TreeT) \ 
  257    void changeBackground(TreeT&, const TreeT::ValueType&, bool, size_t) 
  261#define _FUNCTION(TreeT) \ 
  262    void changeBackground(tree::LeafManager<TreeT>&, const TreeT::ValueType&, bool, size_t) 
  266#define _FUNCTION(TreeT) \ 
  267    void changeLevelSetBackground(TreeT&, const TreeT::ValueType&, bool, size_t) 
  271#define _FUNCTION(TreeT) \ 
  272    void changeLevelSetBackground(tree::LeafManager<TreeT>&, const TreeT::ValueType&, bool, size_t) 
  276#define _FUNCTION(TreeT) \ 
  277    void changeAsymmetricLevelSetBackground(TreeT&, const TreeT::ValueType&, const TreeT::ValueType&, bool, size_t) 
  281#define _FUNCTION(TreeT) \ 
  282    void changeAsymmetricLevelSetBackground(tree::LeafManager<TreeT>&, const TreeT::ValueType&, const TreeT::ValueType&, bool, size_t) 
General-purpose arithmetic and comparison routines, most of which accept arbitrary value types (or at...
Definition Exceptions.h:65
To facilitate threading over the nodes of a tree, cache node pointers in linear arrays,...
Definition NodeManager.h:532
void foreachTopDown(const NodeOp &op, bool threaded=true, size_t grainSize=1)
Definition NodeManager.h:632
bool isApproxEqual(const Type &a, const Type &b, const Type &tolerance)
Return true if a is equal to b to within the given tolerance.
Definition Math.h:406
bool isNegative(const Type &x)
Return true if x is less than zero.
Definition Math.h:367
T negative(const T &val)
Return the unary negation of the given value.
Definition Math.h:128
Definition PointDataGrid.h:170
Definition Exceptions.h:13
#define OPENVDB_THROW(exception, message)
Definition Exceptions.h:74
NodeManager produces linear arrays of all tree nodes allowing for efficient threading and bottom-up p...
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:218
#define OPENVDB_REAL_TREE_INSTANTIATE(Function)
Definition version.h.in:162
#define OPENVDB_VOLUME_TREE_INSTANTIATE(Function)
Definition version.h.in:165