Struct nalgebra::Vec2 [] [src]

pub struct Vec2<N> {
    pub x: N,
    pub y: N,
}

Vector of dimension 2.

Fields

x

First component of the vector.

y

Second component of the vector.

Methods

impl<N> Vec2<N>

fn new(x: N, y: N) -> Vec2<N>

Creates a new vector.

impl<N: Zero + One> Vec2<N>

fn x() -> Vec2<N>

Create a unit vector with its $compN component equal to 1.0.

fn y() -> Vec2<N>

Create a unit vector with its $compN component equal to 1.0.

impl<N> Vec2<N>

fn as_array(&self) -> &[N; 2]

View this vector as an array.

fn as_array_mut(&mut self) -> &mut [N; 2]

View this vector as a mutable array.

fn from_array_ref(array: &[N; 2]) -> &Vec2<N>

View an array as a vector.

fn from_array_mut(array: &mut [N; 2]) -> &mut Vec2<N>

View an array as a vector.

impl<N: Copy> Vec2<N>

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

Unsafe read access to a vector element by index.

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

Unsafe write access to a vector element by index.

impl<N> Vec2<N>

fn len(&self) -> usize

impl<N> Vec2<N>

fn to_pnt(self) -> Pnt2<N>

fn as_pnt(&self) -> &Pnt2<N>

Trait Implementations

impl<N: BaseFloat> POrd for Vec2<N>

fn inf(&self, other: &Vec2<N>) -> Vec2<N>

fn sup(&self, other: &Vec2<N>) -> Vec2<N>

fn partial_cmp(&self, other: &Vec2<N>) -> POrdering

fn partial_lt(&self, other: &Vec2<N>) -> bool

fn partial_le(&self, other: &Vec2<N>) -> bool

fn partial_gt(&self, other: &Vec2<N>) -> bool

fn partial_ge(&self, other: &Vec2<N>) -> bool

fn partial_min<'a>(&'a self, other: &'a Self) -> Option<&'a Self>

fn partial_max<'a>(&'a self, other: &'a Self) -> Option<&'a Self>

fn partial_clamp<'a>(&'a self, min: &'a Self, max: &'a Self) -> Option<&'a Self>

impl<Nin: Copy, Nout: Copy + Cast<Nin>> Cast<Vec2<Nin>> for Vec2<Nout>

fn from(v: Vec2<Nin>) -> Vec2<Nout>

impl<N> Index<usize> for Vec2<N>

type Output = N

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

impl<N> IndexMut<usize> for Vec2<N>

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

impl<N> Shape<usize> for Vec2<N>

fn shape(&self) -> usize

impl<N: Copy> Indexable<usize, N> for Vec2<N>

fn swap(&mut self, i1: usize, i2: usize)

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

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

impl<N: Copy> Repeat<N> for Vec2<N>

fn repeat(val: N) -> Vec2<N>

impl<N> Dim for Vec2<N>

fn dim(_: Option<Vec2<N>>) -> usize

impl<N: Add<N, Output=N>> Add<Vec2<N>> for Vec2<N>

type Output = Vec2<N>

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

impl<N: Sub<N, Output=N>> Sub<Vec2<N>> for Vec2<N>

type Output = Vec2<N>

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

impl<N: Copy + Mul<N, Output=N>> Mul<Vec2<N>> for Vec2<N>

type Output = Vec2<N>

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

impl<N: Copy + Div<N, Output=N>> Div<Vec2<N>> for Vec2<N>

type Output = Vec2<N>

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

impl<N: Copy + Add<N, Output=N>> Add<N> for Vec2<N>

type Output = Vec2<N>

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

impl<N: Copy + Sub<N, Output=N>> Sub<N> for Vec2<N>

type Output = Vec2<N>

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

impl<N: Copy + Mul<N, Output=N>> Mul<N> for Vec2<N>

type Output = Vec2<N>

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

impl<N: Copy + Div<N, Output=N>> Div<N> for Vec2<N>

type Output = Vec2<N>

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

impl<N: Neg<Output=N> + Copy> Neg for Vec2<N>

type Output = Vec2<N>

fn neg(self) -> Vec2<N>

impl<N: BaseNum> Dot<N> for Vec2<N>

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

impl<N: Copy + Add<N, Output=N> + Neg<Output=N>> Translation<Vec2<N>> for Vec2<N>

fn translation(&self) -> Vec2<N>

fn inv_translation(&self) -> Vec2<N>

fn append_translation_mut(&mut self, t: &Vec2<N>)

fn append_translation(&self, t: &Vec2<N>) -> Vec2<N>

fn prepend_translation_mut(&mut self, t: &Vec2<N>)

fn prepend_translation(&self, t: &Vec2<N>) -> Vec2<N>

fn set_translation(&mut self, t: Vec2<N>)

impl<N: BaseFloat> Norm<N> for Vec2<N>

fn sqnorm(&self) -> N

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

fn normalize_mut(&mut self) -> N

fn norm(&self) -> N

impl<N: ApproxEq<N>> ApproxEq<N> for Vec2<N>

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

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

fn approx_eq(&self, other: &Vec2<N>) -> bool

fn approx_eq_eps(&self, other: &Vec2<N>, eps: &N) -> bool

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

impl<N> One for Vec2<N> where N: Copy + One + Sub<N, Output=N> + Add<N, Output=N>

fn one() -> Vec2<N>

impl<N: Zero> Zero for Vec2<N>

fn zero() -> Vec2<N>

fn is_zero(&self) -> bool

impl<N> FromIterator<N> for Vec2<N>

fn from_iter<I: IntoIterator<Item=N>>(iterator: I) -> Vec2<N>

impl<N: Bounded> Bounded for Vec2<N>

fn max_value() -> Vec2<N>

fn min_value() -> Vec2<N>

impl<N: Axpy<N>> Axpy<N> for Vec2<N>

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

impl<N> Iterable<N> for Vec2<N>

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

impl<N> IterableMut<N> for Vec2<N>

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

impl<N: Copy + One + Zero> ToHomogeneous<Vec3<N>> for Vec2<N>

fn to_homogeneous(&self) -> Vec3<N>

impl<N: Copy + Div<N, Output=N> + One + Zero> FromHomogeneous<Vec3<N>> for Vec2<N>

fn from(v: &Vec3<N>) -> Vec2<N>

impl<N: Copy + Add<N, Output=N> + Sub<N, Output=N>> Translate<Pnt2<N>> for Vec2<N>

fn translate(&self, other: &Pnt2<N>) -> Pnt2<N>

fn inv_translate(&self, other: &Pnt2<N>) -> Pnt2<N>

impl<N, O: Copy> Rotate<O> for Vec2<N>

fn rotate(&self, other: &O) -> O

fn inv_rotate(&self, other: &O) -> O

impl<N: Copy + Add<N, Output=N> + Sub<N, Output=N>> Transform<Pnt2<N>> for Vec2<N>

fn transform(&self, other: &Pnt2<N>) -> Pnt2<N>

fn inv_transform(&self, other: &Pnt2<N>) -> Pnt2<N>

impl<N> NumVec<N> for Vec2<N> where N: BaseNum

impl<N> FloatVec<N> for Vec2<N> where N: BaseFloat + ApproxEq<N>

impl<N: Absolute<N>> Absolute<Vec2<N>> for Vec2<N>

fn abs(m: &Vec2<N>) -> Vec2<N>

impl<N: Rand> Rand for Vec2<N>

fn rand<R: Rng>(rng: &mut R) -> Vec2<N>

impl<N: Copy + Mul<N, Output=N> + Zero> Outer for Vec2<N>

type OuterProductType = Mat2<N>

fn outer(&self, other: &Vec2<N>) -> Mat2<N>

impl<N: BaseNum> Mul<Rot2<N>> for Vec2<N>

type Output = Vec2<N>

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

Derived Implementations

impl<N: Copy> Copy for Vec2<N>

impl<N: Debug> Debug for Vec2<N>

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl<N: Hash> Hash for Vec2<N>

fn hash<__H: Hasher>(&self, __arg_0: &mut __H)

fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher

impl<N: Clone> Clone for Vec2<N>

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

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

impl<N: Decodable> Decodable for Vec2<N>

fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Vec2<N>, __D::Error>

impl<N: Encodable> Encodable for Vec2<N>

fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>

impl<N: PartialEq> PartialEq for Vec2<N>

fn eq(&self, __arg_0: &Vec2<N>) -> bool

fn ne(&self, __arg_0: &Vec2<N>) -> bool

impl<N: Eq> Eq for Vec2<N>