10#ifndef OPENVDB_POINTS_POINT_CONVERSION_HAS_BEEN_INCLUDED
11#define OPENVDB_POINTS_POINT_CONVERSION_HAS_BEEN_INCLUDED
27#include <tbb/parallel_reduce.h>
40template<
typename ValueType>
47 const Index stride = 1)
51 size_t size()
const {
return mData.size(); }
52 void getPos(
size_t n, ValueType& xyz)
const { xyz = mData[n]; }
53 void get(ValueType& value,
size_t n)
const { value = mData[n]; }
54 void get(ValueType& value,
size_t n,
openvdb::Index m)
const { value = mData[n * mStride + m]; }
57 const std::vector<value_type>& mData;
82 typename CompressionT,
83 typename PointDataGridT,
84 typename PositionArrayT,
85 typename PointIndexGridT>
86inline typename PointDataGridT::Ptr
88 const PositionArrayT& positions,
90 const Metadata* positionDefaultValue =
nullptr);
103template <
typename CompressionT,
typename Po
intDataGr
idT,
typename ValueT>
104inline typename PointDataGridT::Ptr
107 const Metadata* positionDefaultValue =
nullptr);
121template <
typename Po
intDataTreeT,
typename Po
intIndexTreeT,
typename Po
intArrayT>
124 const PointIndexTreeT& pointIndexTree,
126 const PointArrayT& data,
127 const Index stride = 1,
128 const bool insertMetadata =
true);
139template <
typename PositionAttribute,
typename Po
intDataGr
idT,
typename FilterT = NullFilter>
142 const PointDataGridT& grid,
157template <
typename TypedAttribute,
typename Po
intDataTreeT,
typename FilterT = NullFilter>
160 const PointDataTreeT&
tree,
163 const unsigned arrayIndex,
164 const Index stride = 1,
177template <
typename Group,
typename Po
intDataTreeT,
typename FilterT = NullFilter>
180 const PointDataTreeT&
tree,
189template <
typename...>
using void_t = void;
190template <
typename T,
typename =
void>
191struct ValueTypeTraits {
using Type =
Vec3R; };
193struct ValueTypeTraits <T, void_t<typename T::value_type>> {
using Type =
typename T::value_type; };
210template<
typename PositionWrapper,
211 typename InterrupterT = openvdb::util::NullInterrupter,
212 typename VecT =
typename internal::ValueTypeTraits<PositionWrapper>::Type>
215 const uint32_t pointsPerVoxel,
217 const Index decimalPlaces = 5,
218 InterrupterT*
const interrupter =
nullptr);
224#include "impl/PointConversionImpl.h"
Attribute array storage for string data using Descriptor Metadata.
Set of Attribute Arrays which tracks metadata about each array.
Index filters primarily designed to be used with a FilterIndexIter.
Point attribute manipulation in a VDB Point Grid.
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
Point group manipulation in a VDB Point Grid.
Space-partitioning acceleration structure for points. Partitions the points into voxels to accelerate...
This tool produces a grid where every voxel that contains a point is active. It employs thread-local ...
static const Mat4< double > & identity()
Definition Mat4.h:117
Util::GroupIndex GroupIndex
Definition AttributeSet.h:312
A no-op filter that can be used when iterating over all indices.
Definition IndexIterator.h:52
size_t size() const
Definition PointConversion.h:51
void get(ValueType &value, size_t n, openvdb::Index m) const
Definition PointConversion.h:54
void get(ValueType &value, size_t n) const
Definition PointConversion.h:53
ValueType value_type
Definition PointConversion.h:44
PointAttributeVector(const std::vector< value_type > &data, const Index stride=1)
Definition PointConversion.h:46
void getPos(size_t n, ValueType &xyz) const
Definition PointConversion.h:52
ValueType PosType
Definition PointConversion.h:43
Mat4< double > Mat4d
Definition Mat4.h:1355
Definition IndexIterator.h:35
void convertPointDataGridGroup(Group &group, const PointDataTreeT &tree, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const AttributeSet::Descriptor::GroupIndex index, const FilterT &filter=NullFilter())
Convert the group from a PointDataGrid.
Index64 pointOffsets(std::vector< Index64 > &pointOffsets, const PointDataTreeT &tree, const FilterT &filter=NullFilter(), const bool threaded=true)
Populate an array of cumulative point offsets per leaf node.
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())
Convert the attribute from a PointDataGrid.
float computeVoxelSize(const PositionWrapper &positions, const uint32_t pointsPerVoxel, const math::Mat4d transform=math::Mat4d::identity(), const Index decimalPlaces=5, InterrupterT *const interrupter=nullptr)
void convertPointDataGridPosition(PositionAttribute &positionAttribute, const PointDataGridT &grid, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const FilterT &filter=NullFilter())
Convert the position attribute from a Point Data Grid.
PointDataGridT::Ptr createPointDataGrid(const PointIndexGridT &pointIndexGrid, const PositionArrayT &positions, const math::Transform &xform, const Metadata *positionDefaultValue=nullptr)
Localises points with position into a PointDataGrid into two stages: allocation of the leaf attribute...
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 PointDataGrid.h:48
std::string Name
Definition Name.h:19
Index32 Index
Definition Types.h:34
math::Vec3< Real > Vec3R
Definition Types.h:53
uint64_t Index64
Definition Types.h:33
Definition Exceptions.h:13
#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:291