Comments (3)
Hi @nyue,
I'm currently working on getting the code samples and documentation ready for submission into OpenVDB, so that should help explain this better. In short, the PointPartitioner is only for use with a PointIndexGrid where the attribute data is stored in a linear external array.
Here's a super-simple example for iterating over position data in a PointDataGrid:
for (auto leafIter = grid.tree().cbeginLeaf(); leafIter; ++leafIter) {
auto handle = openvdb::points::AttributeHandle<Vec3f>::create(leafIter->constAttributeArray("P"));
for (auto iter = leafIter->beginIndexOn(); iter; ++iter) {
const Vec3d voxelCoord = iter.getCoord().asVec3d();
const Vec3d positionVoxelSpace = handle->get(*iter);
const Vec3d positionWorldSpace = grid.transform().indexToWorld(positionVoxelSpace + voxelCoord);
std::cerr << "Position: " << positionWorldSpace << std::endl;
}
}
Hope that helps.
Dan
from openvdb.
Thank you.
In your code
leafIter->constAttributeArray("P")
How do you know there will be an attribute call "P" ?
How does one programmatically find all the other attribute names ?
Cheers
from openvdb.
"P" is a mandatory attribute.
For simple inspection, you can use some of the convenience methods on the PointDataLeaf:
bool test1 = leafIter->hasAttribute("P");
bool test2 = leafIter->hasAttribute(/*index=*/4);
Otherwise, you'll need to go through the Descriptor:
const AttributeSet::Descriptor& descriptor = leafIter->attributeSet().descriptor();
for (const auto& namePos : descriptor.map()) {
const Name& name = namePos.first;
const size_t index = namePos.second;
const Name& valueType = descriptor.valueType(index);
}
Although the API doesn't enforce this, by convention we assume that the Descriptor is the same across all LeafNodes.
from openvdb.
Related Issues (20)
- Will NeuralVDB be supported as part of this project?
- [REQUEST] Primitives for bottom-up traversal of a Tree HOT 2
- Get indices from leaf in nanovdb? HOT 2
- [BUILD] Tests fail with strict-aliasing violations
- [BUILD] Clang-Cl fails to build due to RootNode.h ValueT aliasing
- Encountering Error C2039 in CreateNanoGrid.h When Integrating NanoVDB with Visual Studio 2022[BUILD]
- Clarification on Read-Only Nature of NanoVDB: Scope and Future Possibilities for Writable Features
- [REQUEST] make nanoVDB CUDA async allocation optional so it can be used on vGPU HOT 1
- [BUILD] Build will fail on some 32-bit platforms, since configure does not check for a need for `libatomic` linking
- [BUILD] pyopenvdb install locatiion HOT 1
- [BUILD] Python bindings fail to build for version 3.11 HOT 3
- [BUILD] OpenVDB fails to build with LLVM 18 HOT 1
- [BUILD] OpenVDB fails to build HOT 1
- [REQUEST] Make it possible to have a subset of externally built libraries for Blosc in FindBlosc.cmake
- [BUG] Square/Planar Artifacts While Volume Rendering NVDB Files Using Optix HOT 1
- [BUG] include/openvdb/TypeList.h uses std::tuple_size_v that isn't defined in C++ standards HOT 6
- meshToVolume slowdown? HOT 1
- [REQUEST] Link against specific Boost libraries rather than Boost::headers and Boost::boost
- [BUG] NanoVDB NanoGrid returns incorrect voxel size when initialized from VDB with transform
- [BUG] NanoVDB math::ZeroCrossing with ray producing incorrect results HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openvdb.