Struct rusty_sword_arena::game::Vector2[][src]

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

2D Vector (x, y) that can represent coordinates in OpenGL space that fill your window, or velocity, or whatever other two f32 values you need. The OpenGL window is (-1.0, -1.0) in the bottom left to (1.0, 1.0) in the top right.

Fields

Methods

impl Vector2
[src]

New Vector2D at (0.0, 0.0)

Create a random Vector2D with x and y both in [-dimension, dimension]

Calculate the distance between two Vector2's -- useful when they represent coordinates

Calculate the angle between two Vector2's -- useful when they represent coordinates

Calculate the magnitude of the Vector2 -- useful when it represents a vector (such as velocity)

Create a new Vector2D, normalized to be of unit length (length 1).

Create a new Vector2D that is clamped to a magnitude of 1.0

Create a new Vector2D clamped to magnitude

Trait Implementations

impl Copy for Vector2
[src]

impl Clone for Vector2
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Debug for Vector2
[src]

Formats the value using the given formatter. 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 PartialOrd for Vector2
[src]

Do docs for trait impls show up???

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Add for Vector2
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl Mul<f32> for Vector2
[src]

The resulting type after applying the * operator.

Performs the * operation.

Auto Trait Implementations

impl Send for Vector2

impl Sync for Vector2