Trait geomath::prelude::Metric[][src]

pub trait Metric where
    Self: Copy
{ fn dot(&self, other: &Self) -> f64;
fn distance2(&self, other: &Self) -> f64;
fn distance(&self, other: &Self) -> f64;
fn magnitude2(&self) -> f64;
fn magnitude(&self) -> f64;
fn set_normalized(&mut self) -> &mut Self; fn normalized(&self) -> Self { ... } }
Expand description

Operations between objects of a metric space

A metric space is considered as a space where it exists a norm based on dot product. It can be the metric operations between two vectors or matrices such as the distance or the magnitude.

Note : For matrices and vectors you can also use operators : % for distance, | for dot product, ! for magnitude

Required methods

Dot product of the two objects

Squared distance between the two objects

Distance between the two objects

Squared magnitude of an object

Magnitude of an object

Normalizes the vector, ie. sets magnitude to 1 without changing direction

Provided methods

Get the normalized vector, ie. vector with same direction and magnitude 1

Implementors