Struct ami::Vec2
[−]
[src]
pub struct Vec2 { pub x: f32, pub y: f32, }
2-dimensional vector
Fields
x: f32
X coordinate
y: f32
Y coordinate
Methods
impl Vec2
[src]
pub fn new(x: f32, y: f32) -> Self
[src]
Create a new Vec2
pub fn zero() -> Self
[src]
Create a zero Vec2
pub fn dot(&self, other: Vec2) -> f32
[src]
Calculate the dot product of two Vec2
s
pub fn mag(self) -> f32
[src]
Get the magnitude of a Vec2
pub fn normalize(self) -> Self
[src]
Normalize a Vec2
pub fn dist_sq(self, other: Self) -> f32
[src]
Calculate the distance squared between two Vec2
pub fn dist(self, other: Self) -> f32
[src]
Calculate the distance between two Vec2
pub fn midpoint(self, other: Self) -> Self
[src]
Find the midpoint between two Vec2
pub fn left(self) -> Self
[src]
Create a left-hand perpendicular Vec2
pub fn right(self) -> Self
[src]
Create a right-hand perpendicular Vec2
pub 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).
pub fn lerp(self, other: Self, t: f32) -> Self
[src]
Calculate linear interpolation of two Vec2
pub fn angle(&self, other: Vec2) -> f32
[src]
Calculate angle between 2 Vec2's (on a plane they both lie on)
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]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
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.