Trait bracket_lib::algorithm_traits::Algorithm3D
source · [−]pub trait Algorithm3D: BaseMap {
fn point3d_to_index(&self, pt: Point3) -> usize { ... }
fn index_to_point3d(&self, idx: usize) -> Point3 { ... }
fn dimensions(&self) -> Point3 { ... }
fn in_bounds(&self, pos: Point3) -> bool { ... }
}
Expand description
Implement these for handling conversion to/from 2D coordinates (they are separate, because you might want Dwarf Fortress style 3D!)
Provided Methods
sourcefn point3d_to_index(&self, pt: Point3) -> usize
fn point3d_to_index(&self, pt: Point3) -> usize
Convert a Point (x/y) to an array index. Defaults to a Z, Y, X striding.
sourcefn index_to_point3d(&self, idx: usize) -> Point3
fn index_to_point3d(&self, idx: usize) -> Point3
Convert an array index to a point.
sourcefn dimensions(&self) -> Point3
fn dimensions(&self) -> Point3
Dimensions