openvdb icon indicating copy to clipboard operation
openvdb copied to clipboard

[REQUEST] Append points to existing PointDataGrid

Open anja-sheppard opened this issue 1 year ago • 2 comments

Hi everyone--

I'm looking for a way to take an existing PointDataGrid and append points to it. I've considered the following approaches, but so far I haven't figured out a way to make them work:

  • merge two trees: as far as I understand, this is not supported for PointDataTree types
  • use an accessor: I also cannot find any documentation/examples on how to do this, but the idea would be to use setValue to replace the PointDataLeafNode with an updated version, but I cannot discern from the documentation how to create a new leaf node and populate it with new data

For more context, I'm looking to take in multiple scans from a lidar at each timestep into one merged grid. I have some specific things I need to do to properly merge the attributes for each point, which I am thinking I can either do as the points are merged together or during the pruning process. However, I cannot figure out how to append points to an existing PointDataGrid.

I'm hoping that @danrbailey would potentially help with this, as I see that he is the author for the PointDataGrid.h file. Thank you!

anja-sheppard avatar Sep 26 '24 19:09 anja-sheppard

Hi @anja-sheppard,

Unfortunately this is not super straightforward - it's something that should've been added to the library a while ago but unfortunately was tabled. I have a very very old implementation that I proposed ~6 years ago~ 9 years ago (wow) - it might no longer compile but will serve as a good starting point to demonstrate how to achieve what you're after:

https://github.com/Idclip/openvdb/blob/pointmerge/openvdb/openvdb/points/PointMerge.h

One day we'll get this is in...

Idclip avatar Apr 03 '25 08:04 Idclip

And for full context, a forum thread from the last time this was requested: https://groups.google.com/g/openvdb-forum/c/bQySLGmRE0I

Idclip avatar Apr 03 '25 08:04 Idclip