aardvark-platform / aardvark.algodat

Aardvark.Algodat contains advanced geometric and photometric data structures and algorithms. It is part of the open-source Aardvark Platform for visual computing, real-time graphics, and visualization.
https://aardvarkians.com/
GNU Affero General Public License v3.0
34 stars 6 forks source link

node updated with PointSetNode.WithSubNodes() no longer has positions etc. #14

Closed gnufu closed 3 years ago

gnufu commented 3 years ago

When I update the subnodes of a node with

let withUpdatedSubnodes = node.WithSubNodes(updatedSubnodes)

the node withUpdatedSubnodes does not hold the positions, colors, intensities etc. values of node

a workaround working for me is setting those properties afterwards again:

let oldProperties =
   node.Properties
   |> Seq.where (fun kvp -> kvp.Key <> Durable.Octree.NodeId && kvp.Key <> Durable.Octree.SubnodesGuids)
   |> ImmutableDictionary<Durable.Def, Object>.Empty.AddRange

 withUpdatedSubnodes.With(oldProperties).WriteToStore()
stefanmaierhofer commented 3 years ago

This is by design: all node properties (except Cell, BoundingBoxExactGlobal, and PointCountTreeLeafs) are removed, because they would no longer be valid for new subnode data. Implicit recomputation of all these properties would be too expensive, e.g. when generating/merging large octrees, then many intermediate (structural) nodes are generated for which computing LoD data makes no sense and would introduce a very large overhead.

You can use LodExtensions.GenerateLod to explicitely recompute these properties.

stefanmaierhofer commented 3 years ago

additional info: all these properties that are removed depend on subnode data, e.g. are level-of-detail representations. When swapping out subnodes, the previous values no longer make sense.

stefanmaierhofer commented 3 years ago

PointSetNode.WithSubNodes() is mostly used for internal processing/construction of octrees and probably should never have been made public. What is the use case you are trying to solve? @gnufu