Struct quicksilver::geom::Vector[][src]

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

A 2D vector with an arbitrary numeric type

Fields

The x coordinate of the vector

The y coordinate of the vector

Methods

impl Vector
[src]

The zero vector

A vector with x = 1f32, y = 0f32

A vector with x = 0f32, y = 1f32

A vector with x = 1f32, y = 1f32

Create a new vector

Convert this vector into an nalgebra Vector2

Convert this vector into an nalgebra Point2

Create a unit vector at a given angle

Get the squared length of the vector (faster than getting the length)

Get the length of the vector

Clamp a vector somewhere between a minimum and a maximum

Get the cross product of a vector

Get the dot product of a vector

Normalize the vector's length from [0, 1]

Get only the X component of the Vector, represented as a vector

Get only the Y component of the Vector, represented as a vector

Get the vector equal to Vector(1 / x, 1 / y)

Multiply the components in the matching places

Get the angle a vector forms with the positive x-axis, counter clockwise

Create a vector with the same angle and the given length

Trait Implementations

impl Copy for Vector
[src]

impl Clone for Vector
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Default for Vector
[src]

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

impl Debug for Vector
[src]

Formats the value using the given formatter. Read more

impl Neg for Vector
[src]

The resulting type after applying the - operator.

Performs the unary - operation.

impl Add for Vector
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl AddAssign for Vector
[src]

Performs the += operation.

impl Sub for Vector
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl SubAssign for Vector
[src]

Performs the -= operation.

impl<T: Scalar> Div<T> for Vector
[src]

The resulting type after applying the / operator.

Performs the / operation.

impl<T: Scalar> DivAssign<T> for Vector
[src]

Performs the /= operation.

impl<T: Scalar> Mul<T> for Vector
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<T: Scalar> MulAssign<T> for Vector
[src]

Performs the *= operation.

impl PartialEq for Vector
[src]

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

This method tests for !=.

impl Eq for Vector
[src]

impl Display for Vector
[src]

Formats the value using the given formatter. Read more

impl Distribution<Vector> for Standard
[src]

Generate a random value of T, using rng as the source of randomness.

Important traits for DistIter<'a, D, R, T>

Create an iterator that generates random values of T, using rng as the source of randomness. Read more

impl Positioned for Vector
[src]

Its center as a vector

The smallest possible rectangle that fully contains the shape

impl From<Vector2<f32>> for Vector
[src]

Performs the conversion.

impl From<Point2<f32>> for Vector
[src]

Performs the conversion.

impl Mul<Vector> for Transform
[src]

Transform a vector

The resulting type after applying the * operator.

Performs the * operation.

Auto Trait Implementations

impl Send for Vector

impl Sync for Vector