rust-cv / space

Spatial library for Rust
MIT License
39 stars 4 forks source link

Create custom region ranges for octrees #5

Closed vadixidav closed 4 years ago

vadixidav commented 6 years ago

Sometimes it is necessary to iterate over a chunk of an octree. This is similar to Range which allows iteration over a slice (e.g., 5..9). Such a region in an octree should be allowed to span across a 3d cross section at any particular level of the octree. This means that there will be three ranges, each of which is across one of three dimensions, and each range will be comprised of two mortons. Because level is like a fourth dimension in the octree data structure, it is also necessary to specify the level range of the octree to perform the iteration over.

This would allow iterating over sections of internal nodes that contain data or leaves in a particular range. Octrees that have pointers to neighboring nodes in them can also make the time complexity of such iteration O(n) rather than O(n*log(n)) for an iteration over a single level of the octree.