8 #ifndef OPENVDB_TOOLS_MASK_HAS_BEEN_INCLUDED 9 #define OPENVDB_TOOLS_MASK_HAS_BEEN_INCLUDED 14 #include <type_traits> 28 template<
typename Gr
idType>
29 typename GridType::template ValueConverter<bool>::Type::Ptr
37 namespace mask_internal {
38 template<
typename Gr
idType>
40 static const bool isBool = std::is_same<typename GridType::ValueType, bool>::value;
41 using BoolGridType =
typename GridType::template ValueConverter<bool>::Type;
42 using BoolGridPtrType =
typename BoolGridType::Ptr;
45 template<
typename Gr
idType>
46 inline typename std::enable_if<std::is_floating_point<typename GridType::ValueType>::value,
47 typename mask_internal::Traits<GridType>::BoolGridPtrType>::type
48 doLevelSetInteriorMask(
const GridType& grid,
const double isovalue)
50 using GridValueT =
typename GridType::ValueType;
51 using MaskGridPtrT =
typename mask_internal::Traits<GridType>::BoolGridPtrType;
57 return MaskGridPtrT{};
61 template<
typename Gr
idType>
62 inline typename std::enable_if<!std::is_floating_point<typename GridType::ValueType>::value,
63 typename mask_internal::Traits<GridType>::BoolGridPtrType>::type
64 doLevelSetInteriorMask(
const GridType&,
const double )
66 using MaskGridPtrT =
typename mask_internal::Traits<GridType>::BoolGridPtrType;
67 return MaskGridPtrT{};
70 template<
typename Gr
idType>
71 inline typename std::enable_if<mask_internal::Traits<GridType>::isBool,
72 typename mask_internal::Traits<GridType>::BoolGridPtrType>::type
73 doInteriorMask(
const GridType& grid,
const double )
76 return grid.deepCopy();
79 template<
typename Gr
idType>
80 inline typename std::enable_if<!(mask_internal::Traits<GridType>::isBool),
81 typename mask_internal::Traits<GridType>::BoolGridPtrType>::type
82 doInteriorMask(
const GridType& grid,
const double isovalue)
84 using MaskGridT =
typename mask_internal::Traits<GridType>::BoolGridType;
87 if (
auto maskGridPtr = doLevelSetInteriorMask(grid, isovalue)) {
92 auto maskGridPtr = MaskGridT::create(
false);
93 maskGridPtr->setTransform(grid.transform().copy());
94 maskGridPtr->topologyUnion(grid);
103 template<
typename Gr
idType>
104 typename GridType::template ValueConverter<bool>::Type::Ptr
107 return mask_internal::doInteriorMask(grid, isovalue);
116 #ifdef OPENVDB_USE_EXPLICIT_INSTANTIATION 118 #ifdef OPENVDB_INSTANTIATE_MASK 122 #define _FUNCTION(TreeT) \ 123 Grid<TreeT>::ValueConverter<bool>::Type::Ptr interiorMask(const Grid<TreeT>&, const double) 127 #endif // OPENVDB_USE_EXPLICIT_INSTANTIATION 134 #endif // OPENVDB_TOOLS_MASK_HAS_BEEN_INCLUDED #define OPENVDB_VOLUME_TREE_INSTANTIATE(Function)
Definition: version.h.in:165
Definition: Exceptions.h:13
GridType
List of types that are currently supported by NanoVDB.
Definition: NanoVDB.h:219
Miscellaneous utility methods that operate primarily or exclusively on level set grids.
#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