Skip to main content

Vector

Trait Vector 

Source
pub trait Vector<const N: usize>:
    Sized
    + Copy
    + Clone {
Show 22 methods // Required methods fn get(&self, i: usize) -> f32; fn set(&mut self, i: usize, v: f32); fn add_self(&self, other: &Self) -> Self; fn sub_self(&self, other: &Self) -> Self; fn div_self(&self, other: &Self) -> Self; fn mul_self(&self, other: &Self) -> Self; fn scale(&self, s: f32) -> Self; fn less_than(&self, other: &Self) -> bool; fn greater_than(&self, other: &Self) -> bool; fn cmin(&self, other: Self) -> Self; fn cmax(&self, other: Self) -> Self; fn mid_point(&self, other: Self) -> Self; fn dot_self(&self, other: &Self) -> f32; fn cprod(&self) -> f32; fn cmap<F: Fn(f32) -> f32>(&self, f: F) -> Self; fn cmap_mut<F: FnMut(f32) -> f32>(&self, f: F) -> Self; fn min_elem(&self) -> f32; fn max_elem(&self) -> f32; fn to_arr(&self) -> [f32; N]; fn from_arr(a: [f32; N]) -> Self; fn normalized(&self) -> Self; fn mag(&self) -> f32;
}

Required Methods§

Source

fn get(&self, i: usize) -> f32

Source

fn set(&mut self, i: usize, v: f32)

Source

fn add_self(&self, other: &Self) -> Self

Source

fn sub_self(&self, other: &Self) -> Self

Source

fn div_self(&self, other: &Self) -> Self

Source

fn mul_self(&self, other: &Self) -> Self

Source

fn scale(&self, s: f32) -> Self

Source

fn less_than(&self, other: &Self) -> bool

Source

fn greater_than(&self, other: &Self) -> bool

Source

fn cmin(&self, other: Self) -> Self

Source

fn cmax(&self, other: Self) -> Self

Source

fn mid_point(&self, other: Self) -> Self

Source

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

Source

fn cprod(&self) -> f32

Source

fn cmap<F: Fn(f32) -> f32>(&self, f: F) -> Self

Source

fn cmap_mut<F: FnMut(f32) -> f32>(&self, f: F) -> Self

Source

fn min_elem(&self) -> f32

Source

fn max_elem(&self) -> f32

Source

fn to_arr(&self) -> [f32; N]

Source

fn from_arr(a: [f32; N]) -> Self

Source

fn normalized(&self) -> Self

Source

fn mag(&self) -> f32

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Vector<2> for Vec2

Source§

fn add_self(&self, other: &Self) -> Self

Source§

fn sub_self(&self, other: &Self) -> Self

Source§

fn mul_self(&self, other: &Self) -> Self

Source§

fn div_self(&self, other: &Self) -> Self

Source§

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

Source§

fn scale(&self, s: f32) -> Self

Source§

fn less_than(&self, other: &Self) -> bool

Source§

fn greater_than(&self, other: &Self) -> bool

Source§

fn cmin(&self, other: Self) -> Self

Source§

fn cmax(&self, other: Self) -> Self

Source§

fn mid_point(&self, other: Self) -> Self

Source§

fn cprod(&self) -> f32

Source§

fn cmap<F: Fn(f32) -> f32>(&self, f: F) -> Self

Source§

fn cmap_mut<F: FnMut(f32) -> f32>(&self, f: F) -> Self

Source§

fn min_elem(&self) -> f32

Source§

fn max_elem(&self) -> f32

Source§

fn to_arr(&self) -> [f32; 2]

Source§

fn from_arr(a: [f32; 2]) -> Self

Source§

fn normalized(&self) -> Self

Source§

fn get(&self, i: usize) -> f32

Source§

fn set(&mut self, i: usize, v: f32)

Source§

fn mag(&self) -> f32

Source§

impl Vector<3> for Vec3

Source§

fn add_self(&self, other: &Self) -> Self

Source§

fn sub_self(&self, other: &Self) -> Self

Source§

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

Source§

fn mul_self(&self, other: &Self) -> Self

Source§

fn div_self(&self, other: &Self) -> Self

Source§

fn scale(&self, s: f32) -> Self

Source§

fn less_than(&self, other: &Self) -> bool

Source§

fn greater_than(&self, other: &Self) -> bool

Source§

fn cmin(&self, other: Self) -> Self

Source§

fn cmax(&self, other: Self) -> Self

Source§

fn mid_point(&self, other: Self) -> Self

Source§

fn cprod(&self) -> f32

Source§

fn cmap<F: Fn(f32) -> f32>(&self, f: F) -> Self

Source§

fn cmap_mut<F: FnMut(f32) -> f32>(&self, f: F) -> Self

Source§

fn min_elem(&self) -> f32

Source§

fn max_elem(&self) -> f32

Source§

fn to_arr(&self) -> [f32; 3]

Source§

fn from_arr(a: [f32; 3]) -> Self

Source§

fn normalized(&self) -> Self

Source§

fn get(&self, i: usize) -> f32

Source§

fn set(&mut self, i: usize, v: f32)

Source§

fn mag(&self) -> f32

Source§

impl Vector<3> for Vec3A

Source§

fn add_self(&self, other: &Self) -> Self

Source§

fn sub_self(&self, other: &Self) -> Self

Source§

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

Source§

fn mul_self(&self, other: &Self) -> Self

Source§

fn div_self(&self, other: &Self) -> Self

Source§

fn scale(&self, s: f32) -> Self

Source§

fn less_than(&self, other: &Self) -> bool

Source§

fn greater_than(&self, other: &Self) -> bool

Source§

fn cmin(&self, other: Self) -> Self

Source§

fn cmax(&self, other: Self) -> Self

Source§

fn mid_point(&self, other: Self) -> Self

Source§

fn cprod(&self) -> f32

Source§

fn cmap<F: Fn(f32) -> f32>(&self, f: F) -> Self

Source§

fn cmap_mut<F: FnMut(f32) -> f32>(&self, f: F) -> Self

Source§

fn min_elem(&self) -> f32

Source§

fn max_elem(&self) -> f32

Source§

fn to_arr(&self) -> [f32; 3]

Source§

fn from_arr(a: [f32; 3]) -> Self

Source§

fn normalized(&self) -> Self

Source§

fn get(&self, i: usize) -> f32

Source§

fn set(&mut self, i: usize, v: f32)

Source§

fn mag(&self) -> f32

Source§

impl<const N: usize> Vector<N> for [f32; N]

Source§

fn add_self(&self, other: &Self) -> Self

Source§

fn sub_self(&self, other: &Self) -> Self

Source§

fn mul_self(&self, other: &Self) -> Self

Source§

fn div_self(&self, other: &Self) -> Self

Source§

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

Source§

fn scale(&self, s: f32) -> Self

Source§

fn less_than(&self, other: &Self) -> bool

Source§

fn greater_than(&self, other: &Self) -> bool

Source§

fn cmin(&self, other: Self) -> Self

Source§

fn cmax(&self, other: Self) -> Self

Source§

fn mid_point(&self, other: Self) -> Self

Source§

fn cprod(&self) -> f32

Source§

fn cmap<F: Fn(f32) -> f32>(&self, f: F) -> Self

Source§

fn cmap_mut<F: FnMut(f32) -> f32>(&self, f: F) -> Self

Source§

fn min_elem(&self) -> f32

Source§

fn max_elem(&self) -> f32

Source§

fn to_arr(&self) -> [f32; N]

Source§

fn from_arr(a: [f32; N]) -> Self

Source§

fn normalized(&self) -> Self

Source§

fn get(&self, i: usize) -> f32

Source§

fn set(&mut self, i: usize, v: f32)

Source§

fn mag(&self) -> f32

Implementors§