dimforge / dimforge/ncollide

BVH trait definition is hard to implement when bounding volumes are generated on demand

Open
#363 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
926
Forks
104
PR merge metrics
No merged PRs in 30d

Description

My use case is that I have a voxel octree which needs to be very memory efficient. So I can't store an AABB for every single voxel. That's 6 floats, i.e. 24 bytes per voxel.

Rather, voxel presence is encoded in bitsets, and the efficiency is such that a single voxel can be stored in far less than 1 bit per voxel.

So the issue is that when I tried to `impl BVH` for this octree, I could not implement `fn content(&self, node: Self::Node) -> (&BV, Option<&T>)` because it returns a reference to a bounding volume. I could easily generate an `AABB` for a given voxel, but it would not live long enough to return a reference. The only hack I can think of is to keep an `AABB` temporary variable on `self` that gets unsafely mutated to overcome `&self`, but that may be unsound depending on the code that's using this structure.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.