[][src]Trait accelerometer::vector::Vector

pub trait Vector: Copy + Debug + Default + Index<usize> + MulAssign<f32> + PartialEq + Sized + Send + Sync {
    type Component: Copy + Default + Sized + Add<Output = Self::Component> + Sub<Output = Self::Component> + Mul<Output = Self::Component> + Div<Output = Self::Component> + Into<f32>;
    type Axes: ArrayLength<Self::Component>;

    const MAX: Self::Component;

    fn from_iter<I>(iter: I) -> Self
    where
        I: IntoIterator<Item = Self::Component>
;
fn from_floats(slice: &[f32]) -> Self;
fn get(self, index: usize) -> Option<Self::Component>;
fn to_array(self) -> GenericArray<Self::Component, Self::Axes>; fn from_slice(slice: &[Self::Component]) -> Self { ... }
fn mean<I>(vectors: I) -> Self
    where
        I: IntoIterator<Item = Self>
, { ... }
fn iter(&self) -> Iter<Self> { ... }
fn distance(self, other: Self) -> f32 { ... }
fn magnitude(self) -> f32 { ... } }

Vectors of axis-specific component values

Associated Types

type Component: Copy + Default + Sized + Add<Output = Self::Component> + Sub<Output = Self::Component> + Mul<Output = Self::Component> + Div<Output = Self::Component> + Into<f32>

Type representing measured acceleration for a particular axis

type Axes: ArrayLength<Self::Component>

Number of axes

Loading content...

Associated Constants

const MAX: Self::Component

Largest value representable with a vector component

Loading content...

Required methods

fn from_iter<I>(iter: I) -> Self where
    I: IntoIterator<Item = Self::Component>, 

Instantiate a Vector from an iterator over Self::Component values.

Panics of the iterator is not the correct length.

fn from_floats(slice: &[f32]) -> Self

Instantiate a vector from a slice of f32s.

Panics if the slice is not the right size.

fn get(self, index: usize) -> Option<Self::Component>

Get the component value for a particular index

fn to_array(self) -> GenericArray<Self::Component, Self::Axes>

Obtain an array of the vector components

Loading content...

Provided methods

fn from_slice(slice: &[Self::Component]) -> Self

Instantiate a vector from a slice of components.

Panics if the slice is not the right size.

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 

Compute arithmetic mean of the components of an iterator over vectors, returning a vector consisting of the arithmetic means of its components.

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>

Iterate over the components of a vector

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

Compute the distance between two vectors

fn magnitude(self) -> f32

Compute the magnitude of a vector

Loading content...

Implementors

impl Vector for F32x2[src]

type Component = f32

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for F32x3[src]

type Component = f32

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for I16x2[src]

type Component = i16

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for I16x3[src]

type Component = i16

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for I8x2[src]

type Component = i8

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for I8x3[src]

type Component = i8

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for U16x2[src]

type Component = u16

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for U16x3[src]

type Component = u16

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for U8x2[src]

type Component = u8

type Axes = U2

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

impl Vector for U8x3[src]

type Component = u8

type Axes = U3

fn from_slice(slice: &[Self::Component]) -> Self[src]

fn mean<I>(vectors: I) -> Self where
    I: IntoIterator<Item = Self>, 
[src]

Important traits for Iter<'a, V>
fn iter(&self) -> Iter<Self>[src]

fn distance(self, other: Self) -> f32[src]

fn magnitude(self) -> f32[src]

Loading content...