[][src]Struct olc_pixel_game_engine::V2d

#[repr(C)]pub struct V2d<T> {
    pub x: T,
    pub y: T,
}

Generic 2D vector type. See Vf2d and Vi2d for more information.

Don't use this generic struct directly. Prefer using Vf2d (alias for V2d<f32>) and Vi2d (alias for V2d<i32>) instead. This struct is only exported to show available functions and implemented traits.

Fields

x: Ty: T

Implementations

impl<T> V2d<T>[src]

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

Creates new V2d struct.

impl V2d<i32>[src]

pub fn mag(&self) -> i32[src]

Returns magnitude (or length) of a vector.

pub fn mag2(&self) -> i32[src]

Returns magnitude squared.

pub fn norm(&self) -> Self[src]

Returns vector norm.

pub fn perp(&self) -> Self[src]

Returns perpendicular vector.

pub fn dot(&self, rhs: Vi2d) -> i32[src]

Returns dot product of two vectors.

pub fn cross(&self, rhs: Vi2d) -> i32[src]

Returns cross product of two vectors.

impl V2d<f32>[src]

pub fn mag(&self) -> f32[src]

Returns magnitude (or length) of a vector.

pub fn mag2(&self) -> f32[src]

Returns magnitude squared.

pub fn norm(&self) -> Self[src]

Returns vector norm.

pub fn perp(&self) -> Self[src]

Returns perpendicular vector.

pub fn dot(&self, rhs: Vf2d) -> f32[src]

Returns dot product of two vectors.

pub fn cross(&self, rhs: Vf2d) -> f32[src]

Returns cross product of two vectors.

Trait Implementations

impl<T: Add<Output = T>> Add<V2d<T>> for V2d<T>[src]

type Output = Self

The resulting type after applying the + operator.

impl<T: AddAssign> AddAssign<V2d<T>> for V2d<T>[src]

impl<T: Clone> Clone for V2d<T>[src]

impl<T: Copy> Copy for V2d<T>[src]

impl<T: Debug> Debug for V2d<T>[src]

impl<T: Default> Default for V2d<T>[src]

impl<T: Display + Debug> Display for V2d<T>[src]

impl<T: Div<Output = T>> Div<V2d<T>> for V2d<T>[src]

type Output = Self

The resulting type after applying the / operator.

impl<T: DivAssign> DivAssign<V2d<T>> for V2d<T>[src]

impl<T> From<(T, T)> for V2d<T>[src]

impl<T: Mul<Output = T>> Mul<V2d<T>> for V2d<T>[src]

type Output = Self

The resulting type after applying the * operator.

impl<T: MulAssign> MulAssign<V2d<T>> for V2d<T>[src]

impl<T: PartialEq> PartialEq<V2d<T>> for V2d<T>[src]

impl<T> StructuralPartialEq for V2d<T>[src]

impl<T: Sub<Output = T>> Sub<V2d<T>> for V2d<T>[src]

type Output = Self

The resulting type after applying the - operator.

impl<T: SubAssign> SubAssign<V2d<T>> for V2d<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for V2d<T> where
    T: RefUnwindSafe

impl<T> Send for V2d<T> where
    T: Send

impl<T> Sync for V2d<T> where
    T: Sync

impl<T> Unpin for V2d<T> where
    T: Unpin

impl<T> UnwindSafe for V2d<T> where
    T: UnwindSafe

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> ToString for T where
    T: Display + ?Sized
[src]

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.