#[repr(C)]pub struct Vec4<T: VectorScalar> {
pub x: T,
pub y: T,
pub z: T,
pub w: T,
}Expand description
A 4D vector.
Fields§
§x: TThe x component of the vector.
y: TThe y component of the vector.
z: TThe z component of the vector.
w: TThe w component of the vector.
Implementations§
Source§impl<T: VectorScalar> Vec4<T>
impl<T: VectorScalar> Vec4<T>
Source§impl<T> Vec4<T>where
T: VectorScalar,
impl<T> Vec4<T>where
T: VectorScalar,
Sourcepub const fn splat(scalar: T) -> Self
pub const fn splat(scalar: T) -> Self
Creates a new instance of the tuple type with all elements set to the given scalar value.
Sourcepub const fn as_ptr(&self) -> *const T
pub const fn as_ptr(&self) -> *const T
Returns a raw pointer to the first element of the tuple.
Sourcepub const fn as_mut_ptr(&mut self) -> *mut T
pub const fn as_mut_ptr(&mut self) -> *mut T
Returns a mutable raw pointer to the first element of the tuple.
Sourcepub const fn as_mut_slice(&mut self) -> &mut [T]
pub const fn as_mut_slice(&mut self) -> &mut [T]
Returns a mutable slice containing all elements of the tuple.
Sourcepub const fn from_array(a: [T; 4]) -> Self
pub const fn from_array(a: [T; 4]) -> Self
Creates a new instance of the tuple type from an array of scalar elements.
Source§impl<T> Vec4<T>where
T: VectorScalar + Select,
impl<T> Vec4<T>where
T: VectorScalar + Select,
Source§impl<T> Vec4<T>where
T: VectorScalar + Neg<Output = T>,
impl<T> Vec4<T>where
T: VectorScalar + Neg<Output = T>,
Source§impl<T> Vec4<T>where
T: VectorScalar,
impl<T> Vec4<T>where
T: VectorScalar,
Trait Implementations§
Source§impl<T> AbsDiffEq for Vec4<T>where
T: VectorScalar + AbsDiffEq<Epsilon = T>,
impl<T> AbsDiffEq for Vec4<T>where
T: VectorScalar + AbsDiffEq<Epsilon = T>,
Source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
Source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate
equality of two numbers.
Source§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of
AbsDiffEq::abs_diff_eq.Source§impl<T> Add for Vec4<T>where
T: VectorScalar,
impl<T> Add for Vec4<T>where
T: VectorScalar,
Source§impl<T> AddAssign for Vec4<T>where
T: VectorScalar,
impl<T> AddAssign for Vec4<T>where
T: VectorScalar,
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreimpl<T: Copy + VectorScalar> Copy for Vec4<T>
Source§impl<T> Default for Vec4<T>where
T: VectorScalar,
impl<T> Default for Vec4<T>where
T: VectorScalar,
Source§impl<T> Div for Vec4<T>where
T: VectorScalar,
impl<T> Div for Vec4<T>where
T: VectorScalar,
Source§impl<T> DivAssign for Vec4<T>where
T: VectorScalar,
impl<T> DivAssign for Vec4<T>where
T: VectorScalar,
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/= operation. Read moreSource§impl<T> DotProduct for Vec4<T>where
T: VectorScalar,
impl<T> DotProduct for Vec4<T>where
T: VectorScalar,
Source§impl<T> HasScalar for Vec4<T>where
T: VectorScalar,
impl<T> HasScalar for Vec4<T>where
T: VectorScalar,
Source§impl<T> Mul for Vec4<T>where
T: VectorScalar,
impl<T> Mul for Vec4<T>where
T: VectorScalar,
Source§impl<T> MulAssign for Vec4<T>where
T: VectorScalar,
impl<T> MulAssign for Vec4<T>where
T: VectorScalar,
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl<T> One for Vec4<T>where
T: VectorScalar,
impl<T> One for Vec4<T>where
T: VectorScalar,
Source§impl<T> RelativeEq for Vec4<T>where
T: VectorScalar + RelativeEq<Epsilon = T>,
impl<T> RelativeEq for Vec4<T>where
T: VectorScalar + RelativeEq<Epsilon = T>,
Source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
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
A test for equality that uses a relative comparison if the values are far apart.
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
The inverse of
RelativeEq::relative_eq.Source§impl<T> ScalarTuple for Vec4<T>where
T: VectorScalar,
impl<T> ScalarTuple for Vec4<T>where
T: VectorScalar,
Source§type Array = [T; 4]
type Array = [T; 4]
The array type corresponding to the tuple, containing the same number of scalar elements.
Source§fn splat(scalar: Self::Scalar) -> Self
fn splat(scalar: Self::Scalar) -> Self
Creates a new instance of the tuple type with all elements set to the given scalar value.
Source§fn as_ptr(&self) -> *const Self::Scalar
fn as_ptr(&self) -> *const Self::Scalar
Returns a raw pointer to the first element of the tuple.
Source§fn as_mut_ptr(&mut self) -> *mut Self::Scalar
fn as_mut_ptr(&mut self) -> *mut Self::Scalar
Returns a mutable raw pointer to the first element of the tuple.
Source§fn as_mut_slice(&mut self) -> &mut [Self::Scalar]
fn as_mut_slice(&mut self) -> &mut [Self::Scalar]
Returns a mutable slice containing all elements of the tuple.
Source§fn from_array(a: Self::Array) -> Self
fn from_array(a: Self::Array) -> Self
Creates a new instance of the tuple type from an array of scalar elements.
impl<T: PartialEq + VectorScalar> StructuralPartialEq for Vec4<T>
Source§impl<T> Sub for Vec4<T>where
T: VectorScalar,
impl<T> Sub for Vec4<T>where
T: VectorScalar,
Source§impl<T> SubAssign for Vec4<T>where
T: VectorScalar,
impl<T> SubAssign for Vec4<T>where
T: VectorScalar,
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreSource§impl<T> UlpsEq for Vec4<T>where
T: VectorScalar + UlpsEq<Epsilon = T>,
impl<T> UlpsEq for Vec4<T>where
T: VectorScalar + UlpsEq<Epsilon = T>,
impl<T> Vector for Vec4<T>where
T: VectorScalar,
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
Mutably borrows from an owned value. Read more