Skip to main content

EuclideanDistance

Trait EuclideanDistance 

Source
pub trait EuclideanDistance: Sized {
    // Required method
    fn distance_squared(&self, other: &Self) -> f32;

    // Provided method
    fn distance(&self, other: &Self) -> f32 { ... }
}
Expand description

Calculate the distance between this and another color as if they were coordinates in a Euclidean space. Alpha is not considered in the distance calculation.

Required Methods§

Source

fn distance_squared(&self, other: &Self) -> f32

Distance squared from self to other.

Provided Methods§

Source

fn distance(&self, other: &Self) -> f32

Distance from self to other.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§