Struct ami::Vec2 [−][src]
2-dimensional vector
Fields
x: f32
X coordinate
y: f32
Y coordinate
Methods
impl Vec2[src]
impl Vec2pub fn new(x: f32, y: f32) -> Self[src]
pub fn new(x: f32, y: f32) -> SelfCreate a new Vec2
pub fn zero() -> Self[src]
pub fn zero() -> SelfCreate a zero Vec2
pub fn dot(&self, other: Vec2) -> f32[src]
pub fn dot(&self, other: Vec2) -> f32Calculate the dot product of two Vec2s
pub fn mag(self) -> f32[src]
pub fn mag(self) -> f32Get the magnitude of a Vec2
pub fn normalize(self) -> Self[src]
pub fn normalize(self) -> SelfNormalize a Vec2
pub fn dist_sq(self, other: Self) -> f32[src]
pub fn dist_sq(self, other: Self) -> f32Calculate the distance squared between two Vec2
pub fn dist(self, other: Self) -> f32[src]
pub fn dist(self, other: Self) -> f32Calculate the distance between two Vec2
pub fn midpoint(self, other: Self) -> Self[src]
pub fn midpoint(self, other: Self) -> SelfFind the midpoint between two Vec2
pub fn left(self) -> Self[src]
pub fn left(self) -> SelfCreate a left-hand perpendicular Vec2
pub fn right(self) -> Self[src]
pub fn right(self) -> SelfCreate a right-hand perpendicular Vec2
pub fn widdershins(self, other: Self) -> bool[src]
pub fn widdershins(self, other: Self) -> boolCalculate 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]
pub fn lerp(self, other: Self, t: f32) -> SelfCalculate linear interpolation of two Vec2
pub fn angle(&self, other: Vec2) -> f32[src]
pub fn angle(&self, other: Vec2) -> f32Calculate angle between 2 Vec2's (on a plane they both lie on)
Trait Implementations
impl Clone for Vec2[src]
impl Clone for Vec2fn clone(&self) -> Vec2[src]
fn clone(&self) -> Vec2Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Copy for Vec2[src]
impl Copy for Vec2impl PartialEq for Vec2[src]
impl PartialEq for Vec2fn eq(&self, other: &Vec2) -> bool[src]
fn eq(&self, other: &Vec2) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Vec2) -> bool[src]
fn ne(&self, other: &Vec2) -> boolThis method tests for !=.
impl Debug for Vec2[src]
impl Debug for Vec2fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Add for Vec2[src]
impl Add for Vec2type Output = Self
The resulting type after applying the + operator.
fn add(self, other: Self) -> Self[src]
fn add(self, other: Self) -> SelfPerforms the + operation.
impl Sub for Vec2[src]
impl Sub for Vec2type Output = Self
The resulting type after applying the - operator.
fn sub(self, other: Self) -> Self[src]
fn sub(self, other: Self) -> SelfPerforms the - operation.
impl Mul<f32> for Vec2[src]
impl Mul<f32> for Vec2type Output = Self
The resulting type after applying the * operator.
fn mul(self, s: f32) -> Self[src]
fn mul(self, s: f32) -> SelfPerforms the * operation.
impl Mul for Vec2[src]
impl Mul for Vec2type Output = f32
The resulting type after applying the * operator.
fn mul(self, other: Self) -> f32[src]
fn mul(self, other: Self) -> f32Calculate the cross product of two Vec2
impl Div<f32> for Vec2[src]
impl Div<f32> for Vec2type Output = Self
The resulting type after applying the / operator.
fn div(self, s: f32) -> Self[src]
fn div(self, s: f32) -> SelfPerforms the / operation.
impl Neg for Vec2[src]
impl Neg for Vec2