[][src]Struct some_math_lib::Vector2

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

A 2-dimensional vector.

Fields

x: f64y: f64

Implementations

impl Vector2[src]

pub fn new(x: f64, y: f64) -> Self[src]

Creates a new vector with components x and y.

pub fn squared_magnitude(&self) -> f64[src]

Returns the squared magnitude of the vector.

pub fn magnitude(&self) -> f64[src]

Returns the magnitude of the vector.

pub fn dot_product(&self, rhs: &Self) -> f64[src]

Returns the dot product of self and rhs.

pub fn cross_product_magnitude(&self, rhs: &Self) -> f64[src]

Returns the magnitude of the vector formed by the cross product of self and rhs.

pub fn cross_product(&self, rhs: &Self) -> Vector3[src]

Returns a Vector3 with an x and y of 0.0 and a z of the computed magnitude.

Trait Implementations

impl Add<Vector2> for Vector2[src]

type Output = Self

The resulting type after applying the + operator.

impl Clone for Vector2[src]

impl Copy for Vector2[src]

impl Debug for Vector2[src]

impl Div<f64> for Vector2[src]

type Output = Self

The resulting type after applying the / operator.

impl Mul<f64> for Vector2[src]

type Output = Self

The resulting type after applying the * operator.

impl Sub<Vector2> for Vector2[src]

type Output = Self

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Vector2

impl Send for Vector2

impl Sync for Vector2

impl Unpin for Vector2

impl UnwindSafe for Vector2

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.