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]

[src]

Creates a new unit vector in a specific direction

[src]

Normalises the vector

[src]

Returns the magnitude/length of the vector

[src]

Returns the magnitude/length of the vector squared

[src]

Returns direction the vector is pointing

[src]

Returns direction towards another vector

[src]

Returns the distance betweens two vectors

[src]

Returns the distance betweens two vectors

[src]

Returns true if either component is NaN.

[src]

Returns true if either component is positive or negative infinity.

[src]

Returns true if both components are neither infinite nor NaN.

[src]

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

impl<T> Vector2<T>
[src]

[src]

Returns the normal vector (aka. hat vector) of this vector i.e. a perpendicular vector

Not to be confused with normalise which returns a unit vector

Defined as (-y, x)

[src]

Returns the dot product of two vectors

[src]

Returns the determinant of two vectors

Trait Implementations

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

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

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

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

[src]

Formats the value using the given formatter. Read more

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

[src]

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

[src]

This method tests for !=.

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

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

[src]

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

impl Mul<Vector2<f32>> for f32
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<Vector2<f32>> for f32
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Mul<Vector2<f64>> for f64
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<Vector2<f64>> for f64
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

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

The resulting type after applying the + operator.

[src]

Performs the + operation.

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

The resulting type after applying the - operator.

[src]

Performs the - operation.

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

[src]

Performs the += operation.

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

[src]

Performs the -= operation.

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

[src]

Performs the *= operation.

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

[src]

Performs the /= operation.

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

The resulting type after applying the * operator.

[src]

Performs the * operation.

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

The resulting type after applying the / operator.

[src]

Performs the / operation.

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

The resulting type after applying the - operator.

[src]

Performs the unary - operation.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

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

[src]

Performs the conversion.

Auto Trait Implementations

impl<T> Send for Vector2<T> where
    T: Send

impl<T> Sync for Vector2<T> where
    T: Sync