37 #ifndef OPENVDB_POINTS_POINT_CONVERSION_HAS_BEEN_INCLUDED 38 #define OPENVDB_POINTS_POINT_CONVERSION_HAS_BEEN_INCLUDED 53 #include <tbb/parallel_reduce.h> 55 #include <type_traits> 81 typename CompressionT,
82 typename PointDataGridT,
83 typename PositionArrayT,
84 typename PointIndexGridT>
85 inline typename PointDataGridT::Ptr
87 const PositionArrayT& positions,
88 const math::Transform& xform,
102 template <
typename CompressionT,
typename Po
intDataGr
idT,
typename ValueT>
103 inline typename PointDataGridT::Ptr
105 const math::Transform& xform,
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,
145 const FilterT& filter = NullFilter(),
146 const bool inCoreOnly =
false);
159 template <
typename TypedAttribute,
typename Po
intDataTreeT,
typename FilterT = NullFilter>
162 const PointDataTreeT& tree,
165 const unsigned arrayIndex,
166 const Index stride = 1,
167 const FilterT& filter = NullFilter(),
168 const bool inCoreOnly =
false);
182 template <
typename Group,
typename Po
intDataTreeT,
typename FilterT = NullFilter>
185 const PointDataTreeT& tree,
188 const AttributeSet::Descriptor::GroupIndex index,
189 const FilterT& filter = NullFilter(),
190 const bool inCoreOnly =
false);
204 template<
typename PositionWrapper,
typename InterrupterT = openvdb::util::NullInterrupter>
207 const uint32_t pointsPerVoxel,
208 const math::Mat4d transform = math::Mat4d::identity(),
209 const Index decimalPlaces = 5,
210 InterrupterT*
const interrupter =
nullptr);
217 template<
typename ValueType>
224 const Index stride = 1)
226 , mStride(stride) { }
228 size_t size()
const {
return mData.size(); }
229 void getPos(
size_t n, ValueType& xyz)
const { xyz = mData[n]; }
230 void get(ValueType& value,
size_t n)
const { value = mData[n]; }
231 void get(ValueType& value,
size_t n,
openvdb::Index m)
const { value = mData[n * mStride + m]; }
234 const std::vector<value_type>& mData;
242 namespace point_conversion_internal {
250 static T
zero() {
return zeroVal<T>(); }
251 template <
typename LeafT>
254 return Handle::create(array);
256 template <
typename LeafT>
259 return WriteHandle::create(array);
267 template <
typename LeafT>
270 const AttributeSet::Descriptor& descriptor = leaf.attributeSet().descriptor();
271 return Handle::create(array, descriptor.getMetadata());
273 template <
typename LeafT>
276 const AttributeSet::Descriptor& descriptor = leaf.attributeSet().descriptor();
277 return WriteHandle::create(array, descriptor.getMetadata());
281 template<
typename PointDataTreeType,
282 typename PointIndexTreeType,
283 typename AttributeListType>
290 using ValueType =
typename AttributeListType::value_type;
294 const AttributeListType& data,
296 const Index stride = 1)
297 : mPointIndexTree(pointIndexTree)
300 , mStride(stride) { }
302 void operator()(
const typename LeafManagerT::LeafRange& range)
const {
304 for (
auto leaf = range.begin(); leaf; ++leaf) {
309 mPointIndexTree.probeConstLeaf(leaf->origin());
311 if (!pointIndexLeaf)
continue;
313 typename HandleT::Ptr attributeWriteHandle =
318 const IndexArray& indices = pointIndexLeaf->indices();
320 for (
const Index64 leafIndex: indices)
323 for (
Index i = 0; i < mStride; i++) {
324 mData.get(value, leafIndex, i);
325 attributeWriteHandle->set(static_cast<Index>(index), i, value);
332 attributeWriteHandle->compact();
344 template<
typename Po
intDataTreeType,
typename Attribute,
typename FilterT>
347 using LeafNode =
typename PointDataTreeType::LeafNodeType;
359 const FilterT& filter,
360 const bool inCoreOnly)
361 : mAttribute(attribute)
363 , mStartOffset(startOffset)
364 , mTransform(transform)
367 , mInCoreOnly(inCoreOnly)
371 std::is_floating_point<typename ValueType::ValueType>::value,
372 "ValueType is not Vec3f");
375 template <
typename IterT>
379 for (; iter; ++iter) {
380 const Vec3d xyz = iter.getCoord().asVec3d();
381 const Vec3d pos = sourceHandle.
get(*iter);
382 targetHandle.set(static_cast<Index>(offset++), 0,
383 mTransform.indexToWorld(pos + xyz));
391 for (
auto leaf = range.begin(); leaf; ++leaf) {
393 assert(leaf.pos() < mPointOffsets.size());
395 if (mInCoreOnly && leaf->buffer().isOutOfCore())
continue;
399 if (leaf.pos() > 0) offset += mPointOffsets[leaf.pos() - 1];
401 auto handle = SourceHandleT::create(leaf->constAttributeArray(mIndex));
404 auto iter = leaf->beginIndexOn();
405 convert(iter, pHandle, *handle, offset);
408 auto iter = leaf->beginIndexOn(mFilter);
409 convert(iter, pHandle, *handle, offset);
426 template<
typename Po
intDataTreeType,
typename Attribute,
typename FilterT>
429 using LeafNode =
typename PointDataTreeType::LeafNodeType;
441 const FilterT& filter,
442 const bool inCoreOnly)
443 : mAttribute(attribute)
445 , mStartOffset(startOffset)
449 , mInCoreOnly(inCoreOnly) { }
451 template <
typename IterT>
455 if (sourceHandle.isUniform()) {
456 const ValueType uniformValue(sourceHandle.get(0));
457 for (; iter; ++iter) {
458 for (
Index i = 0; i < mStride; i++) {
459 targetHandle.set(static_cast<Index>(offset), i, uniformValue);
465 for (; iter; ++iter) {
466 for (
Index i = 0; i < mStride; i++) {
467 targetHandle.set(static_cast<Index>(offset), i,
468 sourceHandle.get(*iter, i));
479 for (
auto leaf = range.begin(); leaf; ++leaf) {
481 assert(leaf.pos() < mPointOffsets.size());
483 if (mInCoreOnly && leaf->buffer().isOutOfCore())
continue;
487 if (leaf.pos() > 0) offset += mPointOffsets[leaf.pos() - 1];
490 *leaf, static_cast<Index>(mIndex));
493 auto iter = leaf->beginIndexOn();
494 convert(iter, pHandle, *handle, offset);
496 auto iter = leaf->beginIndexOn(mFilter);
497 convert(iter, pHandle, *handle, offset);
513 template<
typename Po
intDataTreeType,
typename Group,
typename FilterT>
516 using LeafNode =
typename PointDataTreeType::LeafNodeType;
524 const AttributeSet::Descriptor::GroupIndex index,
525 const FilterT& filter,
526 const bool inCoreOnly)
529 , mStartOffset(startOffset)
532 , mInCoreOnly(inCoreOnly) { }
534 template <
typename IterT>
537 const auto bitmask = static_cast<GroupType>(1 << mIndex.second);
540 if (groupArray.
get(0) & bitmask) {
541 for (; iter; ++iter) {
542 mGroup.setOffsetOn(static_cast<Index>(offset));
548 for (; iter; ++iter) {
549 if (groupArray.
get(*iter) & bitmask) {
550 mGroup.setOffsetOn(static_cast<Index>(offset));
559 for (
auto leaf = range.begin(); leaf; ++leaf) {
561 assert(leaf.pos() < mPointOffsets.size());
563 if (mInCoreOnly && leaf->buffer().isOutOfCore())
continue;
567 if (leaf.pos() > 0) offset += mPointOffsets[leaf.pos() - 1];
569 const AttributeArray& array = leaf->constAttributeArray(mIndex.first);
574 auto iter = leaf->beginIndexOn();
575 convert(iter, groupArray, offset);
578 auto iter = leaf->beginIndexOn(mFilter);
579 convert(iter, groupArray, offset);
594 template<
typename PositionArrayT>
599 : mPositions(positions)
600 , mInverseMat(inverse)
605 : mPositions(other.mPositions)
606 , mInverseMat(other.mInverseMat)
612 for (
size_t n = range.begin(), N = range.end(); n != N; ++n) {
613 mPositions.getPos(n, pos);
614 pos = mInverseMat.transform(pos);
626 return BBoxd(mMin, mMax);
630 const PositionArrayT& mPositions;
641 template<
typename CompressionT,
typename Po
intDataGr
idT,
typename PositionArrayT,
typename Po
intIndexGr
idT>
642 inline typename PointDataGridT::Ptr
646 using PointDataTreeT =
typename PointDataGridT::TreeType;
648 using PointIndexLeafT =
typename PointIndexGridT::TreeType::LeafNodeType;
649 using PointIndexT =
typename PointIndexLeafT::ValueType;
653 const NamePair positionType = PositionAttributeT::attributeType();
657 const auto& pointIndexTree = pointIndexGrid.tree();
658 typename PointDataTreeT::Ptr treePtr(
new PointDataTreeT(pointIndexTree));
662 auto descriptor = AttributeSet::Descriptor::create(positionType);
666 if (positionDefaultValue) descriptor->setDefaultValue(
"P", *positionDefaultValue);
670 const size_t positionIndex = descriptor->find(
"P");
671 assert(positionIndex != AttributeSet::INVALID_POS);
679 LeafManagerT leafManager(*treePtr);
681 [&](LeafT& leaf,
size_t ) {
685 const auto* pointIndexLeaf = pointIndexTree.probeConstLeaf(leaf.origin());
686 assert(pointIndexLeaf);
690 Index pointCount(static_cast<Index>(pointIndexLeaf->indices().size()));
691 leaf.initializeAttributes(descriptor,
pointCount, &lock);
696 leaf.attributeArray(positionIndex));
701 *begin = static_cast<PointIndexT*>(
nullptr),
702 *end = static_cast<PointIndexT*>(
nullptr);
706 for (
auto iter = pointIndexLeaf->cbeginValueOn(); iter; ++iter) {
710 const Coord& ijk = iter.getCoord();
715 pointIndexLeaf->getIndices(ijk, begin, end);
717 while (begin < end) {
719 typename PositionArrayT::value_type positionWorldSpace;
720 positions.getPos(*begin, positionWorldSpace);
725 const Vec3f positionVoxelSpace(positionIndexSpace - positionCellCenter);
727 attributeWriteHandle->set(index++, positionVoxelSpace);
735 auto grid = PointDataGridT::create(treePtr);
736 grid->setTransform(xform.
copy());
744 template <
typename CompressionT,
typename Po
intDataGr
idT,
typename ValueT>
745 inline typename PointDataGridT::Ptr
753 return createPointDataGrid<CompressionT, PointDataGridT>(*pointIndexGrid, pointList, xform, positionDefaultValue);
760 template <
typename Po
intDataTreeT,
typename Po
intIndexTreeT,
typename Po
intArrayT>
764 const bool insertMetadata)
767 using ValueType =
typename PointArrayT::value_type;
769 auto iter = tree.cbeginLeaf();
773 const size_t index = iter->attributeSet().find(attributeName);
775 if (index == AttributeSet::INVALID_POS) {
779 if (insertMetadata) {
787 PopulateAttributeOp<PointDataTreeT,
789 PointArrayT> populate(pointIndexTree, data, index, stride);
790 tbb::parallel_for(leafManager.
leafRange(), populate);
797 template <
typename PositionAttribute,
typename Po
intDataGr
idT,
typename FilterT>
800 const PointDataGridT& grid,
803 const FilterT& filter,
804 const bool inCoreOnly)
806 using TreeType =
typename PointDataGridT::TreeType;
811 const TreeType& tree = grid.tree();
812 auto iter = tree.cbeginLeaf();
816 const size_t positionIndex = iter->attributeSet().find(
"P");
818 positionAttribute.expand();
819 LeafManagerT leafManager(tree);
820 ConvertPointDataGridPositionOp<TreeType, PositionAttribute, FilterT> convert(
821 positionAttribute,
pointOffsets, startOffset, grid.transform(), positionIndex,
823 tbb::parallel_for(leafManager.leafRange(), convert);
824 positionAttribute.compact();
831 template <
typename TypedAttribute,
typename Po
intDataTreeT,
typename FilterT>
834 const PointDataTreeT& tree,
837 const unsigned arrayIndex,
839 const FilterT& filter,
840 const bool inCoreOnly)
846 auto iter = tree.cbeginLeaf();
851 LeafManagerT leafManager(tree);
852 ConvertPointDataGridAttributeOp<PointDataTreeT, TypedAttribute, FilterT> convert(
853 attribute,
pointOffsets, startOffset, arrayIndex, stride,
855 tbb::parallel_for(leafManager.leafRange(), convert);
863 template <
typename Group,
typename Po
intDataTreeT,
typename FilterT>
866 const PointDataTreeT& tree,
869 const AttributeSet::Descriptor::GroupIndex index,
870 const FilterT& filter,
871 const bool inCoreOnly)
877 auto iter = tree.cbeginLeaf();
880 LeafManagerT leafManager(tree);
881 ConvertPointDataGridGroupOp<PointDataTree, Group, FilterT> convert(
884 tbb::parallel_for(leafManager.leafRange(), convert);
891 template<
typename PositionWrapper,
typename InterrupterT>
894 const uint32_t pointsPerVoxel,
896 const Index decimalPlaces,
897 InterrupterT*
const interrupter)
899 using namespace point_conversion_internal;
903 static bool voxelSizeFromVolume(
const double volume,
904 const size_t estimatedVoxelCount,
908 static const double minimumVoxelVolume(3e-15);
911 double voxelVolume = volume / static_cast<double>(estimatedVoxelCount);
914 if (voxelVolume < minimumVoxelVolume) {
915 voxelVolume = minimumVoxelVolume;
918 else if (voxelVolume > maximumVoxelVolume) {
919 voxelVolume = maximumVoxelVolume;
923 voxelSize = static_cast<float>(
math::Pow(voxelVolume, 1.0/3.0));
927 static float truncate(
const float voxelSize,
Index decPlaces)
929 float truncatedVoxelSize = voxelSize;
932 for (
int i = decPlaces; i < 11; i++) {
933 truncatedVoxelSize = static_cast<float>(
math::Truncate(
double(voxelSize), i));
934 if (truncatedVoxelSize != 0.0f)
break;
937 return truncatedVoxelSize;
945 float voxelSize(0.1f);
947 const size_t numPoints = positions.size();
951 if (numPoints <= 1)
return voxelSize;
953 size_t targetVoxelCount(numPoints /
size_t(pointsPerVoxel));
954 if (targetVoxelCount == 0) targetVoxelCount++;
959 inverseTransform =
math::unit(inverseTransform);
961 tbb::blocked_range<size_t> range(0, numPoints);
962 CalculatePositionBounds<PositionWrapper>
calculateBounds(positions, inverseTransform);
969 if (bbox.
min() == bbox.
max())
return voxelSize;
971 double volume = bbox.
volume();
979 volume = extents[0]*extents[0]*extents[0];
983 volume = extents[0]*extents[1]*extents[1];
987 double previousVolume = volume;
989 if (!Local::voxelSizeFromVolume(volume, targetVoxelCount, voxelSize)) {
994 size_t previousVoxelCount(0);
995 size_t voxelCount(1);
997 if (interrupter) interrupter->start(
"Computing voxel size");
999 while (voxelCount > previousVoxelCount)
1010 newTransform = math::Transform::createLinearTransform(matrix);
1014 newTransform = math::Transform::createLinearTransform(voxelSize);
1022 mask->setTransform(newTransform);
1028 previousVoxelCount = voxelCount;
1029 voxelCount = mask->activeVoxelCount();
1030 volume =
math::Pow3(voxelSize) * static_cast<float>(voxelCount);
1034 if (volume >= previousVolume)
break;
1035 previousVolume = volume;
1037 const float previousVoxelSize = voxelSize;
1041 if (!Local::voxelSizeFromVolume(volume, targetVoxelCount, voxelSize)) {
1042 voxelSize = previousVoxelSize;
1049 if (voxelSize / previousVoxelSize > 0.9f)
break;
1052 if (interrupter) interrupter->end();
1056 return Local::truncate(voxelSize, decimalPlaces);
1066 template <
typename PositionAttribute,
typename Po
intDataGr
idT>
1070 const PointDataGridT& grid,
1073 const std::vector<Name>& includeGroups,
1074 const std::vector<Name>& excludeGroups,
1075 const bool inCoreOnly =
false)
1077 auto leaf = grid.tree().cbeginLeaf();
1079 MultiGroupFilter filter(includeGroups, excludeGroups, leaf->attributeSet());
1081 filter, inCoreOnly);
1085 template <
typename TypedAttribute,
typename Po
intDataTreeT>
1089 const PointDataTreeT& tree,
1092 const unsigned arrayIndex,
1094 const std::vector<Name>& includeGroups,
1095 const std::vector<Name>& excludeGroups,
1096 const bool inCoreOnly =
false)
1098 auto leaf = tree.cbeginLeaf();
1100 MultiGroupFilter filter(includeGroups, excludeGroups, leaf->attributeSet());
1102 arrayIndex, stride, filter, inCoreOnly);
1106 template <
typename Group,
typename Po
intDataTreeT>
1110 const PointDataTreeT& tree,
1113 const AttributeSet::Descriptor::GroupIndex index,
1114 const std::vector<Name>& includeGroups,
1115 const std::vector<Name>& excludeGroups,
1116 const bool inCoreOnly =
false)
1118 auto leaf = tree.cbeginLeaf();
1120 MultiGroupFilter filter(includeGroups, excludeGroups, leaf->attributeSet());
1122 index, filter, inCoreOnly);
1130 #endif // OPENVDB_POINTS_POINT_CONVERSION_HAS_BEEN_INCLUDED ValueType get(Index n, Index m=0) const
Definition: AttributeArray.h:2217
typename PointIndexTreeType::LeafNodeType PointIndexLeafNode
Definition: PointConversion.h:288
void getPos(size_t n, ValueType &xyz) const
Definition: PointConversion.h:229
typename ConversionTraits< ValueType >::Handle SourceHandleT
Definition: PointConversion.h:432
Typed class for storing attribute data.
Definition: AttributeArray.h:608
void join(const CalculatePositionBounds &other)
Definition: PointConversion.h:620
const GroupIndex mIndex
Definition: PointConversion.h:589
void convert(IterT &iter, HandleT &targetHandle, SourceHandleT &sourceHandle, Index64 &offset) const
Definition: PointConversion.h:376
OPENVDB_DEPRECATED void convertPointDataGridGroup(Group &group, const PointDataTreeT &tree, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const AttributeSet::Descriptor::GroupIndex index, const std::vector< Name > &includeGroups, const std::vector< Name > &excludeGroups, const bool inCoreOnly=false)
Definition: PointConversion.h:1109
typename LeafManagerT::LeafRange LeafRangeT
Definition: PointConversion.h:352
Space-partitioning acceleration structure for points. Partitions the points into voxels to accelerate...
OPENVDB_API void calculateBounds(const Transform &t, const Vec3d &minWS, const Vec3d &maxWS, Vec3d &minIS, Vec3d &maxIS)
Calculate an axis-aligned bounding box in index space from an axis-aligned bounding box in world spac...
#define OPENVDB_LOG_DEBUG(message)
In debug builds only, log a debugging message of the form 'someVar << "text" << .....
Definition: logging.h:290
typename LeafManagerT::LeafRange LeafRangeT
Definition: PointConversion.h:519
ValueType get(Index n) const
Return the value at index n.
Definition: AttributeArray.h:1441
Definition: PointConversion.h:246
Definition: IndexFilter.h:164
const std::vector< Index64 > & mPointOffsets
Definition: PointConversion.h:587
#define OPENVDB_THROW(exception, message)
Definition: Exceptions.h:109
const std::vector< Index64 > & mPointOffsets
Definition: PointConversion.h:417
const Index64 mStartOffset
Definition: PointConversion.h:588
typename tree::LeafManager< const PointDataTreeType > LeafManagerT
Definition: PointConversion.h:351
const Vec3T & max() const
Return a const reference to the maximum point of this bounding box.
Definition: BBox.h:91
Signed (x, y, z) 32-bit integer coordinates.
Definition: Coord.h:52
std::shared_ptr< Handle > Ptr
Definition: AttributeArray.h:948
math::BBox< Vec3d > BBoxd
Definition: Types.h:91
Vec3< T > sorted() const
Return a vector with the components of this in ascending order.
Definition: Vec3.h:475
Definition: PointConversion.h:595
Group & mGroup
Definition: PointConversion.h:586
Index32 Index
Definition: Types.h:61
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: PointConversion.h:762
CalculatePositionBounds(const CalculatePositionBounds &other, tbb::split)
Definition: PointConversion.h:604
MatType unit(const MatType &mat, typename MatType::value_type eps=1.0e-8)
Return a copy of the given matrix with its upper 3×3 rows normalized.
Definition: Mat.h:680
PointDataGridT::Ptr createPointDataGrid(const std::vector< ValueT > &positions, const math::Transform &xform, Metadata::Ptr positionDefaultValue=Metadata::Ptr())
Convenience method to create a PointDataGrid from a std::vector of point positions.
Definition: PointConversion.h:746
std::shared_ptr< Handle > Ptr
Definition: AttributeArray.h:877
Attribute & mAttribute
Definition: PointConversion.h:416
Write-able version of AttributeHandle.
Definition: AttributeArray.h:944
OPENVDB_DEPRECATED void convertPointDataGridPosition(PositionAttribute &positionAttribute, const PointDataGridT &grid, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const std::vector< Name > &includeGroups, const std::vector< Name > &excludeGroups, const bool inCoreOnly=false)
Definition: PointConversion.h:1069
Mat4< double > Mat4d
Definition: Mat4.h:1361
ConvertPointDataGridPositionOp(Attribute &attribute, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const math::Transform &transform, const size_t index, const FilterT &filter, const bool inCoreOnly)
Definition: PointConversion.h:354
bool isIdentity(const MatType &m)
Determine if a matrix is an identity matrix.
Definition: Mat.h:892
const Index64 mStartOffset
Definition: PointConversion.h:418
Vec3< double > Vec3d
Definition: Vec3.h:689
Point attribute manipulation in a VDB Point Grid.
const Index64 mStartOffset
Definition: PointConversion.h:506
Point group manipulation in a VDB Point Grid.
Definition: AttributeArrayString.h:136
typename PointDataTreeType::LeafNodeType LeafNode
Definition: PointConversion.h:347
Index filters primarily designed to be used with a FilterIndexIter.
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: PointConversion.h:893
AttributeSet::Descriptor::GroupIndex GroupIndex
Definition: PointConversion.h:517
Vec2< T > maxComponent(const Vec2< T > &v1, const Vec2< T > &v2)
Return component-wise maximum of the two vectors.
Definition: Vec2.h:539
ConvertPointDataGridGroupOp(Group &group, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const AttributeSet::Descriptor::GroupIndex index, const FilterT &filter, const bool inCoreOnly)
Definition: PointConversion.h:521
static Handle::Ptr handleFromLeaf(LeafT &leaf, Index index)
Definition: PointConversion.h:252
Type Truncate(Type x, unsigned int digits)
Return x truncated to the given number of decimal digits.
Definition: Math.h:844
void operator()(const typename LeafManagerT::LeafRange &range) const
Definition: PointConversion.h:302
double Real
Definition: Types.h:67
typename PointDataTreeType::LeafNodeType LeafNode
Definition: PointConversion.h:429
const size_t mIndex
Definition: PointConversion.h:507
std::pair< Name, Name > NamePair
Definition: AttributeArray.h:65
void operator()(const tbb::blocked_range< size_t > &range)
Definition: PointConversion.h:610
std::shared_ptr< StringAttributeWriteHandle > Ptr
Definition: AttributeArrayString.h:171
Type Pow3(Type x)
Return x3.
Definition: Math.h:526
#define OPENVDB_VERSION_NAME
The version namespace name for this library version.
Definition: version.h:128
typename LeafManagerT::LeafRange LeafRangeT
Definition: PointConversion.h:287
bool isApproxZero(const Type &x)
Return true if x is equal to zero to within the default floating-point comparison tolerance.
Definition: Math.h:320
void operator()(const LeafRangeT &range) const
Definition: PointConversion.h:387
const FilterT & mFilter
Definition: PointConversion.h:421
std::string Name
Definition: Name.h:44
PopulateAttributeOp(const PointIndexTreeType &pointIndexTree, const AttributeListType &data, const size_t index, const Index stride=1)
Definition: PointConversion.h:293
typename PointDataTreeType::LeafNodeType LeafNode
Definition: PointConversion.h:516
typename LeafManagerT::LeafRange LeafRangeT
Definition: PointConversion.h:434
void preScale(const Vec3< T0 > &v)
Definition: Mat4.h:782
const bool mInCoreOnly
Definition: PointConversion.h:422
typename PointIndexLeafNode::IndexArray IndexArray
Definition: PointConversion.h:289
const AttributeListType & mData
Definition: PointConversion.h:339
typename tree::LeafManager< const PointDataTreeType > LeafManagerT
Definition: PointConversion.h:433
const math::Transform & mTransform
Definition: PointConversion.h:419
Definition: PointConversion.h:284
const size_t mIndex
Definition: PointConversion.h:420
Definition: Exceptions.h:40
std::shared_ptr< StringAttributeHandle > Ptr
Definition: AttributeArrayString.h:139
Vec3d asVec3d() const
Definition: Coord.h:171
typename AttributeListType::value_type ValueType
Definition: PointConversion.h:290
const FilterT & mFilter
Definition: PointConversion.h:509
typename Attribute::ValueType ValueType
Definition: PointConversion.h:348
const bool mInCoreOnly
Definition: PointConversion.h:591
ValueType value_type
Definition: PointConversion.h:221
static WriteHandle::Ptr writeHandleFromLeaf(LeafT &leaf, Index index)
Definition: PointConversion.h:274
This tool produces a grid where every voxel that contains a point is active. It employes thread-local...
const FilterT & mFilter
Definition: PointConversion.h:590
Point-partitioner compatible STL vector attribute wrapper for convenience.
Definition: PointConversion.h:218
Vec3T extents() const
Return the extents of this bounding box, i.e., the length along each axis.
Definition: BBox.h:280
uint64_t Index64
Definition: Types.h:60
const size_t mIndex
Definition: PointConversion.h:340
typename Attribute::Handle HandleT
Definition: PointConversion.h:349
PointAttributeVector(const std::vector< value_type > &data, const Index stride=1)
Definition: PointConversion.h:223
Definition: AttributeArray.h:873
SharedPtr< Grid > Ptr
Definition: Grid.h:596
const Index mStride
Definition: PointConversion.h:508
Vec3< T > reversed() const
Return the vector (z, y, x)
Definition: Vec3.h:485
Index64 pointCount(const PointDataTreeT &tree, const FilterT &filter=NullFilter(), const bool inCoreOnly=false, const bool threaded=true)
Count the total number of points in a PointDataTree.
Definition: PointCount.h:115
typename tree::LeafManager< PointDataTreeType > LeafManagerT
Definition: PointConversion.h:286
Definition: AttributeArrayString.h:168
void operator()(const LeafRangeT &range) const
Definition: PointConversion.h:557
This class manages a linear array of pointers to a given tree's leaf nodes, as well as optional auxil...
Definition: LeafManager.h:109
const Vec3T & min() const
Return a const reference to the minimum point of this bounding box.
Definition: BBox.h:89
Definition: PointConversion.h:514
static Handle::Ptr handleFromLeaf(LeafT &leaf, Index index)
Definition: PointConversion.h:268
OPENVDB_DEPRECATED void convertPointDataGridAttribute(TypedAttribute &attribute, const PointDataTreeT &tree, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const unsigned arrayIndex, const Index stride, const std::vector< Name > &includeGroups, const std::vector< Name > &excludeGroups, const bool inCoreOnly=false)
Definition: PointConversion.h:1088
Definition: IndexIterator.h:70
Definition: PointConversion.h:427
typename RootNodeType::LeafNodeType LeafNodeType
Definition: Tree.h:212
LeafRange leafRange(size_t grainsize=1) const
Return a TBB-compatible LeafRange.
Definition: LeafManager.h:385
void get(ValueType &value, size_t n) const
Definition: PointConversion.h:230
const std::vector< Index64 > & mPointOffsets
Definition: PointConversion.h:505
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: PointCount.h:149
Attribute-owned data structure for points. Point attributes are stored in leaf nodes and ordered by v...
typename tree::LeafManager< const PointDataTreeType > LeafManagerT
Definition: PointConversion.h:518
void convert(IterT &iter, HandleT &targetHandle, SourceHandleT &sourceHandle, Index64 &offset) const
Definition: PointConversion.h:452
const bool mInCoreOnly
Definition: PointConversion.h:510
typename ConversionTraits< ValueType >::WriteHandle HandleT
Definition: PointConversion.h:291
Definition: AttributeArray.h:145
Vec2< T > minComponent(const Vec2< T > &v1, const Vec2< T > &v2)
Return component-wise minimum of the two vectors.
Definition: Vec2.h:530
Attribute array storage for string data using Descriptor Metadata.
Mat4 inverse(T tolerance=0) const
Definition: Mat4.h:531
Definition: Exceptions.h:92
bool isGroup(const AttributeArray &array)
Definition: AttributeGroup.h:93
size_t size() const
Definition: PointConversion.h:228
#define OPENVDB_USE_VERSION_NAMESPACE
Definition: version.h:180
const Index mStride
Definition: PointConversion.h:341
void operator()(const LeafRangeT &range) const
Definition: PointConversion.h:475
Definition: Exceptions.h:86
typename Attribute::Handle HandleT
Definition: PointConversion.h:431
bool isUniform() const override
Return true if this array is stored as a single uniform value.
Definition: AttributeArray.h:746
typename Attribute::ValueType ValueType
Definition: PointConversion.h:430
static openvdb::Name zero()
Definition: PointConversion.h:266
Attribute & mAttribute
Definition: PointConversion.h:504
const PointIndexTreeType & mPointIndexTree
Definition: PointConversion.h:338
Base class for storing attribute data.
Definition: AttributeArray.h:118
static T zero()
Definition: PointConversion.h:250
ElementType volume() const
Return the volume enclosed by this bounding box.
Definition: BBox.h:127
Set of Attribute Arrays which tracks metadata about each array.
std::vector< Index > IndexArray
Definition: PointMove.h:188
void convert(IterT &iter, const GroupAttributeArray &groupArray, Index64 &offset) const
Definition: PointConversion.h:535
CalculatePositionBounds(const PositionArrayT &positions, const math::Mat4d &inverse)
Definition: PointConversion.h:597
Vec3< typename MatType::value_type > getScale(const MatType &mat)
Return a Vec3 representing the lengths of the passed matrix's upper 3×3's rows.
Definition: Mat.h:665
Type Pow(Type x, int n)
Return xn.
Definition: Math.h:535
static WriteHandle::Ptr writeHandleFromLeaf(LeafT &leaf, Index index)
Definition: PointConversion.h:257
ConvertPointDataGridAttributeOp(Attribute &attribute, const std::vector< Index64 > &pointOffsets, const Index64 startOffset, const size_t index, const Index stride, const FilterT &filter, const bool inCoreOnly)
Definition: PointConversion.h:436
ValueType PosType
Definition: PointConversion.h:220
BBoxd getBoundingBox() const
Definition: PointConversion.h:625
Definition: PointConversion.h:345
void get(ValueType &value, size_t n, openvdb::Index m) const
Definition: PointConversion.h:231
bool wasInterrupted(T *i, int percent=-1)
Definition: NullInterrupter.h:76