Struct nalgebra::DVec2 [] [src]

pub struct DVec2<N> {
    // some fields omitted
}

Stack-allocated, dynamically sized vector with a maximum size of 2.

Methods

impl<N> DVec2<N>
[src]

fn len(&self) -> usize

impl<N: Zero + Copy + Clone> DVec2<N>
[src]

fn new_zeros(dim: usize) -> DVec2<N>

Builds a vector filled with zeros.

Arguments

  • dim - The dimension of the vector.

fn is_zero(&self) -> bool

Tests if all components of the vector are zeroes.

impl<N> DVec2<N>
[src]

fn as_slice<'a>(&'a self) -> &'a [N]

Slices this vector.

fn as_mut_slice<'a>(&'a mut self) -> &'a mut [N]

Mutably slices this vector.

impl<N: One + Zero + Copy + Clone> DVec2<N>
[src]

fn new_ones(dim: usize) -> DVec2<N>

Builds a vector filled with ones.

Arguments

  • dim - The dimension of the vector.

impl<N: Rand + Zero> DVec2<N>
[src]

fn new_random(dim: usize) -> DVec2<N>

Builds a vector filled with random values.

impl<N: BaseFloat + ApproxEq<N>> DVec2<N>
[src]

fn canonical_basis_with_dim(dim: usize) -> Vec<DVec2<N>>

Computes the canonical basis for the given dimension. A canonical basis is a set of vectors, mutually orthogonal, with all its component equal to 0.0 except one which is equal to 1.0.

fn orthogonal_subspace_basis(&self) -> Vec<DVec2<N>>

Computes a basis of the space orthogonal to the vector. If the input vector is of dimension n, this will return n - 1 vectors.

impl<N: Copy + Zero> DVec2<N>
[src]

fn from_elem(dim: usize, elem: N) -> DVec2<N>

Builds a vector filled with a constant.

impl<N: Copy + Zero> DVec2<N>
[src]

fn from_slice(dim: usize, vec: &[N]) -> DVec2<N>

Builds a vector filled with the components provided by a vector.

The vector must have at least dim elements.

impl<N: Zero> DVec2<N>
[src]

fn from_fn<F: FnMut(usize) -> N>(dim: usize, f: F) -> DVec2<N>

Builds a vector filled with the result of a function.

Trait Implementations

impl<N: PartialEq> PartialEq for DVec2<N>
[src]

fn eq(&self, other: &DVec2<N>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Rhs) -> bool
1.0.0

This method tests for !=.

impl<N: Clone> Clone for DVec2<N>
[src]

fn clone(&self) -> DVec2<N>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<N> Shape<usize> for DVec2<N>
[src]

fn shape(&self) -> usize

Returns the shape of an indexable object.

impl<N: Copy> Indexable<usize, N> for DVec2<N>
[src]

fn swap(&mut self, i: usize, j: usize)

Swaps the i-th element of self with its j-th element.

unsafe fn unsafe_at(&self, i: usize) -> N

Reads the i-th element of self. Read more

unsafe fn unsafe_set(&mut self, i: usize, val: N)

Writes to the i-th element of self. Read more

impl<N> Index<usize> for DVec2<N>
[src]

type Output = N

The returned type after indexing

fn index(&self, i: usize) -> &N

The method for the indexing (Foo[Bar]) operation

impl<N> IndexMut<usize> for DVec2<N>
[src]

fn index_mut(&mut self, i: usize) -> &mut N

The method for the indexing (Foo[Bar]) operation

impl<N> Iterable<N> for DVec2<N>
[src]

fn iter<'l>(&'l self) -> Iter<'l, N>

Gets a vector-like read-only iterator.

impl<N> IterableMut<N> for DVec2<N>
[src]

fn iter_mut<'l>(&'l mut self) -> IterMut<'l, N>

Gets a vector-like read-write iterator.

impl<N: Copy + Add<N, Output=N> + Mul<N, Output=N>> Axpy<N> for DVec2<N>
[src]

fn axpy(&mut self, a: &N, x: &DVec2<N>)

Adds $$a * x$$ to self.

impl<N: Copy + Mul<N, Output=N> + Zero> Mul<DVec2<N>> for DVec2<N>
[src]

type Output = DVec2<N>

The resulting type after applying the * operator

fn mul(self, right: DVec2<N>) -> DVec2<N>

The method for the * operator

impl<N: Copy + Div<N, Output=N> + Zero> Div<DVec2<N>> for DVec2<N>
[src]

type Output = DVec2<N>

The resulting type after applying the / operator

fn div(self, right: DVec2<N>) -> DVec2<N>

The method for the / operator

impl<N: Copy + Add<N, Output=N> + Zero> Add<DVec2<N>> for DVec2<N>
[src]

type Output = DVec2<N>

The resulting type after applying the + operator

fn add(self, right: DVec2<N>) -> DVec2<N>

The method for the + operator

impl<N: Copy + Sub<N, Output=N> + Zero> Sub<DVec2<N>> for DVec2<N>
[src]

type Output = DVec2<N>

The resulting type after applying the - operator

fn sub(self, right: DVec2<N>) -> DVec2<N>

The method for the - operator

impl<N: Neg<Output=N> + Zero + Copy> Neg for DVec2<N>
[src]

type Output = DVec2<N>

The resulting type after applying the - operator

fn neg(self) -> DVec2<N>

The method for the unary - operator

impl<N: BaseNum> Dot<N> for DVec2<N>
[src]

fn dot(&self, other: &DVec2<N>) -> N

Computes the dot (inner) product of two vectors.

impl<N: BaseFloat> Norm<N> for DVec2<N>
[src]

fn sqnorm(&self) -> N

Computes the squared norm of self. Read more

fn normalize(&self) -> DVec2<N>

Gets the normalized version of a copy of v.

fn normalize_mut(&mut self) -> N

Normalizes self.

fn norm(&self) -> N

Computes the norm of self.

impl<N: ApproxEq<N>> ApproxEq<N> for DVec2<N>
[src]

fn approx_epsilon(_: Option<DVec2<N>>) -> N

Default epsilon for approximation.

fn approx_ulps(_: Option<DVec2<N>>) -> u32

Default ULPs for approximation.

fn approx_eq_eps(&self, other: &DVec2<N>, epsilon: &N) -> bool

Tests approximate equality using a custom epsilon.

fn approx_eq_ulps(&self, other: &DVec2<N>, ulps: u32) -> bool

Tests approximate equality using units in the last place (ULPs)

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

Tests approximate equality.

impl<N: Copy + Mul<N, Output=N> + Zero> Mul<N> for DVec2<N>
[src]

type Output = DVec2<N>

The resulting type after applying the * operator

fn mul(self, right: N) -> DVec2<N>

The method for the * operator

impl<N: Copy + Div<N, Output=N> + Zero> Div<N> for DVec2<N>
[src]

type Output = DVec2<N>

The resulting type after applying the / operator

fn div(self, right: N) -> DVec2<N>

The method for the / operator

impl<N: Copy + Add<N, Output=N> + Zero> Add<N> for DVec2<N>
[src]

type Output = DVec2<N>

The resulting type after applying the + operator

fn add(self, right: N) -> DVec2<N>

The method for the + operator

impl<N: Copy + Sub<N, Output=N> + Zero> Sub<N> for DVec2<N>
[src]

type Output = DVec2<N>

The resulting type after applying the - operator

fn sub(self, right: N) -> DVec2<N>

The method for the - operator

impl<N: Zero> FromIterator<N> for DVec2<N>
[src]

fn from_iter<I: IntoIterator<Item=N>>(param: I) -> DVec2<N>

Creates a value from an iterator. Read more