Struct ami::Vec2 [−][src]
Single-precision 2D vector.
Fields
x: f32
y: f32
Methods
impl Vec2
[src]
impl Vec2
pub fn new(x: f32, y: f32) -> Vec2
[src]
pub fn new(x: f32, y: f32) -> Vec2
Full constructor.
pub fn zero() -> Vec2
[src]
pub fn zero() -> Vec2
Zero constructor.
impl Vec2
[src]
impl Vec2
pub fn dot(self, rhs: Vec2) -> f32
[src]
pub fn dot(self, rhs: Vec2) -> f32
Returns the dot product of two vectors.
pub fn length(self) -> f32
[src]
pub fn length(self) -> f32
Returns the length (magnitude) of the vector.
pub fn squared_length(self) -> f32
[src]
pub fn squared_length(self) -> f32
Returns the squared length of the vector.
pub fn normalize(self) -> Vec2
[src]
pub fn normalize(self) -> Vec2
impl Vec2
[src]
impl Vec2
Trait Implementations
impl Into<[f32; 2]> for Vec2
[src]
impl Into<[f32; 2]> for Vec2
impl ApproxEq for Vec2
[src]
impl ApproxEq for Vec2
type Epsilon = <Vector2<f32> as ApproxEq>::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> <Vec2 as ApproxEq>::Epsilon
[src]
fn default_epsilon() -> <Vec2 as ApproxEq>::Epsilon
The default tolerance to use when testing values that are close together. Read more
fn default_max_relative() -> <Vec2 as ApproxEq>::Epsilon
[src]
fn default_max_relative() -> <Vec2 as ApproxEq>::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
fn default_max_ulps() -> u32
[src]
fn default_max_ulps() -> u32
The default ULPs to tolerate when testing values that are far-apart. Read more
fn relative_eq(
&self,
other: &Vec2,
epsilon: <Vec2 as ApproxEq>::Epsilon,
max_relative: <Vec2 as ApproxEq>::Epsilon
) -> bool
[src]
fn relative_eq(
&self,
other: &Vec2,
epsilon: <Vec2 as ApproxEq>::Epsilon,
max_relative: <Vec2 as ApproxEq>::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
fn ulps_eq(
&self,
other: &Vec2,
epsilon: <Vec2 as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
[src]
fn ulps_eq(
&self,
other: &Vec2,
epsilon: <Vec2 as ApproxEq>::Epsilon,
max_ulps: u32
) -> bool
A test for equality that uses units in the last place (ULP) if the values are far apart.
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
The inverse of ApproxEq::relative_eq
.
fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
The inverse of ApproxEq::ulps_eq
.
impl Add<Vec2> for Vec2
[src]
impl Add<Vec2> for Vec2
type Output = Vec2
The resulting type after applying the +
operator.
fn add(self, rhs: Vec2) -> <Vec2 as Add<Vec2>>::Output
[src]
fn add(self, rhs: Vec2) -> <Vec2 as Add<Vec2>>::Output
Performs the +
operation.
impl Sub<Vec2> for Vec2
[src]
impl Sub<Vec2> for Vec2
type Output = Vec2
The resulting type after applying the -
operator.
fn sub(self, rhs: Vec2) -> <Vec2 as Sub<Vec2>>::Output
[src]
fn sub(self, rhs: Vec2) -> <Vec2 as Sub<Vec2>>::Output
Performs the -
operation.
impl Display for Vec2
[src]
impl Display for Vec2
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Clone for Vec2
[src]
impl Clone for Vec2
fn clone(&self) -> Vec2
[src]
fn clone(&self) -> Vec2
Returns 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 MulAssign<f32> for Vec2
[src]
impl MulAssign<f32> for Vec2
fn mul_assign(&mut self, rhs: f32)
[src]
fn mul_assign(&mut self, rhs: f32)
Performs the *=
operation.
impl Default for Vec2
[src]
impl Default for Vec2
impl Debug for Vec2
[src]
impl Debug for Vec2
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl SubAssign<Vec2> for Vec2
[src]
impl SubAssign<Vec2> for Vec2
fn sub_assign(&mut self, rhs: Vec2)
[src]
fn sub_assign(&mut self, rhs: Vec2)
Performs the -=
operation.
impl Mul<Vec2> for f32
[src]
impl Mul<Vec2> for f32
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, arg: Vec2) -> <f32 as Mul<Vec2>>::Output
[src]
fn mul(self, arg: Vec2) -> <f32 as Mul<Vec2>>::Output
Performs the *
operation.
impl Mul<Vec2> for Mat2
[src]
impl Mul<Vec2> for Mat2
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec2) -> <Mat2 as Mul<Vec2>>::Output
[src]
fn mul(self, rhs: Vec2) -> <Mat2 as Mul<Vec2>>::Output
Performs the *
operation.
impl Mul<f32> for Vec2
[src]
impl Mul<f32> for Vec2
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, arg: f32) -> <Vec2 as Mul<f32>>::Output
[src]
fn mul(self, arg: f32) -> <Vec2 as Mul<f32>>::Output
Performs the *
operation.
impl<'a> Mul<Vec2> for &'a Mat2
[src]
impl<'a> Mul<Vec2> for &'a Mat2
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec2) -> <&'a Mat2 as Mul<Vec2>>::Output
[src]
fn mul(self, rhs: Vec2) -> <&'a Mat2 as Mul<Vec2>>::Output
Performs the *
operation.
impl DivAssign<f32> for Vec2
[src]
impl DivAssign<f32> for Vec2
fn div_assign(&mut self, rhs: f32)
[src]
fn div_assign(&mut self, rhs: f32)
Performs the /=
operation.
impl Copy for Vec2
[src]
impl Copy for Vec2
impl AsRef<[f32; 2]> for Vec2
[src]
impl AsRef<[f32; 2]> for Vec2
impl PartialEq<Vec2> for Vec2
[src]
impl PartialEq<Vec2> for Vec2
fn eq(&self, other: &Vec2) -> bool
[src]
fn eq(&self, other: &Vec2) -> bool
This 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) -> bool
This method tests for !=
.
impl AddAssign<Vec2> for Vec2
[src]
impl AddAssign<Vec2> for Vec2
fn add_assign(&mut self, rhs: Vec2)
[src]
fn add_assign(&mut self, rhs: Vec2)
Performs the +=
operation.
impl From<f32> for Vec2
[src]
impl From<f32> for Vec2
impl From<DVec2> for Vec2
[src]
impl From<DVec2> for Vec2
impl From<[f32; 2]> for Vec2
[src]
impl From<[f32; 2]> for Vec2
impl From<Vec2> for DVec2
[src]
impl From<Vec2> for DVec2
impl From<f64> for Vec2
[src]
impl From<f64> for Vec2
impl Div<f32> for Vec2
[src]
impl Div<f32> for Vec2