#traversal #voxel #3d #position #linear-algebra #end #start

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

#874 in Algorithms

Download history 271/week @ 2024-06-21 11/week @ 2024-06-28 10/week @ 2024-07-05 7/week @ 2024-07-26 174/week @ 2024-08-23 16/week @ 2024-08-30 13/week @ 2024-09-13

203 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
~103K SLoC