Enum line_drawing::VoxelOrigin [−][src]
pub enum VoxelOrigin { Corner, Center, }
Expand description
Whether the center or corner of a voxel is aligned with the “grid”.
If the origin point of your world is at the corner of 8 voxels, use Corner. This is likely the case if you’re using [gfx_voxel]
.
[gfx_voxel]: https://crates.io/crates/piston3d-gfx_voxel
use line_drawing::{VoxelOrigin, WalkVoxels}; let a = (-0.1, -0.1, -0.1); let b = (0.1, 0.1, 0.1); let center_length = WalkVoxels::<f32, i8>::new(a, b, &VoxelOrigin::Center).count(); assert_eq!(center_length, 1); let corner_length = WalkVoxels::<f32, i8>::new(a, b, &VoxelOrigin::Corner).count(); assert_eq!(corner_length, 4);