#[repr(transparent)]pub struct UVec2(_);
Expand description
A 2-dimensional vector.
Implementations
sourceimpl UVec2
impl UVec2
sourcepub const X: UVec2 = Self(XYU32::X)
pub const X: UVec2 = Self(XYU32::X)
[1, 0]
: a unit-length vector pointing along the positive X axis.
sourcepub const Y: UVec2 = Self(XYU32::Y)
pub const Y: UVec2 = Self(XYU32::Y)
[0, 1]
: a unit-length vector pointing along the positive Y axis.
sourcepub const fn unit_x() -> UVec2
👎 Deprecated: Use Vec2::X instead
pub const fn unit_x() -> UVec2
Use Vec2::X instead
Creates a vector with values [x: 1.0, y: 0.0]
.
sourcepub const fn unit_y() -> UVec2
👎 Deprecated: Use Vec2::Y instead
pub const fn unit_y() -> UVec2
Use Vec2::Y instead
Creates a vector with values [x: 0.0, y: 1.0]
.
sourcepub const fn zero() -> UVec2
👎 Deprecated: use ZERO constant instead
pub const fn zero() -> UVec2
use ZERO constant instead
Creates a vector with all elements set to 0.0
.
sourcepub const fn one() -> UVec2
👎 Deprecated: use ONE constant instead
pub const fn one() -> UVec2
use ONE constant instead
Creates a vector with all elements set to 1.0
.
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 [std::f32::clamp
].
Each element in min
must be less-or-equal to the corresponing element in max
.
If the glam-assert
feature is enabled, the function will panic if the contract is not
met, otherwise the behavior is undefined.
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_unaligned(slice: &[u32]) -> UVec2
pub fn from_slice_unaligned(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_unaligned(self, slice: &mut [u32])
pub fn write_to_slice_unaligned(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
sourceimpl AddAssign<UVec2> for UVec2
impl AddAssign<UVec2> for UVec2
sourcefn add_assign(&mut self, other: UVec2)
fn add_assign(&mut self, other: UVec2)
Performs the +=
operation. Read more
sourceimpl DivAssign<UVec2> for UVec2
impl DivAssign<UVec2> for UVec2
sourcefn div_assign(&mut self, other: UVec2)
fn div_assign(&mut self, other: UVec2)
Performs the /=
operation. Read more
sourceimpl DivAssign<u32> for UVec2
impl DivAssign<u32> for UVec2
sourcefn div_assign(&mut self, other: u32)
fn div_assign(&mut self, other: u32)
Performs the /=
operation. Read more
sourceimpl MulAssign<UVec2> for UVec2
impl MulAssign<UVec2> for UVec2
sourcefn mul_assign(&mut self, other: UVec2)
fn mul_assign(&mut self, other: UVec2)
Performs the *=
operation. Read more
sourceimpl MulAssign<u32> for UVec2
impl MulAssign<u32> for UVec2
sourcefn mul_assign(&mut self, other: u32)
fn mul_assign(&mut self, other: u32)
Performs the *=
operation. Read more
sourceimpl PartialOrd<UVec2> for UVec2
impl PartialOrd<UVec2> for UVec2
sourcefn partial_cmp(&self, other: &UVec2) -> Option<Ordering>
fn partial_cmp(&self, other: &UVec2) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl SubAssign<UVec2> for UVec2
impl SubAssign<UVec2> for UVec2
sourcefn sub_assign(&mut self, other: UVec2)
fn sub_assign(&mut self, other: UVec2)
Performs the -=
operation. Read more
sourceimpl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more