[][src]Enum line_drawing::VoxelOrigin

[]
pub enum VoxelOrigin {
    Corner,
    Center,
}
[]

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

impl VoxelOrigin[src][]

pub fn round<I: FloatNum, O: SignedNum>(&self, voxel: Voxel<I>) -> Voxel<O>[src][]

Round a voxel's position based on the origin.

Auto Trait Implementations

impl RefUnwindSafe for VoxelOrigin

impl Send for VoxelOrigin

impl Sync for VoxelOrigin

impl Unpin for VoxelOrigin

impl UnwindSafe for VoxelOrigin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src][+]

impl<T> Borrow<T> for T where
    T: ?Sized
[src][+]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src][+]

impl<T> From<T> for T[src][+]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src][+]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src][+]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src][+]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.