Skip to content

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

Description

@bonsairobo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions