#[repr(C)]pub struct Vec4 {
pub x: Float,
pub y: Float,
pub z: Float,
pub w: Float,
}Expand description
A 4D vector.
Fields§
§x: FloatX component.
y: FloatY component.
z: FloatZ component.
w: FloatW component.
Implementations§
Source§impl Vec4
impl Vec4
Sourcepub const fn splat(value: Float) -> Self
pub const fn splat(value: Float) -> Self
Creates a vector with all components set to the same value.
Sourcepub const fn from_array(arr: [Float; 4]) -> Self
pub const fn from_array(arr: [Float; 4]) -> Self
Creates a vector from an array.
Sourcepub const fn from_vec2(v: Vec2, z: Float, w: Float) -> Self
pub const fn from_vec2(v: Vec2, z: Float, w: Float) -> Self
Extends from Vec2 with z and w components.
Sourcepub fn length_squared(self) -> Float
pub fn length_squared(self) -> Float
Computes the squared length.
Sourcepub fn try_normalize(self) -> Option<Self>
pub fn try_normalize(self) -> Option<Self>
Returns a normalized vector, or None if length is near zero.
Trait Implementations§
Source§impl AddAssign for Vec4
impl AddAssign for Vec4
Source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
Performs the
+= operation. Read moreSource§impl DivAssign<f32> for Vec4
impl DivAssign<f32> for Vec4
Source§fn div_assign(&mut self, scalar: Float)
fn div_assign(&mut self, scalar: Float)
Performs the
/= operation. Read moreSource§impl MulAssign<f32> for Vec4
impl MulAssign<f32> for Vec4
Source§fn mul_assign(&mut self, scalar: Float)
fn mul_assign(&mut self, scalar: Float)
Performs the
*= operation. Read moreSource§impl SubAssign for Vec4
impl SubAssign for Vec4
Source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
Performs the
-= operation. Read moreimpl Copy for Vec4
impl StructuralPartialEq for Vec4
Auto Trait Implementations§
impl Freeze for Vec4
impl RefUnwindSafe for Vec4
impl Send for Vec4
impl Sync for Vec4
impl Unpin for Vec4
impl UnwindSafe for Vec4
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more