[][src]Struct gramit::vec::Vec3

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

Fields

x: f32y: f32z: f32

Methods

impl Vec3[src]

pub fn new(x: f32, y: f32, z: 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 angle_between(&self, other: &Vec3) -> Angle[src]

Get the angle between this vector and another.

impl Vec3[src]

pub fn cross(self, other: &Vec3) -> Vec3[src]

Compute the cross product self × other.

pub fn extend(self, w: f32) -> Vec4[src]

Extend this Vec3 to a Vec4, with the given w component.

pub fn homogeneous(self) -> Vec4[src]

Get a homogeneous (point) representation of this Vec3.

This is equivalent to calling vec3.extend(1.0).

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

Truncate the z component of this Vec3 to produce a Vec2.

Trait Implementations

impl ApproxEq<Vec3> for Vec3[src]

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

Compare two vectors for approximate equality.

Uses a third vector for component-wise thresholds.

impl Vector for Vec3[src]

type Scalar = f32

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

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

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

impl From<Vec3> for Quaternion[src]

fn from(vec: Vec3) -> Quaternion[src]

Converts a Vec3 into a Quaternion with only a vector part.

This conversion is identical to that performed by Quaternion::vector.

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

impl Clone for Vec3[src]

impl Copy for Vec3[src]

impl Default for Vec3[src]

impl PartialEq<Vec3> for Vec3[src]

impl Debug for Vec3[src]

impl Div<Vec3> for Vec3[src]

type Output = Vec3

The resulting type after applying the / operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the / operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the / operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the / operator.

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

Component-wise arithemetic operation.

impl Div<f32> for Vec3[src]

type Output = Vec3

The resulting type after applying the / operator.

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

type Output = Vec3

The resulting type after applying the / operator.

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

type Output = Vec3

The resulting type after applying the / operator.

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

type Output = Vec3

The resulting type after applying the / operator.

impl Sub<Vec3> for Vec3[src]

type Output = Vec3

The resulting type after applying the - operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the - operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the - operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the - operator.

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

Component-wise arithemetic operation.

impl Add<Vec3> for Vec3[src]

type Output = Vec3

The resulting type after applying the + operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the + operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the + operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the + operator.

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

Component-wise arithemetic operation.

impl Mul<Vec3> for Mat3[src]

type Output = Vec3

The resulting type after applying the * operator.

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

Matrix-vector multiplication operation.

impl<'_> Mul<&'_ Vec3> for Mat3[src]

type Output = Vec3

The resulting type after applying the * operator.

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

Matrix-vector multiplication operation.

impl<'_> Mul<Vec3> for &'_ Mat3[src]

type Output = Vec3

The resulting type after applying the * operator.

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

Matrix-vector multiplication operation.

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

type Output = Vec3

The resulting type after applying the * operator.

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

Matrix-vector multiplication operation.

impl Mul<Vec3> for Vec3[src]

type Output = Vec3

The resulting type after applying the * operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the * operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the * operator.

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

Component-wise arithemetic operation.

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

type Output = Vec3

The resulting type after applying the * operator.

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

Component-wise arithemetic operation.

impl Mul<f32> for Vec3[src]

type Output = Vec3

The resulting type after applying the * operator.

impl Mul<Vec3> for f32[src]

type Output = Vec3

The resulting type after applying the * operator.

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

type Output = Vec3

The resulting type after applying the * operator.

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

type Output = Vec3

The resulting type after applying the * operator.

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

type Output = Vec3

The resulting type after applying the * operator.

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

type Output = Vec3

The resulting type after applying the * operator.

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

type Output = Vec3

The resulting type after applying the * operator.

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

type Output = Vec3

The resulting type after applying the * operator.

impl Neg for Vec3[src]

type Output = Vec3

The resulting type after applying the - operator.

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

type Output = Vec3

The resulting type after applying the - operator.

impl AddAssign<Vec3> for Vec3[src]

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

Component-wise arithmetic assignment operation.

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

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

Component-wise arithmetic assignment operation.

impl SubAssign<Vec3> for Vec3[src]

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

Component-wise arithmetic assignment operation.

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

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

Component-wise arithmetic assignment operation.

impl MulAssign<Vec3> for Vec3[src]

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

Component-wise arithmetic assignment operation.

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

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

Component-wise arithmetic assignment operation.

impl MulAssign<f32> for Vec3[src]

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

impl DivAssign<Vec3> for Vec3[src]

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

Component-wise arithmetic assignment operation.

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

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

Component-wise arithmetic assignment operation.

impl DivAssign<f32> for Vec3[src]

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

impl Index<usize> for Vec3[src]

type Output = f32

The returned type after indexing.

impl IndexMut<usize> for Vec3[src]

impl StructuralPartialEq for Vec3[src]

Auto Trait Implementations

impl Send for Vec3

impl Sync for Vec3

impl Unpin for Vec3

impl UnwindSafe for Vec3

impl RefUnwindSafe for Vec3

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]