Struct mathf::vector2::Vector2 [] [src]

pub struct Vector2 {
    pub x: f32,
    pub y: f32,
}

A 2D Vector with x and y coordinates: Vector2

Fields

Methods

impl Vector2
[src]

Instantiates a new vector with to be defined values of x and y;

Instantiates a new Vector2 from 2 Point2 (initial position, final position). The new vector is created as final - initial (Points)

Defines a Vector with UP direction (y=1, x=0)

Defines a Vector with DOWN direction (y=-1, x=0)

Defines a Vector with RIGHT direction (y=0, x=1)

Defines a Vector with LEFT direction (y=0, x=-1)

Defines a 2D Vector with x=1 and y=1

Defines a Modulus ZERO Vector (x=0, y=0)

Vector magnitude: the square root of the sum of each vector part to the power of 2

Trait Implementations

impl Clone for Vector2
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Vector2
[src]

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

This method tests for !=.

impl Debug for Vector2
[src]

Formats the value using the given formatter.

impl Add for Vector2
[src]

The resulting type after applying the + operator

Implements the Vector2 '+' trait

impl Mul<f32> for Vector2
[src]

The resulting type after applying the * operator

Implements the scalar multiplication of a Vector2 with a f32. Other numbers should be passed with 'i as f32'

impl Mul<Vector2> for Vector2
[src]

The resulting type after applying the * operator

Implements the dot product of 2 Vector2 as '*'.

impl Sub for Vector2
[src]

The resulting type after applying the - operator

Implements the Vector2 '-' trait