#[repr(C)]pub struct UVec4 {
pub x: u32,
pub y: u32,
pub z: u32,
pub w: u32,
}Expand description
A set of four coordinates which may be interpreted as a point or vector in 4d space, or as a homogeneous 3d vector or point.
Generally this distinction between a point and vector is more of a pain than it is worth to distinguish on a type level, however when converting to and from homogeneous coordinates it is quite important.
Fields§
§x: u32§y: u32§z: u32§w: u32Implementations§
Source§impl UVec4
impl UVec4
pub const fn new(x: u32, y: u32, z: u32, w: u32) -> Self
pub fn broadcast(val: u32) -> Self
pub fn unit_x() -> Self
pub fn unit_y() -> Self
pub fn unit_z() -> Self
pub fn unit_w() -> Self
pub fn dot(&self, other: UVec4) -> u32
pub fn reflect(&mut self, normal: UVec4)
pub fn reflected(&self, normal: UVec4) -> Self
pub fn mag(&self) -> u32
pub fn mag_sq(&self) -> u32
pub fn mul_add(&self, mul: UVec4, add: UVec4) -> Self
pub fn clamp(&mut self, min: Self, max: Self)
pub fn clamped(self, min: Self, max: Self) -> Self
pub fn map<F>(&self, f: F) -> Self
pub fn apply<F>(&mut self, f: F)
pub fn max_by_component(self, other: Self) -> Self
pub fn min_by_component(self, other: Self) -> Self
pub fn component_max(&self) -> u32
pub fn component_min(&self) -> u32
pub fn zero() -> Self
pub fn one() -> Self
pub fn xy(&self) -> UVec2
pub fn xyz(&self) -> UVec3
pub fn layout() -> Layout
pub fn as_slice(&self) -> &[u32]
pub fn as_array(&self) -> [u32; 4]
pub fn as_byte_slice(&self) -> &[u8] ⓘ
pub fn as_mut_slice(&mut self) -> &mut [u32]
pub fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
Sourcepub fn as_ptr(&self) -> *const u32
pub fn as_ptr(&self) -> *const u32
Returns a constant unsafe pointer to the underlying data in the underlying type. This function is safe because all types here are repr(C) and can be represented as their underlying type.
§Safety
It is up to the caller to correctly use this pointer and its bounds.
Sourcepub fn as_mut_ptr(&mut self) -> *mut u32
pub fn as_mut_ptr(&mut self) -> *mut u32
Returns a mutable unsafe pointer to the underlying data in the underlying type. This function is safe because all types here are repr(C) and can be represented as their underlying type.
§Safety
It is up to the caller to correctly use this pointer and its bounds.
Trait Implementations§
Source§impl AddAssign for UVec4
impl AddAssign for UVec4
Source§fn add_assign(&mut self, rhs: UVec4)
fn add_assign(&mut self, rhs: UVec4)
+= operation. Read moreSource§impl<'de> Deserialize<'de> for UVec4
impl<'de> Deserialize<'de> for UVec4
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 DivAssign<u32> for UVec4
impl DivAssign<u32> for UVec4
Source§fn div_assign(&mut self, rhs: u32)
fn div_assign(&mut self, rhs: u32)
/= operation. Read moreSource§impl DivAssign for UVec4
impl DivAssign for UVec4
Source§fn div_assign(&mut self, rhs: UVec4)
fn div_assign(&mut self, rhs: UVec4)
/= operation. Read moreSource§impl MulAssign<u32> for UVec4
impl MulAssign<u32> for UVec4
Source§fn mul_assign(&mut self, rhs: u32)
fn mul_assign(&mut self, rhs: u32)
*= operation. Read moreSource§impl MulAssign for UVec4
impl MulAssign for UVec4
Source§fn mul_assign(&mut self, rhs: UVec4)
fn mul_assign(&mut self, rhs: UVec4)
*= operation. Read moreSource§impl SubAssign for UVec4
impl SubAssign for UVec4
Source§fn sub_assign(&mut self, rhs: UVec4)
fn sub_assign(&mut self, rhs: UVec4)
-= operation. Read moreSource§impl TryFrom<DVec4> for UVec4
impl TryFrom<DVec4> for UVec4
Source§fn try_from(v: DVec4) -> Result<Self, Self::Error>
fn try_from(v: DVec4) -> Result<Self, Self::Error>
Tries to convert the source to Self in a lossy way, flooring any float value.
§Errors
NaN- If a float value isNaN.NotFinite- If a float value is infinity or negative infinity.PosOverflow- If a float value would be greater than the the self.component max value.NegOverflow- If a float value would be less than the self.component min value.
Source§type Error = FloatConversionError
type Error = FloatConversionError
Source§impl TryFrom<Vec4> for UVec4
impl TryFrom<Vec4> for UVec4
Source§fn try_from(v: Vec4) -> Result<Self, Self::Error>
fn try_from(v: Vec4) -> Result<Self, Self::Error>
Tries to convert the source to Self in a lossy way, flooring any float value.
§Errors
NaN- If a float value isNaN.NotFinite- If a float value is infinity or negative infinity.PosOverflow- If a float value would be greater than the the self.component max value.NegOverflow- If a float value would be less than the self.component min value.
Source§type Error = FloatConversionError
type Error = FloatConversionError
impl Copy for UVec4
impl Eq for UVec4
impl Pod for UVec4
impl StructuralPartialEq for UVec4
Auto Trait Implementations§
impl Freeze for UVec4
impl RefUnwindSafe for UVec4
impl Send for UVec4
impl Sync for UVec4
impl Unpin for UVec4
impl UnwindSafe for UVec4
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.