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);

Variants

Corner
Center

Implementations

Round a voxel’s position based on the origin.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.