Struct simple_vector2d::Vector2 [] [src]

pub struct Vector2<T>(pub T, pub T);

Representation of a mathematical vector e.g. a position or velocity

Methods

impl<T: Float> Vector2<T>
[src]

Creates a new unit vector in a specific direction

Normalises the vector

Returns the magnitude/length of the vector

Returns the magnitude/length of the vector squared

Returns direction the vector is pointing

Returns direction towards another vector

Returns the distance betweens two vectors

Returns the distance betweens two vectors

Returns true if either component is NaN.

Returns true if either component is positive or negative infinity.

Returns true if both components are neither infinite nor NaN.

Returns true if both components are neither zero, infinite, subnormal nor NaN.

impl<T> Vector2<T>
[src]

Returns the dot product of two vectors

Trait Implementations

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

Formats the value using the given formatter.

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

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

This method tests for !=.

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

impl<T: Default> Default for Vector2<T>
[src]

Returns the "default value" for a type. Read more

impl<T: Add> Add for Vector2<T>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<T: Sub> Sub for Vector2<T>
[src]

The resulting type after applying the - operator

The method for the - operator

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

The method for the += operator

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

The method for the -= operator

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

The method for the *= operator

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

The method for the /= operator

impl<T: Mul + Copy> Mul<T> for Vector2<T>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<T: Div + Copy> Div<T> for Vector2<T>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<T: Neg> Neg for Vector2<T>
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<T> Into<[T; 2]> for Vector2<T>
[src]

Performs the conversion.

impl<T: Copy> From<[T; 2]> for Vector2<T>
[src]

Performs the conversion.

impl<T> Into<(T, T)> for Vector2<T>
[src]

Performs the conversion.

impl<T> From<(T, T)> for Vector2<T>
[src]

Performs the conversion.