[][src]Struct ezcgmath::vector::Vector2

#[repr(C)]pub struct Vector2 {
    pub x: Scalar,
    pub y: Scalar,
}

A 2-dimensional vector

Fields

x: Scalary: Scalar

Implementations

impl Vector2[src]

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

Creates a new instance of a Vector4 with values (x, y).

pub const fn unit_x() -> Self[src]

Returns a vector of (1.0, 0.0, 0.0).

pub const fn unit_y() -> Self[src]

Returns a vector of (0.0, 1.0).

pub fn dot(&self, rhs: &Vector2) -> Scalar[src]

Returns the dot product of the vector with the vector 'rhs'.

pub fn length(&mut self) -> Scalar[src]

The length of the vector.

pub fn normalize(&mut self)[src]

Normalizes the vector to a length of one.

Trait Implementations

impl AbsDiffEq<Vector2> for Vector2[src]

type Epsilon = Scalar

Used for specifying relative comparisons.

impl Add<Vector2> for Vector2[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<Vector2> for Vector2[src]

impl Clone for Vector2[src]

impl Copy for Vector2[src]

impl Debug for Vector2[src]

impl Default for Vector2[src]

impl Div<f32> for Vector2[src]

type Output = Self

The resulting type after applying the / operator.

impl DivAssign<f32> for Vector2[src]

impl Mul<f32> for Vector2[src]

type Output = Self

The resulting type after applying the * operator.

impl MulAssign<f32> for Vector2[src]

impl Neg for Vector2[src]

type Output = Self

The resulting type after applying the - operator.

impl PartialEq<Vector2> for Vector2[src]

impl RelativeEq<Vector2> for Vector2[src]

impl StructuralPartialEq for Vector2[src]

impl Sub<Vector2> for Vector2[src]

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<Vector2> for Vector2[src]

impl UlpsEq<Vector2> for Vector2[src]

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.