Struct footile::Vec2
[−]
[src]
pub struct Vec2 { pub x: f32, pub y: f32, }
2-dimensional vector
Fields
x: f32
y: f32
Methods
impl Vec2
[src]
fn new(x: f32, y: f32) -> Self
[src]
Create a new Vec2
fn zero() -> Self
[src]
Create a zero Vec2
fn mag(self) -> f32
[src]
Get the magnitude of a Vec2
fn normalize(self) -> Self
[src]
Create a copy normalized to unit length
fn dist_sq(self, other: Self) -> f32
[src]
Calculate the distance squared between two Vec2
fn dist(self, other: Self) -> f32
[src]
Calculate the distance between two Vec2
fn midpoint(self, other: Self) -> Self
[src]
Get the midpoint of two Vec2
fn left(self) -> Self
[src]
Create a left-hand perpendicular Vec2
fn right(self) -> Self
[src]
Create a right-hand perpendicular Vec2
fn widdershins(self, other: Self) -> bool
[src]
Calculate winding order for two Vec2.
The Vec2 should be initialized as edges pointing toward the same vertex. Returns true if the winding order is widdershins (counter-clockwise).
fn lerp(self, other: Self, t: f32) -> Self
[src]
Calculate linear interpolation of two Vec2
t
Interpolation amount, from 0 to 1
Trait Implementations
impl Clone for Vec2
[src]
fn clone(&self) -> Vec2
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Vec2
[src]
impl PartialEq for Vec2
[src]
fn eq(&self, __arg_0: &Vec2) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Vec2) -> bool
[src]
This method tests for !=
.
impl Debug for Vec2
[src]
impl Add for Vec2
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self
[src]
Performs the +
operation.
impl Sub for Vec2
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: Self) -> Self
[src]
Performs the -
operation.
impl Mul<f32> for Vec2
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, s: f32) -> Self
[src]
Performs the *
operation.
impl Mul for Vec2
[src]
type Output = f32
The resulting type after applying the *
operator.
fn mul(self, other: Self) -> f32
[src]
Calculate the cross product of two Vec2
impl Div<f32> for Vec2
[src]
type Output = Self
The resulting type after applying the /
operator.
fn div(self, s: f32) -> Self
[src]
Performs the /
operation.