#[repr(C)]pub struct Vec4<T> {
pub x: T,
pub y: T,
pub z: T,
pub w: T,
}Expand description
A 4-dimensional vector.
Fields§
§x: T§y: T§z: T§w: TImplementations§
Source§impl<T> Vec4<T>
impl<T> Vec4<T>
Sourcepub fn splat(value: T) -> Selfwhere
T: Copy,
pub fn splat(value: T) -> Selfwhere
T: Copy,
Create a new vector with all components set to value.
Sourcepub fn abs(self) -> Selfwhere
T: Signed,
pub fn abs(self) -> Selfwhere
T: Signed,
Returns a copy of this vector with absolute value of all components.
Sourcepub fn signum(self) -> Selfwhere
T: Signed,
pub fn signum(self) -> Selfwhere
T: Signed,
Returns a copy of this vector with signed value of all components.
Sourcepub fn min(self, rhs: Self) -> Selfwhere
T: Num,
pub fn min(self, rhs: Self) -> Selfwhere
T: Num,
Returns a new value where each component is set to the smallest value of each of the supplied vector’s corresponding components.
Sourcepub fn max(self, rhs: Self) -> Selfwhere
T: Num,
pub fn max(self, rhs: Self) -> Selfwhere
T: Num,
Returns a new value where each component is set to the greatest value of each of the supplied vector’s corresponding components.
Sourcepub fn clamp(self, min: Self, max: Self) -> Selfwhere
T: Num,
pub fn clamp(self, min: Self, max: Self) -> Selfwhere
T: Num,
Clamps the vector’s components within the provided bounds.
Sourcepub fn trunc(self) -> Selfwhere
T: Float,
pub fn trunc(self) -> Selfwhere
T: Float,
Truncates the components of this vector. This means that non-integer numbers are always truncated towards zero.
Sourcepub fn sqr_dist(self, other: Self) -> Twhere
T: Num,
pub fn sqr_dist(self, other: Self) -> Twhere
T: Num,
The square distance between this vector and another.
Sourcepub fn reflect(self, normal: Self) -> Selfwhere
T: Num,
pub fn reflect(self, normal: Self) -> Selfwhere
T: Num,
Reflects this vector off the provided normal.
Sourcepub fn dist(self, other: Self) -> Twhere
T: Float,
pub fn dist(self, other: Self) -> Twhere
T: Float,
The distance between this vector and another.
Sourcepub fn norm_safe(self) -> Selfwhere
T: Float,
pub fn norm_safe(self) -> Selfwhere
T: Float,
Returns a normalized version of this vector, or a zeroed vector if the vector cannot be normalized.
Sourcepub fn len_to(self, new_len: T) -> Selfwhere
T: Float,
pub fn len_to(self, new_len: T) -> Selfwhere
T: Float,
Returns a copy of this vector resized to be the provided length.
Sourcepub fn len_to_safe(self, new_len: T) -> Selfwhere
T: Float,
pub fn len_to_safe(self, new_len: T) -> Selfwhere
T: Float,
Returns a copy of this vector resized to be the provided length, or a zeroed vector if the original could not be normalized.
Source§impl<T: Copy + AbsDiffEq<Epsilon = T>> Vec4<T>
impl<T: Copy + AbsDiffEq<Epsilon = T>> Vec4<T>
Sourcepub fn abs_diff_eq(&self, other: &Self) -> bool
pub fn abs_diff_eq(&self, other: &Self) -> bool
Returns true if the two values are approximately equal according to the absolute difference between their components.
Source§impl<T: Copy + RelativeEq<Epsilon = T>> Vec4<T>
impl<T: Copy + RelativeEq<Epsilon = T>> Vec4<T>
Sourcepub fn relative_eq(&self, other: &Self) -> bool
pub fn relative_eq(&self, other: &Self) -> bool
Returns true if the two values are approximately equal according to the absolute difference between their components, as well as relative-based comparisons.
Trait Implementations§
Source§impl<T> AbsDiffEq for Vec4<T>
impl<T> AbsDiffEq for Vec4<T>
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq.Source§impl<T: Copy + AddAssign<T>> AddAssign<&Vec4<T>> for Vec4<T>
impl<T: Copy + AddAssign<T>> AddAssign<&Vec4<T>> for Vec4<T>
Source§fn add_assign(&mut self, rhs: &Vec4<T>)
fn add_assign(&mut self, rhs: &Vec4<T>)
+= operation. Read moreSource§impl<T: AddAssign<T>> AddAssign for Vec4<T>
impl<T: AddAssign<T>> AddAssign for Vec4<T>
Source§fn add_assign(&mut self, rhs: Vec4<T>)
fn add_assign(&mut self, rhs: Vec4<T>)
+= operation. Read moreSource§impl<'de, T: Deserialize<'de>> Deserialize<'de> for Vec4<T>
impl<'de, T: Deserialize<'de>> Deserialize<'de> for Vec4<T>
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<T: Copy + DivAssign<T>> DivAssign<&T> for Vec4<T>
impl<T: Copy + DivAssign<T>> DivAssign<&T> for Vec4<T>
Source§fn div_assign(&mut self, rhs: &T)
fn div_assign(&mut self, rhs: &T)
/= operation. Read moreSource§impl<T: Copy + DivAssign<T>> DivAssign<&Vec4<T>> for Vec4<T>
impl<T: Copy + DivAssign<T>> DivAssign<&Vec4<T>> for Vec4<T>
Source§fn div_assign(&mut self, rhs: &Vec4<T>)
fn div_assign(&mut self, rhs: &Vec4<T>)
/= operation. Read moreSource§impl<T: Copy + DivAssign<T>> DivAssign<T> for Vec4<T>
impl<T: Copy + DivAssign<T>> DivAssign<T> for Vec4<T>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/= operation. Read moreSource§impl<T: DivAssign<T>> DivAssign for Vec4<T>
impl<T: DivAssign<T>> DivAssign for Vec4<T>
Source§fn div_assign(&mut self, rhs: Vec4<T>)
fn div_assign(&mut self, rhs: Vec4<T>)
/= operation. Read moreSource§impl<T> From<(T, T, T, T)> for Vec4<T>
impl<T> From<(T, T, T, T)> for Vec4<T>
Source§fn from((x, y, z, w): (T, T, T, T)) -> Self
fn from((x, y, z, w): (T, T, T, T)) -> Self
Source§impl<T> From<Vec4<T>> for (T, T, T, T)
impl<T> From<Vec4<T>> for (T, T, T, T)
Source§fn from(_: Vec4<T>) -> (T, T, T, T)
fn from(_: Vec4<T>) -> (T, T, T, T)
Source§impl<T: Float + Interp<Factor = T>> Interp for Vec4<T>
impl<T: Float + Interp<Factor = T>> Interp for Vec4<T>
Source§fn quad_bezier(self, control: Self, target: Self, t: Self::Factor) -> Self
fn quad_bezier(self, control: Self, target: Self, t: Self::Factor) -> Self
Source§fn cubic_bezier(
self,
control1: Self,
control2: Self,
target: Self,
t: Self::Factor,
) -> Self
fn cubic_bezier( self, control1: Self, control2: Self, target: Self, t: Self::Factor, ) -> Self
Source§fn hermite(
self,
tangent1: Self::Factor,
target: Self,
tangent2: Self::Factor,
t: Self::Factor,
) -> Self
fn hermite( self, tangent1: Self::Factor, target: Self, tangent2: Self::Factor, t: Self::Factor, ) -> Self
Source§fn catmull_rom(
self,
control1: Self,
control2: Self,
target: Self,
t: Self::Factor,
) -> Self
fn catmull_rom( self, control1: Self, control2: Self, target: Self, t: Self::Factor, ) -> Self
Source§fn smooth_step(self, target: Self, t: Self::Factor) -> Self
fn smooth_step(self, target: Self, t: Self::Factor) -> Self
Source§impl<T: Copy + MulAssign<T>> MulAssign<&T> for Vec4<T>
impl<T: Copy + MulAssign<T>> MulAssign<&T> for Vec4<T>
Source§fn mul_assign(&mut self, rhs: &T)
fn mul_assign(&mut self, rhs: &T)
*= operation. Read moreSource§impl<T: Copy + MulAssign<T>> MulAssign<&Vec4<T>> for Vec4<T>
impl<T: Copy + MulAssign<T>> MulAssign<&Vec4<T>> for Vec4<T>
Source§fn mul_assign(&mut self, rhs: &Vec4<T>)
fn mul_assign(&mut self, rhs: &Vec4<T>)
*= operation. Read moreSource§impl<T: Copy + MulAssign<T>> MulAssign<T> for Vec4<T>
impl<T: Copy + MulAssign<T>> MulAssign<T> for Vec4<T>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moreSource§impl<T: MulAssign<T>> MulAssign for Vec4<T>
impl<T: MulAssign<T>> MulAssign for Vec4<T>
Source§fn mul_assign(&mut self, rhs: Vec4<T>)
fn mul_assign(&mut self, rhs: Vec4<T>)
*= operation. Read moreSource§impl<T: Numeric<AsU8 = u8, AsU16 = u16, AsU32 = u32, AsU64 = u64, AsU128 = u128, AsUSize = usize, AsI8 = i8, AsI16 = i16, AsI32 = i32, AsI64 = i64, AsI128 = i128, AsISize = isize, AsF32 = f32, AsF64 = f64>> Numeric for Vec4<T>
impl<T: Numeric<AsU8 = u8, AsU16 = u16, AsU32 = u32, AsU64 = u64, AsU128 = u128, AsUSize = usize, AsI8 = i8, AsI16 = i16, AsI32 = i32, AsI64 = i64, AsI128 = i128, AsISize = isize, AsF32 = f32, AsF64 = f64>> Numeric for Vec4<T>
type AsU8 = Vec4<u8>
type AsU16 = Vec4<u16>
type AsU32 = Vec4<u32>
type AsU64 = Vec4<u64>
type AsU128 = Vec4<u128>
type AsUSize = Vec4<usize>
type AsI8 = Vec4<i8>
type AsI16 = Vec4<i16>
type AsI32 = Vec4<i32>
type AsI64 = Vec4<i64>
type AsI128 = Vec4<i128>
type AsISize = Vec4<isize>
type AsF32 = Vec4<f32>
type AsF64 = Vec4<f64>
fn to_u8(self) -> Vec4<u8>
fn to_u16(self) -> Vec4<u16>
fn to_u32(self) -> Vec4<u32>
fn to_u64(self) -> Vec4<u64>
fn to_u128(self) -> Vec4<u128>
fn to_usize(self) -> Vec4<usize>
fn to_i8(self) -> Vec4<i8>
fn to_i16(self) -> Vec4<i16>
fn to_i32(self) -> Vec4<i32>
fn to_i64(self) -> Vec4<i64>
fn to_i128(self) -> Vec4<i128>
fn to_isize(self) -> Vec4<isize>
fn to_f32(self) -> Vec4<f32>
fn to_f64(self) -> Vec4<f64>
Source§impl<T: Ord> Ord for Vec4<T>
impl<T: Ord> Ord for Vec4<T>
Source§impl<T: PartialOrd> PartialOrd for Vec4<T>
impl<T: PartialOrd> PartialOrd for Vec4<T>
Source§impl<T> RelativeEq for Vec4<T>
impl<T> RelativeEq for Vec4<T>
Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
Source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
Source§fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon,
) -> bool
fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon, ) -> bool
RelativeEq::relative_eq.Source§impl<T: Copy + RemAssign<T>> RemAssign<&T> for Vec4<T>
impl<T: Copy + RemAssign<T>> RemAssign<&T> for Vec4<T>
Source§fn rem_assign(&mut self, rhs: &T)
fn rem_assign(&mut self, rhs: &T)
%= operation. Read moreSource§impl<T: Copy + RemAssign<T>> RemAssign<&Vec4<T>> for Vec4<T>
impl<T: Copy + RemAssign<T>> RemAssign<&Vec4<T>> for Vec4<T>
Source§fn rem_assign(&mut self, rhs: &Vec4<T>)
fn rem_assign(&mut self, rhs: &Vec4<T>)
%= operation. Read moreSource§impl<T: Copy + RemAssign<T>> RemAssign<T> for Vec4<T>
impl<T: Copy + RemAssign<T>> RemAssign<T> for Vec4<T>
Source§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
%= operation. Read moreSource§impl<T: RemAssign<T>> RemAssign for Vec4<T>
impl<T: RemAssign<T>> RemAssign for Vec4<T>
Source§fn rem_assign(&mut self, rhs: Vec4<T>)
fn rem_assign(&mut self, rhs: Vec4<T>)
%= operation. Read moreSource§impl<T: Float + SmoothInterp<Factor = T>> SmoothInterp for Vec4<T>
impl<T: Float + SmoothInterp<Factor = T>> SmoothInterp for Vec4<T>
Source§impl<T: Copy + SubAssign<T>> SubAssign<&Vec4<T>> for Vec4<T>
impl<T: Copy + SubAssign<T>> SubAssign<&Vec4<T>> for Vec4<T>
Source§fn sub_assign(&mut self, rhs: &Vec4<T>)
fn sub_assign(&mut self, rhs: &Vec4<T>)
-= operation. Read moreSource§impl<T: SubAssign<T>> SubAssign for Vec4<T>
impl<T: SubAssign<T>> SubAssign for Vec4<T>
Source§fn sub_assign(&mut self, rhs: Vec4<T>)
fn sub_assign(&mut self, rhs: Vec4<T>)
-= operation. Read moreSource§impl<T> UlpsEq for Vec4<T>
impl<T> UlpsEq for Vec4<T>
impl<T: Copy> Copy for Vec4<T>
impl<T: Eq> Eq for Vec4<T>
impl<T: Pod> Pod for Vec4<T>
impl<T> StructuralPartialEq for Vec4<T>
Auto Trait Implementations§
impl<T> Freeze for Vec4<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vec4<T>where
T: RefUnwindSafe,
impl<T> Send for Vec4<T>where
T: Send,
impl<T> Sync for Vec4<T>where
T: Sync,
impl<T> Unpin for Vec4<T>where
T: Unpin,
impl<T> UnsafeUnpin for Vec4<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Vec4<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
Source§type Bits = T
type Bits = T
Self must have the same layout as the specified Bits except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern.Source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self.