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

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

#15 in #traversal

44 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