10 #ifndef OPENVDB_POINTS_POINT_CONVERSION_HAS_BEEN_INCLUDED 11 #define OPENVDB_POINTS_POINT_CONVERSION_HAS_BEEN_INCLUDED 26 #include <tbb/parallel_reduce.h> 28 #include <type_traits> 39 template<
typename ValueType>
46 const Index stride = 1)
50 size_t size()
const {
return mData.size(); }
51 void getPos(
size_t n, ValueType& xyz)
const { xyz = mData[n]; }
52 void get(ValueType& value,
size_t n)
const { value = mData[n]; }
53 void get(ValueType& value,
size_t n,
openvdb::Index m)
const { value = mData[n * mStride + m]; }
56 const std::vector<value_type>& mData;
81 typename CompressionT,
82 typename PointDataGridT,
83 typename PositionArrayT,
84 typename PointIndexGridT>
85 inline typename PointDataGridT::Ptr
87 const PositionArrayT& positions,
89 const Metadata* positionDefaultValue =
nullptr);
102 template <
typename CompressionT,
typename Po
intDataGr
idT,
typename ValueT>
103 inline typename PointDataGridT::Ptr
106 const Metadata* positionDefaultValue =
nullptr);
120 template <
typename Po
intDataTreeT,
typename Po
intIndexTreeT,
typename Po
intArrayT>
123 const PointIndexTreeT& pointIndexTree,
125 const PointArrayT& data,
126 const Index stride = 1,
127 const bool insertMetadata =
true);
139 template <
typename PositionAttribute,
typename Po
intDataGr
idT,
typename FilterT = NullFilter>
142 const PointDataGridT& grid,
146 const bool inCoreOnly =
false);
159 template <
typename TypedAttribute,
typename Po
intDataTreeT,
typename FilterT = NullFilter>
162 const PointDataTreeT& tree,
163 const std::vector<Index64>& pointOffsets,
165 const unsigned arrayIndex,
166 const Index stride = 1,
168 const bool inCoreOnly =
false);
182 template <
typename Group,
typename Po
intDataTreeT,
typename FilterT = NullFilter>
185 const PointDataTreeT& tree,
186 const std::vector<Index64>& pointOffsets,
188 const AttributeSet::Descriptor::GroupIndex index,
190 const bool inCoreOnly =
false);
195 template <
typename...>
using void_t = void;
196 template <
typename T,
typename =
void>
198 template <
typename T>
216 template<
typename PositionWrapper,
217 typename InterrupterT = openvdb::util::NullInterrupter,
221 const uint32_t pointsPerVoxel,
222 const math::Mat4d transform = math::Mat4d::identity(),
223 const Index decimalPlaces = 5,
224 InterrupterT*
const interrupter =
nullptr);
232 #endif // OPENVDB_POINTS_POINT_CONVERSION_HAS_BEEN_INCLUDED ValueType value_type
Definition: PointConversion.h:43
float computeVoxelSize(const PositionWrapper &positions, const uint32_t pointsPerVoxel, const math::Mat4d transform=math::Mat4d::identity(), const Index decimalPlaces=5, InterrupterT *const interrupter=nullptr)
Definition: PointConversionImpl.h:675
Space-partitioning acceleration structure for points. Partitions the points into voxels to accelerate...
void populateAttribute(PointDataTreeT &tree, const PointIndexTreeT &pointIndexTree, const openvdb::Name &attributeName, const PointArrayT &data, const Index stride=1, const bool insertMetadata=true)
Stores point attribute data in an existing PointDataGrid attribute.
Definition: PointConversionImpl.h:544
math::Vec3< Real > Vec3R
Definition: Types.h:72
void convertPointDataGridGroup(Group &group, const PointDataTreeT &tree, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const AttributeSet::Descriptor::GroupIndex index, const FilterT &filter=NullFilter(), const bool inCoreOnly=false)
Convert the group from a PointDataGrid.
Definition: PointConversionImpl.h:647
ValueType PosType
Definition: PointConversion.h:42
Point attribute manipulation in a VDB Point Grid.
Definition: PointConversion.h:197
Point group manipulation in a VDB Point Grid.
PointDataGridT::Ptr createPointDataGrid(const std::vector< ValueT > &positions, const math::Transform &xform, const Metadata *positionDefaultValue=nullptr)
Convenience method to create a PointDataGrid from a std::vector of point positions.
Definition: PointConversionImpl.h:526
Index filters primarily designed to be used with a FilterIndexIter.
void void_t
Definition: PointConversion.h:195
uint64_t Index64
Definition: Types.h:53
void convertPointDataGridPosition(PositionAttribute &positionAttribute, const PointDataGridT &grid, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const FilterT &filter=NullFilter(), const bool inCoreOnly=false)
Convert the position attribute from a Point Data Grid.
Definition: PointConversionImpl.h:581
Index64 pointOffsets(std::vector< Index64 > &pointOffsets, const PointDataTreeT &tree, const FilterT &filter=NullFilter(), const bool inCoreOnly=false, const bool threaded=true)
Populate an array of cumulative point offsets per leaf node.
Definition: PointCountImpl.h:52
Definition: Exceptions.h:13
PointAttributeVector(const std::vector< value_type > &data, const Index stride=1)
Definition: PointConversion.h:45
This tool produces a grid where every voxel that contains a point is active. It employs thread-local ...
std::string Name
Definition: Name.h:19
size_t size() const
Definition: PointConversion.h:50
void convertPointDataGridAttribute(TypedAttribute &attribute, const PointDataTreeT &tree, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const unsigned arrayIndex, const Index stride=1, const FilterT &filter=NullFilter(), const bool inCoreOnly=false)
Convert the attribute from a PointDataGrid.
Definition: PointConversionImpl.h:615
Index32 Index
Definition: Types.h:54
void getPos(size_t n, ValueType &xyz) const
Definition: PointConversion.h:51
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
Attribute array storage for string data using Descriptor Metadata.
typename T::value_type Type
Definition: PointConversion.h:199
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h.in:121
A no-op filter that can be used when iterating over all indices.
Definition: IndexIterator.h:50
Set of Attribute Arrays which tracks metadata about each array.
Point-partitioner compatible STL vector attribute wrapper for convenience.
Definition: PointConversion.h:40
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h.in:212