35 #ifndef OPENVDB_TOOLS_MASK_HAS_BEEN_INCLUDED 36 #define OPENVDB_TOOLS_MASK_HAS_BEEN_INCLUDED 40 #include <type_traits> 54 template<
typename Gr
idType>
55 inline typename GridType::template ValueConverter<bool>::Type::Ptr
56 interiorMask(
const GridType& grid,
const double isovalue = 0.0);
62 namespace mask_internal {
65 template<
typename Gr
idType>
67 static const bool isBool = std::is_same<typename GridType::ValueType, bool>::value;
68 using BoolGridType =
typename GridType::template ValueConverter<bool>::Type;
69 using BoolGridPtrType =
typename BoolGridType::Ptr;
74 template<
typename Gr
idType>
75 inline typename std::enable_if<mask_internal::Traits<GridType>::isBool,
76 typename mask_internal::Traits<GridType>::BoolGridPtrType>::type
77 doInteriorMask(
const GridType& grid,
const double )
80 return grid.deepCopy();
85 template<
typename Gr
idType>
86 inline typename std::enable_if<!(mask_internal::Traits<GridType>::isBool),
87 typename mask_internal::Traits<GridType>::BoolGridPtrType>::type
88 doInteriorMask(
const GridType& grid,
const double isovalue)
90 using GridValueT =
typename GridType::ValueType;
91 using MaskGridT =
typename mask_internal::Traits<GridType>::BoolGridType;
94 if ((grid.getGridClass() ==
GRID_LEVEL_SET) && std::is_floating_point<GridValueT>::value) {
99 auto maskGridPtr = MaskGridT::create(
false);
100 maskGridPtr->setTransform(grid.transform().copy());
101 maskGridPtr->topologyUnion(grid);
108 template<
typename Gr
idType>
109 inline typename GridType::template ValueConverter<bool>::Type::Ptr
112 return mask_internal::doInteriorMask(grid, isovalue);
122 #endif // OPENVDB_TOOLS_MASK_HAS_BEEN_INCLUDED
#define OPENVDB_VERSION_NAME
Definition: version.h:43
Definition: Exceptions.h:39
Miscellaneous utility methods that operate primarily or exclusively on level set grids.
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:71