Struct nalgebra::Vector2 [] [src]

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

Vector of dimension 2.

The main differance between a point and a vector is that a vector is not affected by translations.

Fields

First component of the vector.

Second component of the vector.

Methods

impl<N: Zero + One> Vector2<N>
[src]

Create the element of the canonical basis having this component set to one and all the others set to zero.

Create the element of the canonical basis having this component set to one and all the others set to zero.

impl<N> Vector2<N>
[src]

Converts this vector to a point.

Reinterprets this vector as a point.

impl<N> Vector2<N>
[src]

Creation from component values.

impl<N: Copy> Vector2<N>
[src]

Unsafe read access to a vector element by index.

Unsafe write access to a vector element by index.

impl<N> Vector2<N>
[src]

The dimension of this entity.

Trait Implementations

impl<N: Copy> Copy for Vector2<N>
[src]

impl<N: Debug> Debug for Vector2<N>
[src]

Formats the value using the given formatter.

impl<N: Hash> Hash for Vector2<N>
[src]

Feeds this value into the state given, updating the hasher as necessary.

Feeds a slice of this type into the state provided.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<N: Decodable> Decodable for Vector2<N>
[src]

impl<N: Encodable> Encodable for Vector2<N>
[src]

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

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

This method tests for !=.

impl<N: Eq> Eq for Vector2<N>
[src]

impl<N: Add<N, Output=N>> Add<Vector2<N>> for Vector2<N>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<N: AddAssign<N>> AddAssign<Vector2<N>> for Vector2<N>
[src]

The method for the += operator

impl<'a, 'b, N> Add<&'a Vector2<N>> for &'b Vector2<N> where &'b N: Add<&'a N, Output=N>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, N> Add<&'a Vector2<N>> for Vector2<N> where N: Add<&'a N, Output=N>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, N> Add<Vector2<N>> for &'a Vector2<N> where &'a N: Add<N, Output=N>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<N: Sub<N, Output=N>> Sub<Vector2<N>> for Vector2<N>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<N: SubAssign<N>> SubAssign<Vector2<N>> for Vector2<N>
[src]

The method for the -= operator

impl<'a, 'b, N> Sub<&'a Vector2<N>> for &'b Vector2<N> where &'b N: Sub<&'a N, Output=N>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, N> Sub<&'a Vector2<N>> for Vector2<N> where N: Sub<&'a N, Output=N>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, N> Sub<Vector2<N>> for &'a Vector2<N> where &'a N: Sub<N, Output=N>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<N: Mul<N, Output=N>> Mul<Vector2<N>> for Vector2<N>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<N: MulAssign<N>> MulAssign<Vector2<N>> for Vector2<N>
[src]

The method for the *= operator

impl<'a, 'b, N> Mul<&'a Vector2<N>> for &'b Vector2<N> where &'b N: Mul<&'a N, Output=N>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, N> Mul<&'a Vector2<N>> for Vector2<N> where N: Mul<&'a N, Output=N>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, N> Mul<Vector2<N>> for &'a Vector2<N> where &'a N: Mul<N, Output=N>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<N: Div<N, Output=N>> Div<Vector2<N>> for Vector2<N>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<N: DivAssign<N>> DivAssign<Vector2<N>> for Vector2<N>
[src]

The method for the /= operator

impl<'a, 'b, N> Div<&'a Vector2<N>> for &'b Vector2<N> where &'b N: Div<&'a N, Output=N>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, N> Div<&'a Vector2<N>> for Vector2<N> where N: Div<&'a N, Output=N>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, N> Div<Vector2<N>> for &'a Vector2<N> where &'a N: Div<N, Output=N>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<N: Zero> Zero for Vector2<N>
[src]

Returns the additive identity element of Self, 0. Read more

Returns true if self is equal to the additive identity.

impl<N: BaseNum> One for Vector2<N>
[src]

Returns the multiplicative identity element of Self, 1. Read more

impl<N: Absolute<N>> Absolute<Vector2<N>> for Vector2<N>
[src]

Computes some absolute value of this object. Typically, this will make all component of a matrix or vector positive. Read more

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

Computes the dot (inner) product of two vectors.

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

The scalar type for the norm (i.e. the undelying field).

Computes the squared norm of self. Read more

Gets the normalized version of a copy of v. Read more

Normalizes self. Read more

Gets the normalized version of a copy of v or None if the vector has a norm smaller or equal to min_norm. In particular, .try_normalize(0.0) returns None if the norm is exactly zero. Read more

Normalized v or does nothing if the vector has a norm smaller or equal to min_norm. Read more

Computes the norm of self.

impl<N: Copy + Add<N, Output=N> + Neg<Output=N>> Translation<Vector2<N>> for Vector2<N>
[src]

Gets the translation associated with this object.

Gets the inverse translation associated with this object.

Appends a translation to this object.

Appends the translation amount to a copy of t.

Prepends a translation to this object.

Prepends the translation amount to a copy of t.

Sets the translation.

impl<N: Copy + Add<N, Output=N> + Sub<N, Output=N>> Translate<Point2<N>> for Vector2<N>
[src]

Apply a translation to an object.

Apply an inverse translation to an object.

impl<N, O: Copy> Rotate<O> for Vector2<N>
[src]

Applies a rotation to v.

Applies an inverse rotation to v.

impl<N: Copy + Add<N, Output=N> + Sub<N, Output=N>> Transform<Point2<N>> for Vector2<N>
[src]

Applies a transformation to v.

Applies an inverse transformation to v.

impl<N> NumVector<N> for Vector2<N> where N: BaseNum
[src]

impl<N> FloatVector<N> for Vector2<N> where N: BaseFloat
[src]

impl<N: BaseFloat + Cast<f64>> Mean<N> for Vector2<N>
[src]

Computes the mean of the observations stored by v. Read more

impl<N: Display> Display for Vector2<N>
[src]

Formats the value using the given formatter.

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

The resulting type after applying the - operator

The method for the unary - operator

impl<'a, N> Neg for &'a Vector2<N> where &'a N: Neg<Output=N>
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<N: Copy> Repeat<N> for Vector2<N>
[src]

Returns a value with filled by val.

impl<N: Rand> Rand for Vector2<N>
[src]

Generates a random instance of this type using the specified source of randomness. Read more

impl<N: Copy + AddAssign<N>> AddAssign<N> for Vector2<N>
[src]

The method for the += operator

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

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, N> Add<&'a N> for &'b Vector2<N> where &'b N: Add<&'a N, Output=N>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, N> Add<N> for &'a Vector2<N> where &'a N: Add<&'b N, Output=N>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, N> Add<&'a N> for Vector2<N> where N: Add<&'a N, Output=N>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<N: Copy + SubAssign<N>> SubAssign<N> for Vector2<N>
[src]

The method for the -= operator

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

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, N> Sub<&'a N> for &'b Vector2<N> where &'b N: Sub<&'a N, Output=N>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, N> Sub<N> for &'a Vector2<N> where &'a N: Sub<&'b N, Output=N>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, N> Sub<&'a N> for Vector2<N> where N: Sub<&'a N, Output=N>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<N: Copy + MulAssign<N>> MulAssign<N> for Vector2<N>
[src]

The method for the *= operator

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

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, N> Mul<&'a N> for &'b Vector2<N> where &'b N: Mul<&'a N, Output=N>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, N> Mul<N> for &'a Vector2<N> where &'a N: Mul<&'b N, Output=N>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, N> Mul<&'a N> for Vector2<N> where N: Mul<&'a N, Output=N>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<N: Copy + DivAssign<N>> DivAssign<N> for Vector2<N>
[src]

The method for the /= operator

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

The resulting type after applying the / operator

The method for the / operator

impl<'a, 'b, N> Div<&'a N> for &'b Vector2<N> where &'b N: Div<&'a N, Output=N>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, N> Div<N> for &'a Vector2<N> where &'a N: Div<&'b N, Output=N>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, N> Div<&'a N> for Vector2<N> where N: Div<&'a N, Output=N>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<N: BaseFloat> PartialOrder for Vector2<N>
[src]

Returns the infimum of this value and another

Returns the supremum of this value and another

Compare self and other using a partial ordering relation.

Returns true iff self and other are comparable and self < other.

Returns true iff self and other are comparable and self <= other.

Returns true iff self and other are comparable and self > other.

Returns true iff self and other are comparable and self >= other.

Return the minimum of self and other if they are comparable.

Return the maximum of self and other if they are comparable.

Clamp value between min and max. Returns None if value is not comparable to min or max. Read more

impl<Nin: Copy, Nout: Copy + Cast<Nin>> Cast<Vector2<Nin>> for Vector2<Nout>
[src]

Converts an element of type T to an element of type Self.

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

Default epsilon for approximation.

Default ULPs for approximation.

Tests approximate equality.

Tests approximate equality using a custom epsilon.

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

impl<N: Axpy<N>> Axpy<N> for Vector2<N>
[src]

Adds $$a * x$$ to self.

impl<N: Bounded> Bounded for Vector2<N>
[src]

The maximum value.

The minimum value.

impl<N> AsRef<[N; 2]> for Vector2<N>
[src]

Performs the conversion.

impl<N> AsMut<[N; 2]> for Vector2<N>
[src]

Performs the conversion.

impl<'a, N> From<&'a [N; 2]> for &'a Vector2<N>
[src]

Performs the conversion.

impl<'a, N> From<&'a mut [N; 2]> for &'a mut Vector2<N>
[src]

Performs the conversion.

impl<'a, N: Clone> From<&'a [N; 2]> for Vector2<N>
[src]

Performs the conversion.

impl<N> Dimension for Vector2<N>
[src]

The dimension of the object.

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

Returns the shape of an indexable object.

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

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

Reads the i-th element of self. Read more

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

impl<N, T> Index<T> for Vector2<N> where [N]: Index<T>
[src]

The returned type after indexing

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

impl<N, T> IndexMut<T> for Vector2<N> where [N]: IndexMut<T>
[src]

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

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

Gets a vector-like read-only iterator.

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

Gets a vector-like read-write iterator.

impl<N> FromIterator<N> for Vector2<N>
[src]

Creates a value from an iterator. Read more

impl<N: Copy + One + Zero> ToHomogeneous<Vector3<N>> for Vector2<N>
[src]

Gets the homogeneous coordinates form of this object.

impl<N: Copy + Div<N, Output=N> + One + Zero> FromHomogeneous<Vector3<N>> for Vector2<N>
[src]

Builds an object from its homogeneous coordinate form. Read more

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

Result type of the outer product.

Computes the outer product: a * b

impl<N: BaseNum> Mul<Rotation2<N>> for Vector2<N>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<N: Copy + BaseNum> MulAssign<Rotation2<N>> for Vector2<N>
[src]

The method for the *= operator

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

The resulting type after applying the * operator

The method for the * operator

impl<N: Copy + Mul<N, Output=N> + Add<N, Output=N>> MulAssign<Matrix2<N>> for Vector2<N>
[src]

The method for the *= operator

impl<N: BaseFloat> RotationTo for Vector2<N>
[src]

Type of the angle between two elements.

Type of the rotation between two elements.

Computes an angle nedded to transform the first element to the second one using a rotation. Read more

Computes the smallest rotation needed to transform the first element to the second one.

impl<N: Copy + Mul<N, Output=N> + Sub<N, Output=N>> Cross for Vector2<N>
[src]

The cross product output.

Computes the cross product between two elements (usually vectors).

impl<N: Neg<Output=N> + Copy> CrossMatrix<Vector2<N>> for Vector2<N>
[src]

The matrix associated to any cross product with this vector. I.e. v.cross(anything) = v.cross_matrix().rmul(anything). Read more

impl<N: Copy> Row<Vector1<N>> for Vector2<N>
[src]

The number of column of self.

Reads the i-th row of self.

Writes the i-th row of self.

impl<N: Copy + One + Zero + Neg<Output=N>> Basis for Vector2<N>
[src]

Iterates through the canonical basis of the space in which this object lives.

Iterates through a basis of the subspace orthogonal to self.

Gets the ith element of the canonical basis.

impl<N: Cast<f64> + Copy> UniformSphereSample for Vector2<N>
[src]

Iterate through the samples.