[][src]Struct gramit::vec::Vec4

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

Fields

x: f32y: f32z: f32w: f32

Methods

impl Vec4[src]

pub fn new(x: f32, y: f32, z: f32, w: 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 z() -> Self[src]

Create a unit vector along this axis.

pub fn w() -> Self[src]

Create a unit vector along this axis.

pub fn angle_between(&self, other: &Vec4) -> Angle[src]

Get the angle between this vector and another.

impl Vec4[src]

pub fn truncate(self) -> Vec3[src]

Truncate the w component of this Vec4 to produce a Vec3.

pub fn homogenize(self) -> Vec3[src]

Convert a homogeneous 4-vector to the corresponding point in 3-space.

Trait Implementations

impl ApproxEq<Vec4> for Vec4[src]

fn within_threshold(self, rhs: Vec4, threshold: Vec4) -> bool[src]

Compare two vectors for approximate equality.

Uses a third vector for component-wise thresholds.

impl Vector for Vec4[src]

type Scalar = f32

The scalar type over which this vector type is defined. Read more

impl AsMut<[f32]> for Vec4[src]

impl AsRef<[f32]> for Vec4[src]

impl Into<Vec<f32>> for Vec4[src]

impl Clone for Vec4[src]

impl Copy for Vec4[src]

impl Default for Vec4[src]

impl PartialEq<Vec4> for Vec4[src]

impl Debug for Vec4[src]

impl Div<Vec4> for Vec4[src]

type Output = Vec4

The resulting type after applying the / operator.

fn div(self, rhs: Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_> Div<&'_ Vec4> for Vec4[src]

type Output = Vec4

The resulting type after applying the / operator.

fn div(self, rhs: &Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_> Div<Vec4> for &'_ Vec4[src]

type Output = Vec4

The resulting type after applying the / operator.

fn div(self, rhs: Vec4) -> Vec4[src]

Component-wise arithemetic operation.

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

type Output = Vec4

The resulting type after applying the / operator.

fn div(self, rhs: &Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl Div<f32> for Vec4[src]

type Output = Vec4

The resulting type after applying the / operator.

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

type Output = Vec4

The resulting type after applying the / operator.

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

type Output = Vec4

The resulting type after applying the / operator.

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

type Output = Vec4

The resulting type after applying the / operator.

impl Sub<Vec4> for Vec4[src]

type Output = Vec4

The resulting type after applying the - operator.

fn sub(self, rhs: Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_> Sub<&'_ Vec4> for Vec4[src]

type Output = Vec4

The resulting type after applying the - operator.

fn sub(self, rhs: &Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_> Sub<Vec4> for &'_ Vec4[src]

type Output = Vec4

The resulting type after applying the - operator.

fn sub(self, rhs: Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_, '_> Sub<&'_ Vec4> for &'_ Vec4[src]

type Output = Vec4

The resulting type after applying the - operator.

fn sub(self, rhs: &Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl Add<Vec4> for Vec4[src]

type Output = Vec4

The resulting type after applying the + operator.

fn add(self, rhs: Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_> Add<&'_ Vec4> for Vec4[src]

type Output = Vec4

The resulting type after applying the + operator.

fn add(self, rhs: &Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_> Add<Vec4> for &'_ Vec4[src]

type Output = Vec4

The resulting type after applying the + operator.

fn add(self, rhs: Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_, '_> Add<&'_ Vec4> for &'_ Vec4[src]

type Output = Vec4

The resulting type after applying the + operator.

fn add(self, rhs: &Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl Mul<Vec4> for Mat4[src]

type Output = Vec4

The resulting type after applying the * operator.

fn mul(self, rhs: Vec4) -> Vec4[src]

Matrix-vector multiplication operation.

impl<'_> Mul<&'_ Vec4> for Mat4[src]

type Output = Vec4

The resulting type after applying the * operator.

fn mul(self, rhs: &Vec4) -> Vec4[src]

Matrix-vector multiplication operation.

impl<'_> Mul<Vec4> for &'_ Mat4[src]

type Output = Vec4

The resulting type after applying the * operator.

fn mul(self, rhs: Vec4) -> Vec4[src]

Matrix-vector multiplication operation.

impl<'_, '_> Mul<&'_ Vec4> for &'_ Mat4[src]

type Output = Vec4

The resulting type after applying the * operator.

fn mul(self, rhs: &Vec4) -> Vec4[src]

Matrix-vector multiplication operation.

impl Mul<Vec4> for Vec4[src]

type Output = Vec4

The resulting type after applying the * operator.

fn mul(self, rhs: Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_> Mul<&'_ Vec4> for Vec4[src]

type Output = Vec4

The resulting type after applying the * operator.

fn mul(self, rhs: &Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl<'_> Mul<Vec4> for &'_ Vec4[src]

type Output = Vec4

The resulting type after applying the * operator.

fn mul(self, rhs: Vec4) -> Vec4[src]

Component-wise arithemetic operation.

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

type Output = Vec4

The resulting type after applying the * operator.

fn mul(self, rhs: &Vec4) -> Vec4[src]

Component-wise arithemetic operation.

impl Mul<f32> for Vec4[src]

type Output = Vec4

The resulting type after applying the * operator.

impl Mul<Vec4> for f32[src]

type Output = Vec4

The resulting type after applying the * operator.

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

type Output = Vec4

The resulting type after applying the * operator.

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

type Output = Vec4

The resulting type after applying the * operator.

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

type Output = Vec4

The resulting type after applying the * operator.

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

type Output = Vec4

The resulting type after applying the * operator.

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

type Output = Vec4

The resulting type after applying the * operator.

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

type Output = Vec4

The resulting type after applying the * operator.

impl Neg for Vec4[src]

type Output = Vec4

The resulting type after applying the - operator.

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

type Output = Vec4

The resulting type after applying the - operator.

impl AddAssign<Vec4> for Vec4[src]

fn add_assign(&mut self, rhs: Vec4)[src]

Component-wise arithmetic assignment operation.

impl<'_> AddAssign<&'_ Vec4> for Vec4[src]

fn add_assign(&mut self, rhs: &Vec4)[src]

Component-wise arithmetic assignment operation.

impl SubAssign<Vec4> for Vec4[src]

fn sub_assign(&mut self, rhs: Vec4)[src]

Component-wise arithmetic assignment operation.

impl<'_> SubAssign<&'_ Vec4> for Vec4[src]

fn sub_assign(&mut self, rhs: &Vec4)[src]

Component-wise arithmetic assignment operation.

impl MulAssign<Vec4> for Vec4[src]

fn mul_assign(&mut self, rhs: Vec4)[src]

Component-wise arithmetic assignment operation.

impl<'_> MulAssign<&'_ Vec4> for Vec4[src]

fn mul_assign(&mut self, rhs: &Vec4)[src]

Component-wise arithmetic assignment operation.

impl MulAssign<f32> for Vec4[src]

impl<'_> MulAssign<&'_ f32> for Vec4[src]

impl DivAssign<Vec4> for Vec4[src]

fn div_assign(&mut self, rhs: Vec4)[src]

Component-wise arithmetic assignment operation.

impl<'_> DivAssign<&'_ Vec4> for Vec4[src]

fn div_assign(&mut self, rhs: &Vec4)[src]

Component-wise arithmetic assignment operation.

impl DivAssign<f32> for Vec4[src]

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

impl Index<usize> for Vec4[src]

type Output = f32

The returned type after indexing.

impl IndexMut<usize> for Vec4[src]

impl StructuralPartialEq for Vec4[src]

Auto Trait Implementations

impl Send for Vec4

impl Sync for Vec4

impl Unpin for Vec4

impl UnwindSafe for Vec4

impl RefUnwindSafe for Vec4

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]