Struct collider::geom::Vec2 [] [src]

pub struct Vec2 {
    pub x: f64,
    pub y: f64,
}

A 2-D Cartesian vector using finite f64 values.

Fields

The x-coordinate.

The y-coordinate.

Methods

impl Vec2
[src]

[src]

Constructs a vector with the given x and y coordinates.

[src]

Constructs a (0, 0) vector.

[src]

Computes the square of the Euclidean length of the vector.

Due to underflow, this might be 0.0 even if x and y are non-zero but very small.

[src]

Computes the the Euclidean length of the vector.

Due to underflow, this might be 0.0 even if x and y are non-zero but very small.

[src]

Returns a vector in the same direction as self but with length (approximately) 1.0, or None if self.len() == 0.0.

[src]

Computes the square of the Euclidean distance between two vectors.

[src]

Computes the Euclidean distance between two vectors.

[src]

Linearly interpolates between self and other.

Using ratio = 0.0 will return self, and using ratio = 1.0 will return other. Can also extrapolate using ratio > 1.0 or ratio < 0.0.

[src]

Rotates the vector by angle radians counter-clockwise (assuming +x is right and +y is up).

Trait Implementations

impl PartialEq for Vec2
[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 Copy for Vec2
[src]

impl Clone for Vec2
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Vec2
[src]

[src]

Formats the value using the given formatter. Read more

impl Default for Vec2
[src]

[src]

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

impl Mul<Vec2> for f64
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Mul<f64> for Vec2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl MulAssign<f64> for Vec2
[src]

[src]

Performs the *= operation.

impl Mul<Vec2> for Vec2
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Add for Vec2
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl AddAssign for Vec2
[src]

[src]

Performs the += operation.

impl Sub for Vec2
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl SubAssign for Vec2
[src]

[src]

Performs the -= operation.

impl Neg for Vec2
[src]

The resulting type after applying the - operator.

[src]

Performs the unary - operation.

impl From<Card> for Vec2
[src]

[src]

Performs the conversion.

impl From<DirVec2> for Vec2
[src]

[src]

Performs the conversion.

impl From<Vec2> for HbVel
[src]

[src]

Performs the conversion.

Auto Trait Implementations

impl Send for Vec2

impl Sync for Vec2