Loading...
Searching...
No Matches
PointMask.h
Go to the documentation of this file.
// Copyright Contributors to the OpenVDB Project
// SPDX-License-Identifier: MPL-2.0
/// @file points/PointMask.h
///
/// @author Dan Bailey
///
/// @brief Methods for extracting masks from VDB Point grids.
#ifndef OPENVDB_POINTS_POINT_MASK_HAS_BEEN_INCLUDED
#define OPENVDB_POINTS_POINT_MASK_HAS_BEEN_INCLUDED
#include <openvdb/openvdb.h>
#include <openvdb/tools/ValueTransformer.h> // valxform::SumOp
#include "PointDataGrid.h"
#include "IndexFilter.h"
#include <tbb/combinable.h>
#include <type_traits>
#include <vector>
namespace openvdb {
OPENVDB_USE_VERSION_NAMESPACE
namespace OPENVDB_VERSION_NAME {
namespace points {
/// @brief Extract a Mask Tree from a Point Data Tree
/// @param tree the PointDataTree to extract the mask from.
/// @param filter an optional index filter
/// @param threaded enable or disable threading (threading is enabled by default)
template <typename PointDataTreeT,
typename MaskTreeT = typename PointDataTreeT::template ValueConverter<bool>::Type,
typename FilterT = NullFilter>
inline typename std::enable_if<std::is_base_of<TreeBase, PointDataTreeT>::value &&
std::is_same<typename MaskTreeT::ValueType, bool>::value, typename MaskTreeT::Ptr>::type
convertPointsToMask(const PointDataTreeT& tree,
const FilterT& filter = NullFilter(),
bool threaded = true);
/// @brief Extract a Mask Grid from a Point Data Grid
/// @param grid the PointDataGrid to extract the mask from.
/// @param filter an optional index filter
/// @param threaded enable or disable threading (threading is enabled by default)
/// @note this method is only available for Bool Grids and Mask Grids
template <typename PointDataGridT,
typename MaskGridT = typename PointDataGridT::template ValueConverter<bool>::Type,
typename FilterT = NullFilter>
inline typename std::enable_if<std::is_base_of<GridBase, PointDataGridT>::value &&
std::is_same<typename MaskGridT::ValueType, bool>::value, typename MaskGridT::Ptr>::type
convertPointsToMask(const PointDataGridT& grid,
const FilterT& filter = NullFilter(),
bool threaded = true);
/// @brief Extract a Mask Grid from a Point Data Grid using a new transform
/// @param grid the PointDataGrid to extract the mask from.
/// @param transform target transform for the mask.
/// @param filter an optional index filter
/// @param threaded enable or disable threading (threading is enabled by default)
/// @note this method is only available for Bool Grids and Mask Grids
template <typename PointDataGridT,
typename MaskT = typename PointDataGridT::template ValueConverter<bool>::Type,
typename FilterT = NullFilter>
inline typename std::enable_if<std::is_same<typename MaskT::ValueType, bool>::value,
typename MaskT::Ptr>::type
convertPointsToMask(const PointDataGridT& grid,
const openvdb::math::Transform& transform,
const FilterT& filter = NullFilter(),
bool threaded = true);
/// @brief No-op deformer (adheres to the deformer interface documented in PointMove.h)
struct NullDeformer
{
template <typename LeafT>
void reset(LeafT&, size_t /*idx*/ = 0) { }
template <typename IterT>
void apply(Vec3d&, IterT&) const { }
};
/// @brief Deformer Traits for optionally configuring deformers to be applied
/// in index-space. The default is world-space.
template <typename DeformerT>
struct DeformerTraits
{
static const bool IndexSpace = false;
};
} // namespace points
} // namespace OPENVDB_VERSION_NAME
} // namespace openvdb
#include "impl/PointMaskImpl.h"
#endif // OPENVDB_POINTS_POINT_MASK_HAS_BEEN_INCLUDED
IndexFilter.h
Index filters primarily designed to be used with a FilterIndexIter.
PointDataGrid.h
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
PointMaskImpl.h
ValueTransformer.h
openvdb::v11_0::math::Vec3d
Vec3< double > Vec3d
Definition Vec3.h:664
openvdb::v11_0::points::convertPointsToMask
std::enable_if< std::is_base_of< TreeBase, PointDataTreeT >::value &&std::is_same< typenameMaskTreeT::ValueType, bool >::value, typenameMaskTreeT::Ptr >::type convertPointsToMask(const PointDataTreeT &tree, const FilterT &filter=NullFilter(), bool threaded=true)
Extract a Mask Tree from a Point Data Tree.
Definition PointMaskImpl.h:302
openvdb
Definition Exceptions.h:13
openvdb.h
openvdb::v11_0::points::DeformerTraits
Deformer Traits for optionally configuring deformers to be applied in index-space....
Definition PointMask.h:86
openvdb::v11_0::points::DeformerTraits::IndexSpace
static const bool IndexSpace
Definition PointMask.h:87
openvdb::v11_0::points::NullDeformer
No-op deformer (adheres to the deformer interface documented in PointMove.h)
Definition PointMask.h:74
openvdb::v11_0::points::NullDeformer::reset
void reset(LeafT &, size_t=0)
Definition PointMask.h:76
openvdb::v11_0::points::NullDeformer::apply
void apply(Vec3d &, IterT &) const
Definition PointMask.h:79
OPENVDB_VERSION_NAME
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition version.h.in:121
OPENVDB_USE_VERSION_NAMESPACE
#define OPENVDB_USE_VERSION_NAMESPACE
Definition version.h.in:212