[−][src]Struct gramit::vec::Vec2
Fields
x: f32
y: f32
Methods
impl Vec2
[src]
pub fn new(x: f32, y: f32) -> Self
[src]
Create a new vector with the given components.
pub fn x() -> Self
[src]
Create a unit vector along this axis.
pub fn y() -> Self
[src]
Create a unit vector along this axis.
pub fn angle_between(&self, other: &Vec2) -> Angle
[src]
Get the angle between this vector and another.
impl Vec2
[src]
Trait Implementations
impl ApproxEq<Vec2> for Vec2
[src]
fn approx_eq(self, rhs: Vec2) -> bool
[src]
fn within_threshold(self, rhs: Vec2, threshold: Vec2) -> bool
[src]
Compare two vectors for approximate equality.
Uses a third vector for component-wise thresholds.
impl Vector for Vec2
[src]
type Scalar = f32
The scalar type over which this vector type is defined. Read more
const DIMS: usize
[src]
fn length(&self) -> f32
[src]
fn dot(&self, other: &Self) -> f32
[src]
fn ones() -> Self
[src]
fn zeros() -> Self
[src]
fn unit(&self) -> Self
[src]
fn scalar_mul(&self, s: &f32) -> Self
[src]
fn vector_add(&self, v: &Self) -> Self
[src]
impl AsMut<[f32]> for Vec2
[src]
impl AsRef<[f32]> for Vec2
[src]
impl Into<Vec<f32>> for Vec2
[src]
impl Clone for Vec2
[src]
impl Copy for Vec2
[src]
impl Default for Vec2
[src]
impl PartialEq<Vec2> for Vec2
[src]
impl Debug for Vec2
[src]
impl Div<Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the /
operator.
fn div(self, rhs: Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_> Div<&'_ Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the /
operator.
fn div(self, rhs: &Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_> Div<Vec2> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the /
operator.
fn div(self, rhs: Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_, '_> Div<&'_ Vec2> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the /
operator.
fn div(self, rhs: &Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl Div<f32> for Vec2
[src]
type Output = Vec2
The resulting type after applying the /
operator.
fn div(self, rhs: f32) -> Vec2
[src]
impl<'_> Div<&'_ f32> for Vec2
[src]
type Output = Vec2
The resulting type after applying the /
operator.
fn div(self, rhs: &f32) -> Vec2
[src]
impl<'_> Div<f32> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the /
operator.
fn div(self, rhs: f32) -> Vec2
[src]
impl<'_, '_> Div<&'_ f32> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the /
operator.
fn div(self, rhs: &f32) -> Vec2
[src]
impl Sub<Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the -
operator.
fn sub(self, rhs: Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_> Sub<&'_ Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the -
operator.
fn sub(self, rhs: &Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_> Sub<Vec2> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the -
operator.
fn sub(self, rhs: Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_, '_> Sub<&'_ Vec2> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the -
operator.
fn sub(self, rhs: &Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl Add<Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the +
operator.
fn add(self, rhs: Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_> Add<&'_ Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the +
operator.
fn add(self, rhs: &Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_> Add<Vec2> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the +
operator.
fn add(self, rhs: Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_, '_> Add<&'_ Vec2> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the +
operator.
fn add(self, rhs: &Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl Mul<Vec2> for Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec2) -> Vec2
[src]
Matrix-vector multiplication operation.
impl<'_> Mul<&'_ Vec2> for Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: &Vec2) -> Vec2
[src]
Matrix-vector multiplication operation.
impl<'_> Mul<Vec2> for &'_ Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec2) -> Vec2
[src]
Matrix-vector multiplication operation.
impl<'_, '_> Mul<&'_ Vec2> for &'_ Mat2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: &Vec2) -> Vec2
[src]
Matrix-vector multiplication operation.
impl Mul<Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_> Mul<&'_ Vec2> for Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: &Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_> Mul<Vec2> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl<'_, '_> Mul<&'_ Vec2> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: &Vec2) -> Vec2
[src]
Component-wise arithemetic operation.
impl Mul<f32> for Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Vec2
[src]
impl Mul<Vec2> for f32
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec2) -> Vec2
[src]
impl<'_> Mul<&'_ f32> for Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: &f32) -> Vec2
[src]
impl<'_> Mul<Vec2> for &'_ f32
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: Vec2) -> Vec2
[src]
impl<'_> Mul<f32> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: f32) -> Vec2
[src]
impl<'_> Mul<&'_ Vec2> for f32
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: &Vec2) -> Vec2
[src]
impl<'_, '_> Mul<&'_ f32> for &'_ Vec2
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: &f32) -> Vec2
[src]
impl<'_, '_> Mul<&'_ Vec2> for &'_ f32
[src]
type Output = Vec2
The resulting type after applying the *
operator.
fn mul(self, rhs: &Vec2) -> Vec2
[src]
impl Neg for Vec2
[src]
impl<'_> Neg for &'_ Vec2
[src]
impl AddAssign<Vec2> for Vec2
[src]
fn add_assign(&mut self, rhs: Vec2)
[src]
Component-wise arithmetic assignment operation.
impl<'_> AddAssign<&'_ Vec2> for Vec2
[src]
fn add_assign(&mut self, rhs: &Vec2)
[src]
Component-wise arithmetic assignment operation.
impl SubAssign<Vec2> for Vec2
[src]
fn sub_assign(&mut self, rhs: Vec2)
[src]
Component-wise arithmetic assignment operation.
impl<'_> SubAssign<&'_ Vec2> for Vec2
[src]
fn sub_assign(&mut self, rhs: &Vec2)
[src]
Component-wise arithmetic assignment operation.
impl MulAssign<Vec2> for Vec2
[src]
fn mul_assign(&mut self, rhs: Vec2)
[src]
Component-wise arithmetic assignment operation.
impl<'_> MulAssign<&'_ Vec2> for Vec2
[src]
fn mul_assign(&mut self, rhs: &Vec2)
[src]
Component-wise arithmetic assignment operation.
impl MulAssign<f32> for Vec2
[src]
fn mul_assign(&mut self, rhs: f32)
[src]
impl<'_> MulAssign<&'_ f32> for Vec2
[src]
fn mul_assign(&mut self, rhs: &f32)
[src]
impl DivAssign<Vec2> for Vec2
[src]
fn div_assign(&mut self, rhs: Vec2)
[src]
Component-wise arithmetic assignment operation.
impl<'_> DivAssign<&'_ Vec2> for Vec2
[src]
fn div_assign(&mut self, rhs: &Vec2)
[src]
Component-wise arithmetic assignment operation.
impl DivAssign<f32> for Vec2
[src]
fn div_assign(&mut self, rhs: f32)
[src]
impl<'_> DivAssign<&'_ f32> for Vec2
[src]
fn div_assign(&mut self, rhs: &f32)
[src]
impl Index<usize> for Vec2
[src]
impl IndexMut<usize> for Vec2
[src]
impl StructuralPartialEq for Vec2
[src]
Auto Trait Implementations
impl Send for Vec2
impl Sync for Vec2
impl Unpin for Vec2
impl UnwindSafe for Vec2
impl RefUnwindSafe for Vec2
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,