[][src]Type Definition olc_pixel_game_engine::Vi2d

type Vi2d = V2d<i32>;

Mirror of olc::vi2d. A 2D integer vector type. Implements std::ops::Add, std::ops::Sub, std::ops::Mul, and std::ops::Div as well as all their assignment equivalents.

Example usage:

let mut a = Vi2d::new(1, 2) + Vi2d { x: 3, y: 4 };
a *= (2i32, 2i32).into();
assert_eq!(a, Vi2d::new(8, 12));

Implementations

impl Vi2d[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.