rust_sc2::distance

Trait Distance

Source
pub trait Distance: Into<Point2> {
    // Provided methods
    fn distance_squared<P: Into<Point2>>(self, other: P) -> f32 { ... }
    fn distance<P: Into<Point2>>(self, other: P) -> f32 { ... }
    fn is_closer<P: Into<Point2>>(self, distance: f32, other: P) -> bool { ... }
    fn is_further<P: Into<Point2>>(self, distance: f32, other: P) -> bool { ... }
}
Expand description

Basic trait for comparing distance.

Provided Methods§

Source

fn distance_squared<P: Into<Point2>>(self, other: P) -> f32

Calculates squared euclidean distance from self to other.

Source

fn distance<P: Into<Point2>>(self, other: P) -> f32

Calculates euclidean distance from self to other.

Source

fn is_closer<P: Into<Point2>>(self, distance: f32, other: P) -> bool

Checks if distance between self and other is less than given distance.

Source

fn is_further<P: Into<Point2>>(self, distance: f32, other: P) -> bool

Checks if distance between self and other is greater than given distance.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T: Into<Point2>> Distance for T