pub struct UVec3(/* private fields */);
Expand description
A 3-dimensional vector.
Implementations§
source§impl UVec3
impl UVec3
sourcepub fn truncate(self) -> UVec2
pub fn truncate(self) -> UVec2
Creates a Vec2
from the x
and y
elements of self
, discarding z
.
Truncation may also be performed by using self.xy()
or Vec2::from()
.
sourcepub fn select(mask: BVec3, if_true: UVec3, if_false: UVec3) -> UVec3
pub fn select(mask: BVec3, if_true: UVec3, if_false: UVec3) -> UVec3
Creates a vector from the elements in if_true
and if_false
, selecting which to use
for each element of self
.
A true element in the mask uses the corresponding element from if_true
, and false
uses the element from if_false
.
sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Returns a vector containing the mininum values for each element of self
and other
.
In other words this computes [self.x.max(other.x), self.y.max(other.y), ..]
.
sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Returns a vector containing the maximum values for each element of self
and other
.
In other words this computes [self.x.max(other.x), self.y.max(other.y), ..]
.
sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Component-wise clamping of values, similar to f32::clamp
.
Each element in min
must be less-or-equal to the corresponing element in max
.
Panics
Will panic if min
is greater than max
when glam_assert
is enabled.
sourcepub fn min_element(self) -> u32
pub fn min_element(self) -> u32
Returns the horizontal minimum of self
.
In other words this computes min(x, y, ..)
.
sourcepub fn max_element(self) -> u32
pub fn max_element(self) -> u32
Returns the horizontal maximum of self
.
In other words this computes max(x, y, ..)
.
sourcepub fn cmpeq(self, other: Self) -> BVec3
pub fn cmpeq(self, other: Self) -> BVec3
Returns a vector mask containing the result of a ==
comparison for each element of
self
and other
.
In other words, this computes [self.x == other.x, self.y == other.y, ..]
for all
elements.
sourcepub fn cmpne(self, other: Self) -> BVec3
pub fn cmpne(self, other: Self) -> BVec3
Returns a vector mask containing the result of a !=
comparison for each element of
self
and other
.
In other words this computes [self.x != other.x, self.y != other.y, ..]
for all
elements.
sourcepub fn cmpge(self, other: Self) -> BVec3
pub fn cmpge(self, other: Self) -> BVec3
Returns a vector mask containing the result of a >=
comparison for each element of
self
and other
.
In other words this computes [self.x >= other.x, self.y >= other.y, ..]
for all
elements.
sourcepub fn cmpgt(self, other: Self) -> BVec3
pub fn cmpgt(self, other: Self) -> BVec3
Returns a vector mask containing the result of a >
comparison for each element of
self
and other
.
In other words this computes [self.x > other.x, self.y > other.y, ..]
for all
elements.
sourcepub fn cmple(self, other: Self) -> BVec3
pub fn cmple(self, other: Self) -> BVec3
Returns a vector mask containing the result of a <=
comparison for each element of
self
and other
.
In other words this computes [self.x <= other.x, self.y <= other.y, ..]
for all
elements.
sourcepub fn cmplt(self, other: Self) -> BVec3
pub fn cmplt(self, other: Self) -> BVec3
Returns a vector mask containing the result of a <
comparison for each element of
self
and other
.
In other words this computes [self.x < other.x, self.y < other.y, ..]
for all
elements.
sourcepub fn from_slice(slice: &[u32]) -> Self
pub fn from_slice(slice: &[u32]) -> Self
Creates a vector from the first N values in slice
.
Panics
Panics if slice
is less than N elements long.
sourcepub fn write_to_slice(self, slice: &mut [u32])
pub fn write_to_slice(self, slice: &mut [u32])
Writes the elements of self
to the first N elements in slice
.
Panics
Panics if slice
is less than N elements long.
Trait Implementations§
source§impl AddAssign<u32> for UVec3
impl AddAssign<u32> for UVec3
source§fn add_assign(&mut self, other: u32)
fn add_assign(&mut self, other: u32)
+=
operation. Read moresource§impl AddAssign for UVec3
impl AddAssign for UVec3
source§fn add_assign(&mut self, other: UVec3)
fn add_assign(&mut self, other: UVec3)
+=
operation. Read moresource§impl<'de> Deserialize<'de> for UVec3
impl<'de> Deserialize<'de> for UVec3
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 Distribution<UVec3> for Standard
impl Distribution<UVec3> for Standard
source§impl DivAssign<u32> for UVec3
impl DivAssign<u32> for UVec3
source§fn div_assign(&mut self, other: u32)
fn div_assign(&mut self, other: u32)
/=
operation. Read moresource§impl DivAssign for UVec3
impl DivAssign for UVec3
source§fn div_assign(&mut self, other: UVec3)
fn div_assign(&mut self, other: UVec3)
/=
operation. Read moresource§impl MulAssign<u32> for UVec3
impl MulAssign<u32> for UVec3
source§fn mul_assign(&mut self, other: u32)
fn mul_assign(&mut self, other: u32)
*=
operation. Read moresource§impl MulAssign for UVec3
impl MulAssign for UVec3
source§fn mul_assign(&mut self, other: UVec3)
fn mul_assign(&mut self, other: UVec3)
*=
operation. Read moresource§impl PartialEq for UVec3
impl PartialEq for UVec3
source§impl SubAssign<u32> for UVec3
impl SubAssign<u32> for UVec3
source§fn sub_assign(&mut self, other: u32)
fn sub_assign(&mut self, other: u32)
-=
operation. Read moresource§impl SubAssign for UVec3
impl SubAssign for UVec3
source§fn sub_assign(&mut self, other: UVec3)
fn sub_assign(&mut self, other: UVec3)
-=
operation. Read more