Vec3

Struct Vec3 

Source
#[repr(C)]
pub struct Vec3<T> { pub x: T, pub y: T, pub z: T, }

Fields§

§x: T§y: T§z: T

Implementations§

Source§

impl<T> Vec3<T>
where T: Copy,

Source

pub fn new(x: T, y: T, z: T) -> Self

Creates a new Vec3 from multiple components

Source

pub fn len() -> usize

return the length of element

Source

pub fn to_tuple(&self) -> (T, T, T)

Source

pub fn xx(&self) -> Vec2<T>

Source

pub fn xy(&self) -> Vec2<T>

Source

pub fn xz(&self) -> Vec2<T>

Source

pub fn yx(&self) -> Vec2<T>

Source

pub fn yy(&self) -> Vec2<T>

Source

pub fn yz(&self) -> Vec2<T>

Source

pub fn zx(&self) -> Vec2<T>

Source

pub fn zy(&self) -> Vec2<T>

Source

pub fn zz(&self) -> Vec2<T>

Source

pub fn xxx(&self) -> Self

Source

pub fn xxy(&self) -> Self

Source

pub fn xxz(&self) -> Self

Source

pub fn xyx(&self) -> Self

Source

pub fn xyy(&self) -> Self

Source

pub fn xyz(&self) -> Self

Source

pub fn xzx(&self) -> Self

Source

pub fn xzy(&self) -> Self

Source

pub fn xzz(&self) -> Self

Source

pub fn yxx(&self) -> Self

Source

pub fn yxy(&self) -> Self

Source

pub fn yxz(&self) -> Self

Source

pub fn yyx(&self) -> Self

Source

pub fn yyy(&self) -> Self

Source

pub fn yyz(&self) -> Self

Source

pub fn yzx(&self) -> Self

Source

pub fn yzy(&self) -> Self

Source

pub fn yzz(&self) -> Self

Source

pub fn zxx(&self) -> Self

Source

pub fn zxy(&self) -> Self

Source

pub fn zxz(&self) -> Self

Source

pub fn zyx(&self) -> Self

Source

pub fn zyy(&self) -> Self

Source

pub fn zyz(&self) -> Self

Source

pub fn zzx(&self) -> Self

Source

pub fn zzy(&self) -> Self

Source

pub fn zzz(&self) -> Self

Source

pub fn xxxx(&self) -> Vec4<T>

Source

pub fn xxxy(&self) -> Vec4<T>

Source

pub fn xxxz(&self) -> Vec4<T>

Source

pub fn xxyx(&self) -> Vec4<T>

Source

pub fn xxyy(&self) -> Vec4<T>

Source

pub fn xxyz(&self) -> Vec4<T>

Source

pub fn xxzx(&self) -> Vec4<T>

Source

pub fn xxzy(&self) -> Vec4<T>

Source

pub fn xxzz(&self) -> Vec4<T>

Source

pub fn xyxx(&self) -> Vec4<T>

Source

pub fn xyxy(&self) -> Vec4<T>

Source

pub fn xyxz(&self) -> Vec4<T>

Source

pub fn xyyx(&self) -> Vec4<T>

Source

pub fn xyyy(&self) -> Vec4<T>

Source

pub fn xyyz(&self) -> Vec4<T>

Source

pub fn xyzx(&self) -> Vec4<T>

Source

pub fn xyzy(&self) -> Vec4<T>

Source

pub fn xyzz(&self) -> Vec4<T>

Source

pub fn xzxx(&self) -> Vec4<T>

Source

pub fn xzxy(&self) -> Vec4<T>

Source

pub fn xzxz(&self) -> Vec4<T>

Source

pub fn xzyx(&self) -> Vec4<T>

Source

pub fn xzyy(&self) -> Vec4<T>

Source

pub fn xzyz(&self) -> Vec4<T>

Source

pub fn xzzx(&self) -> Vec4<T>

Source

pub fn xzzy(&self) -> Vec4<T>

Source

pub fn xzzz(&self) -> Vec4<T>

Source

pub fn yxxx(&self) -> Vec4<T>

Source

pub fn yxxy(&self) -> Vec4<T>

Source

pub fn yxxz(&self) -> Vec4<T>

Source

pub fn yxyx(&self) -> Vec4<T>

Source

pub fn yxyy(&self) -> Vec4<T>

Source

pub fn yxyz(&self) -> Vec4<T>

Source

pub fn yxzx(&self) -> Vec4<T>

Source

pub fn yxzy(&self) -> Vec4<T>

Source

pub fn yxzz(&self) -> Vec4<T>

Source

pub fn yyxx(&self) -> Vec4<T>

Source

pub fn yyxy(&self) -> Vec4<T>

Source

pub fn yyxz(&self) -> Vec4<T>

Source

pub fn yyyx(&self) -> Vec4<T>

Source

pub fn yyyy(&self) -> Vec4<T>

Source

pub fn yyyz(&self) -> Vec4<T>

Source

pub fn yyzx(&self) -> Vec4<T>

Source

pub fn yyzy(&self) -> Vec4<T>

Source

pub fn yyzz(&self) -> Vec4<T>

Source

pub fn yzxx(&self) -> Vec4<T>

Source

pub fn yzxy(&self) -> Vec4<T>

Source

pub fn yzxz(&self) -> Vec4<T>

Source

pub fn yzyx(&self) -> Vec4<T>

Source

pub fn yzyy(&self) -> Vec4<T>

Source

pub fn yzyz(&self) -> Vec4<T>

Source

pub fn yzzx(&self) -> Vec4<T>

Source

pub fn yzzy(&self) -> Vec4<T>

Source

pub fn yzzz(&self) -> Vec4<T>

Source

pub fn zxxx(&self) -> Vec4<T>

Source

pub fn zxxy(&self) -> Vec4<T>

Source

pub fn zxxz(&self) -> Vec4<T>

Source

pub fn zxyx(&self) -> Vec4<T>

Source

pub fn zxyy(&self) -> Vec4<T>

Source

pub fn zxyz(&self) -> Vec4<T>

Source

pub fn zxzx(&self) -> Vec4<T>

Source

pub fn zxzy(&self) -> Vec4<T>

Source

pub fn zxzz(&self) -> Vec4<T>

Source

pub fn zyxx(&self) -> Vec4<T>

Source

pub fn zyxy(&self) -> Vec4<T>

Source

pub fn zyxz(&self) -> Vec4<T>

Source

pub fn zyyx(&self) -> Vec4<T>

Source

pub fn zyyy(&self) -> Vec4<T>

Source

pub fn zyyz(&self) -> Vec4<T>

Source

pub fn zyzx(&self) -> Vec4<T>

Source

pub fn zyzy(&self) -> Vec4<T>

Source

pub fn zyzz(&self) -> Vec4<T>

Source

pub fn zzxx(&self) -> Vec4<T>

Source

pub fn zzxy(&self) -> Vec4<T>

Source

pub fn zzxz(&self) -> Vec4<T>

Source

pub fn zzyx(&self) -> Vec4<T>

Source

pub fn zzyy(&self) -> Vec4<T>

Source

pub fn zzyz(&self) -> Vec4<T>

Source

pub fn zzzx(&self) -> Vec4<T>

Source

pub fn zzzy(&self) -> Vec4<T>

Source

pub fn zzzz(&self) -> Vec4<T>

Source§

impl<T> Vec3<T>
where T: Vec + Math,

Source

pub fn dot(&self, b: Self) -> T

Source

pub fn cross(&self, b: Self) -> Self

Source

pub fn length2(&self) -> T

Source

pub fn length(&self) -> T

Source

pub fn distance(&self, b: Self) -> T

Source

pub fn normalize(&self) -> Self

Trait Implementations§

Source§

impl<T> Add for Vec3<T>
where T: Add<Output = T>,

Source§

type Output = Vec3<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
Source§

impl<T> AddAssign for Vec3<T>
where T: AddAssign<T>,

Source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
Source§

impl<T> AsMut<Vec3<T>> for Vec3<T>

Source§

fn as_mut(&mut self) -> &mut Vec3<T>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T> AsRef<Vec3<T>> for Vec3<T>

Source§

fn as_ref(&self) -> &Vec3<T>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T> Binary for Vec3<T>
where T: Vec + Math,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Clone> Clone for Vec3<T>

Source§

fn clone(&self) -> Vec3<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for Vec3<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Default> Default for Vec3<T>

Source§

fn default() -> Vec3<T>

Returns the “default value” for a type. Read more
Source§

impl<T> Display for Vec3<T>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Div<T> for Vec3<T>
where T: Div<Output = T> + Copy,

Source§

type Output = Vec3<T>

The resulting type after applying the / operator.
Source§

fn div(self, s: T) -> Self

Performs the / operation. Read more
Source§

impl<T> Div for Vec3<T>
where T: Div<Output = T>,

Source§

type Output = Vec3<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
Source§

impl<'a, T> DivAssign<&'a T> for Vec3<T>
where T: DivAssign<T> + Copy,

Source§

fn div_assign(&mut self, s: &'a T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign<T> for Vec3<T>
where T: DivAssign<T> + Copy,

Source§

fn div_assign(&mut self, s: T)

Performs the /= operation. Read more
Source§

impl<T> DivAssign for Vec3<T>
where T: DivAssign<T>,

Source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
Source§

impl<T> From<[T; 3]> for Vec3<T>
where T: Copy,

Source§

fn from(v: [T; 3]) -> Self

Converts to this type from the input type.
Source§

impl<T> From<(T, T, T)> for Vec3<T>
where T: Copy,

Source§

fn from(v: (T, T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Vec3<T>> for Vec4<T>
where T: Copy + One,

Source§

fn from(v: Vec3<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Vec4<T>> for Vec3<T>
where T: Copy + Div<Output = T>,

Source§

fn from(v: Vec4<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for Vec3<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Interpolation<T> for Vec3<T>
where T: Copy + One + Mul<Output = T> + Add<Output = T> + Sub<Output = T>,

Source§

fn lerp(self, b: Self, t: T) -> Self

Source§

impl<T> Math for Vec3<T>
where T: Copy + Math,

Source§

fn abs(self) -> Self

Source§

fn recip(self) -> Self

Source§

fn sqrt(self) -> Self

Source§

fn rsqrt(self) -> Self

Source§

fn sin(self) -> Self

Source§

fn cos(self) -> Self

Source§

fn tan(self) -> Self

Source§

fn sincos(self) -> (Self, Self)

Source§

fn acos(self) -> Self

Source§

fn asin(self) -> Self

Source§

fn atan(self) -> Self

Source§

fn exp(self) -> Self

Source§

fn exp2(self) -> Self

Source§

fn log(self, _rhs: Self) -> Self

Source§

fn log2(self) -> Self

Source§

fn log10(self) -> Self

Source§

fn to_radians(self) -> Self

Source§

fn to_degrees(self) -> Self

Source§

fn min(self, _rhs: Self) -> Self

Source§

fn max(self, _rhs: Self) -> Self

Source§

fn saturate(self) -> Self

Source§

fn snorm2unorm(self) -> Self

Source§

fn unorm2snorm(self) -> Self

Source§

fn clamp(self, minval: Self, maxval: Self) -> Self

Source§

impl<T> Mul<Mat4<T>> for Vec3<T>
where T: Copy + Add<Output = T> + Div<Output = T> + Mul<Output = T>,

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, m: Mat4<T>) -> Self

Performs the * operation. Read more
Source§

impl<T> Mul<T> for Vec3<T>
where T: Mul<Output = T> + Copy,

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, s: T) -> Self

Performs the * operation. Read more
Source§

impl<T> Mul<Vec3<T>> for Mat4<T>
where T: Copy + Add<Output = T> + Sub<Output = T> + Mul<Output = T>,

Source§

type Output = Mat4<T>

The resulting type after applying the * operator.
Source§

fn mul(self, v: Vec3<T>) -> Self

Performs the * operation. Read more
Source§

impl<T> Mul for Vec3<T>
where T: Mul<Output = T>,

Source§

type Output = Vec3<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
Source§

impl<'a, T> MulAssign<&'a T> for Vec3<T>
where T: MulAssign<T> + Copy,

Source§

fn mul_assign(&mut self, other: &'a T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign<T> for Vec3<T>
where T: MulAssign<T> + Copy,

Source§

fn mul_assign(&mut self, s: T)

Performs the *= operation. Read more
Source§

impl<T> MulAssign for Vec3<T>
where T: MulAssign<T>,

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl<T> Neg for Vec3<T>
where T: Neg<Output = T>,

Source§

type Output = Vec3<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<T> One for Vec3<T>
where T: One,

Source§

fn one() -> Self

Source§

impl<T: PartialEq> PartialEq for Vec3<T>

Source§

fn eq(&self, other: &Vec3<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Sub for Vec3<T>
where T: Sub<Output = T>,

Source§

type Output = Vec3<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
Source§

impl<T> SubAssign for Vec3<T>
where T: SubAssign<T>,

Source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
Source§

impl<T> TypeSize<Vec3<T>> for Vec3<T>

Source§

impl<T> UnitX for Vec3<T>
where T: One + Zero,

Source§

fn unit_x() -> Self

Source§

impl<T> UnitY for Vec3<T>
where T: One + Zero,

Source§

fn unit_y() -> Self

Source§

impl<T> UnitZ for Vec3<T>
where T: One + Zero,

Source§

fn unit_z() -> Self

Source§

impl<T> Zero for Vec3<T>
where T: Zero,

Source§

fn zero() -> Self

Source§

impl<T: Copy> Copy for Vec3<T>

Source§

impl<T: Eq> Eq for Vec3<T>

Source§

impl<T> StructuralPartialEq for Vec3<T>

Auto Trait Implementations§

§

impl<T> Freeze for Vec3<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Vec3<T>
where T: RefUnwindSafe,

§

impl<T> Send for Vec3<T>
where T: Send,

§

impl<T> Sync for Vec3<T>
where T: Sync,

§

impl<T> Unpin for Vec3<T>
where T: Unpin,

§

impl<T> UnwindSafe for Vec3<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.