Enum bracket_terminal::prelude::DistanceAlg
source · [−]pub enum DistanceAlg {
Pythagoras,
PythagorasSquared,
Manhattan,
Chebyshev,
Diagonal,
}
Expand description
Enumeration of available 2D Distance algorithms
Variants
Pythagoras
Use the Pythagoras algorithm for determining distance - sqrt(A^2 + B^2)
PythagorasSquared
Us the Pythagoras algorithm for distance, but omitting the square-root for a faster but squared result.
Manhattan
Use Manhattan distance (distance up plus distance along)
Chebyshev
Use Chebyshev distance (like Manhattan, but adds one to each entry)
Diagonal
Use a diagonal distance, the max of the x and y distances
Implementations
sourceimpl DistanceAlg
impl DistanceAlg
sourcepub fn distance2d(self, start: Point, end: Point) -> f32
pub fn distance2d(self, start: Point, end: Point) -> f32
Provides a 2D distance between points, using the specified algorithm.
sourcepub fn distance3d(self, start: Point3, end: Point3) -> f32
pub fn distance3d(self, start: Point3, end: Point3) -> f32
Provides a 3D distance between points, using the specified algorithm.
Trait Implementations
sourceimpl Clone for DistanceAlg
impl Clone for DistanceAlg
sourcefn clone(&self) -> DistanceAlg
fn clone(&self) -> DistanceAlg
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreimpl Copy for DistanceAlg
Auto Trait Implementations
impl RefUnwindSafe for DistanceAlg
impl Send for DistanceAlg
impl Sync for DistanceAlg
impl Unpin for DistanceAlg
impl UnwindSafe for DistanceAlg
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more