Oktree
Fast octree implementation.
Mainly usable with Bevy game engine for fast processing of voxel data.
Bevy integration feature if enabled by default and can be disabled by:
[dependencies]
oktree = { version = "0.1.0", default-features = false }
Intersection methods are not available without this feature.
Optimizations:
Unsigned
arithmetics, bitwise operations.- Tree structure is represented by flat, reusable pools. Removed data is marked only.
- Few memory allocations. Heapless structures are used.
- No smart pointers (RC, RefCell e.t.c)
Compensation for the inconvenience is perfomance.
Benchmark
Operation | Quantity | Time |
---|---|---|
insertion | 4096 | 1 ms |
removing | 4096 | 0.3 ms |
ray intersection | 4096 | 9 ms |
Run benchmark:
cargo bench
Example
You have to specify the type for the internal tree structure.
It must be any Unsigned
type (u8
, u16
, u32
, u64
, u128
or usize
).
Implement Position
for the handled type, so that it can return it's spatial coordinates.
use ;
use *;
Run bevy visual example:
cargo run --release --example bevy_tree