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§
Source§impl 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§
Source§impl Clone for DistanceAlg
impl Clone for DistanceAlg
Source§fn clone(&self) -> DistanceAlg
fn clone(&self) -> DistanceAlg
Returns a copy of the value. Read more
1.0.0 · Source§fn 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 Freeze for DistanceAlg
impl RefUnwindSafe for DistanceAlg
impl Send for DistanceAlg
impl Sync for DistanceAlg
impl Unpin for DistanceAlg
impl UnwindSafe for DistanceAlg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more