#[repr(C, align(16))]pub struct Vec4 {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}Fields§
§x: f32§y: f32§z: f32§w: f32Implementations§
Source§impl Vec4
impl Vec4
pub const ZERO: Vec4
pub const ONE: Vec4
pub const fn new(x: f32, y: f32, z: f32, w: f32) -> Self
pub fn length(self) -> f32
pub fn length_squared(self) -> f32
pub fn normalize(self) -> Self
Sourcepub fn normalize_fast(self) -> Self
pub fn normalize_fast(self) -> Self
Normalize using rsqrt approximation. Less accurate than normalize() but faster; uses SIMD when the feature is on.
pub fn dot(self, other: Self) -> f32
pub fn lerp(self, other: Self, t: f32) -> Self
pub fn min(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Sourcepub fn min_element(self) -> f32
pub fn min_element(self) -> f32
Minimum element
Sourcepub fn max_element(self) -> f32
pub fn max_element(self) -> f32
Maximum element
Sourcepub fn abs_diff_eq(self, other: Self, epsilon: f32) -> bool
pub fn abs_diff_eq(self, other: Self, epsilon: f32) -> bool
Approximate equality with epsilon
Sourcepub fn from_array(a: [f32; 4]) -> Self
pub fn from_array(a: [f32; 4]) -> Self
Create from array
Sourcepub fn from_slice(slice: &[f32]) -> Option<Self>
pub fn from_slice(slice: &[f32]) -> Option<Self>
Create from slice, returns None if slice is too short
Sourcepub fn write_to_slice(self, slice: &mut [f32])
pub fn write_to_slice(self, slice: &mut [f32])
Write to slice, panics if slice is too short
Sourcepub fn as_array_mut(&mut self) -> &mut [f32; 4]
pub fn as_array_mut(&mut self) -> &mut [f32; 4]
Get mutable reference to underlying array
Trait Implementations§
Source§impl Vec4Swizzles for Vec4
impl Vec4Swizzles for Vec4
fn x(self) -> f32
fn y(self) -> f32
fn z(self) -> f32
fn w(self) -> f32
fn xx(self) -> Vec2
fn xy(self) -> Vec2
fn xz(self) -> Vec2
fn xw(self) -> Vec2
fn yx(self) -> Vec2
fn yy(self) -> Vec2
fn yz(self) -> Vec2
fn yw(self) -> Vec2
fn zx(self) -> Vec2
fn zy(self) -> Vec2
fn zz(self) -> Vec2
fn zw(self) -> Vec2
fn wx(self) -> Vec2
fn wy(self) -> Vec2
fn wz(self) -> Vec2
fn ww(self) -> Vec2
fn xyz(self) -> Vec3
fn xyw(self) -> Vec3
fn xzy(self) -> Vec3
fn xzw(self) -> Vec3
fn xwy(self) -> Vec3
fn xwz(self) -> Vec3
fn yxz(self) -> Vec3
fn yxw(self) -> Vec3
fn yzx(self) -> Vec3
fn yzw(self) -> Vec3
fn ywx(self) -> Vec3
fn ywz(self) -> Vec3
fn zxy(self) -> Vec3
fn zxw(self) -> Vec3
fn zyx(self) -> Vec3
fn zyw(self) -> Vec3
fn zwx(self) -> Vec3
fn zwy(self) -> Vec3
fn wxy(self) -> Vec3
fn wxz(self) -> Vec3
fn wyx(self) -> Vec3
fn wyz(self) -> Vec3
fn wzx(self) -> Vec3
fn wzy(self) -> Vec3
fn xyzw(self) -> Vec4
fn xywz(self) -> Vec4
fn xzyw(self) -> Vec4
fn xzwy(self) -> Vec4
fn xwyz(self) -> Vec4
fn xwzy(self) -> Vec4
fn yxzw(self) -> Vec4
fn yxwz(self) -> Vec4
fn yzxw(self) -> Vec4
fn yzwx(self) -> Vec4
fn ywxz(self) -> Vec4
fn ywzx(self) -> Vec4
fn zxyw(self) -> Vec4
fn zxwy(self) -> Vec4
fn zyxw(self) -> Vec4
fn zywx(self) -> Vec4
fn zwxy(self) -> Vec4
fn zwyx(self) -> Vec4
fn wxyz(self) -> Vec4
fn wxzy(self) -> Vec4
fn wyxz(self) -> Vec4
fn wyzx(self) -> Vec4
fn wzxy(self) -> Vec4
fn wzyx(self) -> Vec4
impl 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§
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