[go: up one dir, main page]

Struct UVec4

Source
#[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: u32

Implementations§

Source§

impl UVec4

Source

pub const fn new(x: u32, y: u32, z: u32, w: u32) -> Self

Source

pub fn broadcast(val: u32) -> Self

Source

pub fn unit_x() -> Self

Source

pub fn unit_y() -> Self

Source

pub fn unit_z() -> Self

Source

pub fn unit_w() -> Self

Source

pub fn dot(&self, other: UVec4) -> u32

Source

pub fn reflect(&mut self, normal: UVec4)

Source

pub fn reflected(&self, normal: UVec4) -> Self

Source

pub fn mag(&self) -> u32

Source

pub fn mag_sq(&self) -> u32

Source

pub fn mul_add(&self, mul: UVec4, add: UVec4) -> Self

Source

pub fn clamp(&mut self, min: Self, max: Self)

Source

pub fn clamped(self, min: Self, max: Self) -> Self

Source

pub fn map<F>(&self, f: F) -> Self
where F: FnMut(u32) -> u32,

Source

pub fn apply<F>(&mut self, f: F)
where F: FnMut(u32) -> u32,

Source

pub fn max_by_component(self, other: Self) -> Self

Source

pub fn min_by_component(self, other: Self) -> Self

Source

pub fn component_max(&self) -> u32

Source

pub fn component_min(&self) -> u32

Source

pub fn zero() -> Self

Source

pub fn one() -> Self

Source

pub fn xy(&self) -> UVec2

Source

pub fn xyz(&self) -> UVec3

Source

pub fn layout() -> Layout

Source

pub fn as_slice(&self) -> &[u32]

Source

pub fn as_array(&self) -> [u32; 4]

Source

pub fn as_byte_slice(&self) -> &[u8]

Source

pub fn as_mut_slice(&mut self) -> &mut [u32]

Source

pub fn as_mut_byte_slice(&mut self) -> &mut [u8]

Source

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.

Source

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.

Source§

impl UVec4

Source

pub fn abs(&self) -> Self

Trait Implementations§

Source§

impl Add for UVec4

Source§

type Output = UVec4

The resulting type after applying the + operator.
Source§

fn add(self, rhs: UVec4) -> Self

Performs the + operation. Read more
Source§

impl AddAssign for UVec4

Source§

fn add_assign(&mut self, rhs: UVec4)

Performs the += operation. Read more
Source§

impl Clone for UVec4

Source§

fn clone(&self) -> UVec4

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for UVec4

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for UVec4

Source§

fn default() -> UVec4

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for UVec4

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Div<u32> for UVec4

Source§

type Output = UVec4

The resulting type after applying the / operator.
Source§

fn div(self, rhs: u32) -> UVec4

Performs the / operation. Read more
Source§

impl Div for UVec4

Source§

type Output = UVec4

The resulting type after applying the / operator.
Source§

fn div(self, rhs: UVec4) -> Self

Performs the / operation. Read more
Source§

impl DivAssign<u32> for UVec4

Source§

fn div_assign(&mut self, rhs: u32)

Performs the /= operation. Read more
Source§

impl DivAssign for UVec4

Source§

fn div_assign(&mut self, rhs: UVec4)

Performs the /= operation. Read more
Source§

impl From<&[u32; 4]> for UVec4

Source§

fn from(comps: &[u32; 4]) -> Self

Converts to this type from the input type.
Source§

impl From<&(u32, u32, u32, u32)> for UVec4

Source§

fn from(comps: &(u32, u32, u32, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<&mut [u32; 4]> for UVec4

Source§

fn from(comps: &mut [u32; 4]) -> Self

Converts to this type from the input type.
Source§

impl From<[u32; 4]> for UVec4

Source§

fn from(comps: [u32; 4]) -> Self

Converts to this type from the input type.
Source§

impl From<(u32, u32, u32, u32)> for UVec4

Source§

fn from(comps: (u32, u32, u32, u32)) -> Self

Converts to this type from the input type.
Source§

impl From<UVec3> for UVec4

Source§

fn from(vec: UVec3) -> Self

Converts to this type from the input type.
Source§

impl From<UVec4> for [u32; 4]

Source§

fn from(v: UVec4) -> Self

Converts to this type from the input type.
Source§

impl From<UVec4> for (u32, u32, u32, u32)

Source§

fn from(v: UVec4) -> Self

Converts to this type from the input type.
Source§

impl From<UVec4> for DVec4

Source§

fn from(v: UVec4) -> Self

Converts to this type from the input type.
Source§

impl From<UVec4> for UVec3

Source§

fn from(vec: UVec4) -> Self

Converts to this type from the input type.
Source§

impl From<UVec4> for Vec4

Source§

fn from(v: UVec4) -> Self

Converts to this type from the input type.
Source§

impl Hash for UVec4

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Index<usize> for UVec4

Source§

type Output = u32

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl IndexMut<usize> for UVec4

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl Mul<UVec4> for u32

Source§

type Output = UVec4

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: UVec4) -> UVec4

Performs the * operation. Read more
Source§

impl Mul<u32> for UVec4

Source§

type Output = UVec4

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: u32) -> UVec4

Performs the * operation. Read more
Source§

impl Mul for UVec4

Source§

type Output = UVec4

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: UVec4) -> Self

Performs the * operation. Read more
Source§

impl MulAssign<u32> for UVec4

Source§

fn mul_assign(&mut self, rhs: u32)

Performs the *= operation. Read more
Source§

impl MulAssign for UVec4

Source§

fn mul_assign(&mut self, rhs: UVec4)

Performs the *= operation. Read more
Source§

impl PartialEq for UVec4

Source§

fn eq(&self, other: &UVec4) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for UVec4

Source§

fn serialize<T>(&self, serializer: T) -> Result<T::Ok, T::Error>
where T: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub for UVec4

Source§

type Output = UVec4

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: UVec4) -> Self

Performs the - operation. Read more
Source§

impl SubAssign for UVec4

Source§

fn sub_assign(&mut self, rhs: UVec4)

Performs the -= operation. Read more
Source§

impl Sum for UVec4

Source§

fn sum<I>(iter: I) -> Self
where I: Iterator<Item = Self>,

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl TryFrom<DVec4> for UVec4

Source§

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 is NaN.
  • 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

The type returned in the event of a conversion error.
Source§

impl TryFrom<Vec4> for UVec4

Source§

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 is NaN.
  • 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

The type returned in the event of a conversion error.
Source§

impl Zeroable for UVec4

Source§

fn zeroed() -> Self

Source§

impl Copy for UVec4

Source§

impl Eq for UVec4

Source§

impl Pod for UVec4

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

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

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> NoUninit for T
where T: Pod,