#traversal #voxel #3d #linear-algebra #position #space #glam

voxel-traversal

Traverse through all voxels in a 3d space from a start position to an end position

3 unstable releases

0.2.1 Aug 26, 2024
0.2.0 Jun 23, 2024
0.1.0 Jun 22, 2024

#904 in Algorithms

Download history 158/week @ 2024-08-21 32/week @ 2024-08-28 14/week @ 2024-09-11 11/week @ 2024-09-18 27/week @ 2024-09-25 12/week @ 2024-10-02

213 downloads per month

MIT license

10KB
183 lines

Voxel Traversal Algorithm

This is a rust port of https://github.com/francisengelmann/fast_voxel_traversal.

Example

This crate uses glam for linear algebra.


// f32

voxel_traversal::voxel_traversal(
    start, // Vec3
    end, // Vec3
    |pos, normal| { // IVec3, IVec3
    // return true to exit
    if (pos.x == 0) {
        return true;
    } else {
        // return false to continue traversing
        return false
    }
    }
);

// there is also a DVec3 implementation called voxel_traversal_f64

License

Licensed under MIT LICENSE

Dependencies

~3.5MB
~118K SLoC