OpenVDB 11.0.0

Loading...
Searching...
No Matches
PointMask.h
Go to the documentation of this file.
1// Copyright Contributors to the OpenVDB Project
2// SPDX-License-Identifier: MPL-2.0
3
4/// @file points/PointMask.h
5///
6/// @author Dan Bailey
7///
8/// @brief Methods for extracting masks from VDB Point grids.
9
10#ifndef OPENVDB_POINTS_POINT_MASK_HAS_BEEN_INCLUDED
11#define OPENVDB_POINTS_POINT_MASK_HAS_BEEN_INCLUDED
12
13#include <openvdb/openvdb.h>
14#include <openvdb/tools/ValueTransformer.h> // valxform::SumOp
15
16#include "PointDataGrid.h"
17#include "IndexFilter.h"
18
19#include <tbb/combinable.h>
20
21#include <type_traits>
22#include <vector>
23
24 namespace openvdb {
25 OPENVDB_USE_VERSION_NAMESPACE
26 namespace OPENVDB_VERSION_NAME {
27 namespace points {
28
29/// @brief Extract a Mask Tree from a Point Data Tree
30/// @param tree the PointDataTree to extract the mask from.
31/// @param filter an optional index filter
32/// @param threaded enable or disable threading (threading is enabled by default)
33 template <typename PointDataTreeT,
34 typename MaskTreeT = typename PointDataTreeT::template ValueConverter<bool>::Type,
35 typename FilterT = NullFilter>
36 inline typename std::enable_if<std::is_base_of<TreeBase, PointDataTreeT>::value &&
37 std::is_same<typename MaskTreeT::ValueType, bool>::value, typename MaskTreeT::Ptr>::type
38 convertPointsToMask(const PointDataTreeT& tree,
39 const FilterT& filter = NullFilter(),
40 bool threaded = true);
41
42/// @brief Extract a Mask Grid from a Point Data Grid
43/// @param grid the PointDataGrid to extract the mask from.
44/// @param filter an optional index filter
45/// @param threaded enable or disable threading (threading is enabled by default)
46/// @note this method is only available for Bool Grids and Mask Grids
47 template <typename PointDataGridT,
48 typename MaskGridT = typename PointDataGridT::template ValueConverter<bool>::Type,
49 typename FilterT = NullFilter>
50 inline typename std::enable_if<std::is_base_of<GridBase, PointDataGridT>::value &&
51 std::is_same<typename MaskGridT::ValueType, bool>::value, typename MaskGridT::Ptr>::type
52 convertPointsToMask(const PointDataGridT& grid,
53 const FilterT& filter = NullFilter(),
54 bool threaded = true);
55
56/// @brief Extract a Mask Grid from a Point Data Grid using a new transform
57/// @param grid the PointDataGrid to extract the mask from.
58/// @param transform target transform for the mask.
59/// @param filter an optional index filter
60/// @param threaded enable or disable threading (threading is enabled by default)
61/// @note this method is only available for Bool Grids and Mask Grids
62 template <typename PointDataGridT,
63 typename MaskT = typename PointDataGridT::template ValueConverter<bool>::Type,
64 typename FilterT = NullFilter>
65 inline typename std::enable_if<std::is_same<typename MaskT::ValueType, bool>::value,
66 typename MaskT::Ptr>::type
67 convertPointsToMask(const PointDataGridT& grid,
68 const openvdb::math::Transform& transform,
69 const FilterT& filter = NullFilter(),
70 bool threaded = true);
71
72/// @brief No-op deformer (adheres to the deformer interface documented in PointMove.h)
73 struct NullDeformer
74{
75 template <typename LeafT>
76 void reset(LeafT&, size_t /*idx*/ = 0) { }
77
78 template <typename IterT>
79 void apply(Vec3d&, IterT&) const { }
80};
81
82/// @brief Deformer Traits for optionally configuring deformers to be applied
83/// in index-space. The default is world-space.
84 template <typename DeformerT>
85 struct DeformerTraits
86{
87 static const bool IndexSpace = false;
88};
89
90} // namespace points
91} // namespace OPENVDB_VERSION_NAME
92} // namespace openvdb
93
94#include "impl/PointMaskImpl.h"
95
96#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::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::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