[][src]Struct gramit::vec::Vec2

#[repr(C)]
pub struct Vec2 {
    pub x: f32,
    pub y: f32,
}

Fields

x: f32y: 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]

pub fn extend(self, z: f32) -> Vec3[src]

Extend this Vec2 to a Vec3, with the given z component.

Trait Implementations

impl ApproxEq<Vec2> for Vec2[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

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.

impl<'_> Div<&'_ f32> for Vec2[src]

type Output = Vec2

The resulting type after applying the / operator.

impl<'_> Div<f32> for &'_ Vec2[src]

type Output = Vec2

The resulting type after applying the / operator.

impl<'_, '_> Div<&'_ f32> for &'_ Vec2[src]

type Output = Vec2

The resulting type after applying the / operator.

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.

impl Mul<Vec2> for f32[src]

type Output = Vec2

The resulting type after applying the * operator.

impl<'_> Mul<&'_ f32> for Vec2[src]

type Output = Vec2

The resulting type after applying the * operator.

impl<'_> Mul<Vec2> for &'_ f32[src]

type Output = Vec2

The resulting type after applying the * operator.

impl<'_> Mul<f32> for &'_ Vec2[src]

type Output = Vec2

The resulting type after applying the * operator.

impl<'_> Mul<&'_ Vec2> for f32[src]

type Output = Vec2

The resulting type after applying the * operator.

impl<'_, '_> Mul<&'_ f32> for &'_ Vec2[src]

type Output = Vec2

The resulting type after applying the * operator.

impl<'_, '_> Mul<&'_ Vec2> for &'_ f32[src]

type Output = Vec2

The resulting type after applying the * operator.

impl Neg for Vec2[src]

type Output = Vec2

The resulting type after applying the - operator.

impl<'_> Neg for &'_ Vec2[src]

type Output = Vec2

The resulting type after applying the - operator.

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]

impl<'_> MulAssign<&'_ f32> for Vec2[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]

impl<'_> DivAssign<&'_ f32> for Vec2[src]

impl Index<usize> for Vec2[src]

type Output = f32

The returned type after indexing.

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]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]