Struct nannou_core::prelude::UVec2
source · pub struct UVec2(/* private fields */);
Expand description
A 2-dimensional vector.
Implementations§
source§impl UVec2
impl UVec2
sourcepub fn select(mask: BVec2, if_true: UVec2, if_false: UVec2) -> UVec2
pub fn select(mask: BVec2, if_true: UVec2, if_false: UVec2) -> UVec2
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: UVec2) -> UVec2
pub fn min(self, other: UVec2) -> UVec2
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: UVec2) -> UVec2
pub fn max(self, other: UVec2) -> UVec2
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: UVec2, max: UVec2) -> UVec2
pub fn clamp(self, min: UVec2, max: UVec2) -> UVec2
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: UVec2) -> BVec2
pub fn cmpeq(self, other: UVec2) -> BVec2
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: UVec2) -> BVec2
pub fn cmpne(self, other: UVec2) -> BVec2
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: UVec2) -> BVec2
pub fn cmpge(self, other: UVec2) -> BVec2
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: UVec2) -> BVec2
pub fn cmpgt(self, other: UVec2) -> BVec2
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: UVec2) -> BVec2
pub fn cmple(self, other: UVec2) -> BVec2
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: UVec2) -> BVec2
pub fn cmplt(self, other: UVec2) -> BVec2
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]) -> UVec2
pub fn from_slice(slice: &[u32]) -> UVec2
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 UVec2
impl AddAssign<u32> for UVec2
source§fn add_assign(&mut self, other: u32)
fn add_assign(&mut self, other: u32)
+=
operation. Read moresource§impl AddAssign for UVec2
impl AddAssign for UVec2
source§fn add_assign(&mut self, other: UVec2)
fn add_assign(&mut self, other: UVec2)
+=
operation. Read moresource§impl<'de> Deserialize<'de> for UVec2
impl<'de> Deserialize<'de> for UVec2
source§fn deserialize<D>(
deserializer: D
) -> Result<UVec2, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<UVec2, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl Distribution<UVec2> for Standard
impl Distribution<UVec2> for Standard
source§impl DivAssign<u32> for UVec2
impl DivAssign<u32> for UVec2
source§fn div_assign(&mut self, other: u32)
fn div_assign(&mut self, other: u32)
/=
operation. Read moresource§impl DivAssign for UVec2
impl DivAssign for UVec2
source§fn div_assign(&mut self, other: UVec2)
fn div_assign(&mut self, other: UVec2)
/=
operation. Read moresource§impl MulAssign<u32> for UVec2
impl MulAssign<u32> for UVec2
source§fn mul_assign(&mut self, other: u32)
fn mul_assign(&mut self, other: u32)
*=
operation. Read moresource§impl MulAssign for UVec2
impl MulAssign for UVec2
source§fn mul_assign(&mut self, other: UVec2)
fn mul_assign(&mut self, other: UVec2)
*=
operation. Read moresource§impl PartialEq for UVec2
impl PartialEq for UVec2
source§impl Serialize for UVec2
impl Serialize for UVec2
source§fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
source§impl SubAssign<u32> for UVec2
impl SubAssign<u32> for UVec2
source§fn sub_assign(&mut self, other: u32)
fn sub_assign(&mut self, other: u32)
-=
operation. Read moresource§impl SubAssign for UVec2
impl SubAssign for UVec2
source§fn sub_assign(&mut self, other: UVec2)
fn sub_assign(&mut self, other: UVec2)
-=
operation. Read moresource§impl Vec2Swizzles for UVec2
impl Vec2Swizzles for UVec2
type Vec3 = UVec3
type Vec4 = UVec4
fn xxxx(self) -> UVec4
fn xxxy(self) -> UVec4
fn xxyx(self) -> UVec4
fn xxyy(self) -> UVec4
fn xyxx(self) -> UVec4
fn xyxy(self) -> UVec4
fn xyyx(self) -> UVec4
fn xyyy(self) -> UVec4
fn yxxx(self) -> UVec4
fn yxxy(self) -> UVec4
fn yxyx(self) -> UVec4
fn yxyy(self) -> UVec4
fn yyxx(self) -> UVec4
fn yyxy(self) -> UVec4
fn yyyx(self) -> UVec4
fn yyyy(self) -> UVec4
fn xxx(self) -> UVec3
fn xxy(self) -> UVec3
fn xyx(self) -> UVec3
fn xyy(self) -> UVec3
fn yxx(self) -> UVec3
fn yxy(self) -> UVec3
fn yyx(self) -> UVec3
fn yyy(self) -> UVec3
fn xx(self) -> UVec2
fn yx(self) -> UVec2
fn yy(self) -> UVec2
fn xy(self) -> Self
impl Copy for UVec2
impl Eq for UVec2
Auto Trait Implementations§
impl RefUnwindSafe for UVec2
impl Send for UVec2
impl Sync for UVec2
impl Unpin for UVec2
impl UnwindSafe for UVec2
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more