[−][src]Type Definition olc_pixel_game_engine::Vf2d
type Vf2d = V2d<f32>;
Mirror of olc::vf2d
. A 2D float 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 = Vf2d::new(10.0, 20.0) - Vf2d { x: 5.0, y: 5.0 }; a /= (5f32, 5f32).into(); assert_eq!(a, Vf2d::new(1.0, 3.0));
Implementations
impl Vf2d
[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.