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

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 { ... } }

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

fn dot(&self, other: &Self) -> f64

Dot product of the two objects

fn distance2(&self, other: &Self) -> f64

Squared distance between the two objects

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

Distance between the two objects

fn magnitude2(&self) -> f64

Squared magnitude of an object

fn magnitude(&self) -> f64

Magnitude of an object

fn set_normalized(&mut self) -> &mut Self

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

Loading content...

Provided methods

fn normalized(&self) -> Self

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

Loading content...

Implementors

impl Metric for Matrix2[src]

impl Metric for Matrix3[src]

impl Metric for Matrix4[src]

impl Metric for Vector2[src]

impl Metric for Vector3[src]

impl Metric for Vector4[src]

impl Metric for Vector6[src]

impl<T> Metric for Point<T> where
    T: Metric + Copy + Clone + AddAssign<T> + SubAssign<T>, 
[src]

Loading content...