Struct nannou_core::prelude::IVec2
source · pub struct IVec2(/* private fields */);
Expand description
A 2-dimensional vector.
Implementations§
source§impl IVec2
impl IVec2
sourcepub fn select(mask: BVec2, if_true: IVec2, if_false: IVec2) -> IVec2
pub fn select(mask: BVec2, if_true: IVec2, if_false: IVec2) -> IVec2
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: IVec2) -> IVec2
pub fn min(self, other: IVec2) -> IVec2
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: IVec2) -> IVec2
pub fn max(self, other: IVec2) -> IVec2
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: IVec2, max: IVec2) -> IVec2
pub fn clamp(self, min: IVec2, max: IVec2) -> IVec2
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) -> i32
pub fn min_element(self) -> i32
Returns the horizontal minimum of self
.
In other words this computes min(x, y, ..)
.
sourcepub fn max_element(self) -> i32
pub fn max_element(self) -> i32
Returns the horizontal maximum of self
.
In other words this computes max(x, y, ..)
.
sourcepub fn cmpeq(self, other: IVec2) -> BVec2
pub fn cmpeq(self, other: IVec2) -> 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: IVec2) -> BVec2
pub fn cmpne(self, other: IVec2) -> 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: IVec2) -> BVec2
pub fn cmpge(self, other: IVec2) -> 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: IVec2) -> BVec2
pub fn cmpgt(self, other: IVec2) -> 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: IVec2) -> BVec2
pub fn cmple(self, other: IVec2) -> 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: IVec2) -> BVec2
pub fn cmplt(self, other: IVec2) -> 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: &[i32]) -> IVec2
pub fn from_slice(slice: &[i32]) -> IVec2
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 [i32])
pub fn write_to_slice(self, slice: &mut [i32])
Writes the elements of self
to the first N elements in slice
.
Panics
Panics if slice
is less than N elements long.
sourcepub fn abs(self) -> IVec2
pub fn abs(self) -> IVec2
Returns a vector containing the absolute value of each element of self
.
sourcepub fn signum(self) -> IVec2
pub fn signum(self) -> IVec2
Returns a vector with elements representing the sign of self
.
1.0
if the number is positive,+0.0
orINFINITY
-1.0
if the number is negative,-0.0
orNEG_INFINITY
NAN
if the number isNAN
Trait Implementations§
source§impl AddAssign<i32> for IVec2
impl AddAssign<i32> for IVec2
source§fn add_assign(&mut self, other: i32)
fn add_assign(&mut self, other: i32)
+=
operation. Read moresource§impl AddAssign for IVec2
impl AddAssign for IVec2
source§fn add_assign(&mut self, other: IVec2)
fn add_assign(&mut self, other: IVec2)
+=
operation. Read moresource§impl<'de> Deserialize<'de> for IVec2
impl<'de> Deserialize<'de> for IVec2
source§fn deserialize<D>(
deserializer: D
) -> Result<IVec2, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<IVec2, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl Distribution<IVec2> for Standard
impl Distribution<IVec2> for Standard
source§impl DivAssign<i32> for IVec2
impl DivAssign<i32> for IVec2
source§fn div_assign(&mut self, other: i32)
fn div_assign(&mut self, other: i32)
/=
operation. Read moresource§impl DivAssign for IVec2
impl DivAssign for IVec2
source§fn div_assign(&mut self, other: IVec2)
fn div_assign(&mut self, other: IVec2)
/=
operation. Read moresource§impl MulAssign<i32> for IVec2
impl MulAssign<i32> for IVec2
source§fn mul_assign(&mut self, other: i32)
fn mul_assign(&mut self, other: i32)
*=
operation. Read moresource§impl MulAssign for IVec2
impl MulAssign for IVec2
source§fn mul_assign(&mut self, other: IVec2)
fn mul_assign(&mut self, other: IVec2)
*=
operation. Read moresource§impl PartialEq for IVec2
impl PartialEq for IVec2
source§impl Serialize for IVec2
impl Serialize for IVec2
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<i32> for IVec2
impl SubAssign<i32> for IVec2
source§fn sub_assign(&mut self, other: i32)
fn sub_assign(&mut self, other: i32)
-=
operation. Read moresource§impl SubAssign for IVec2
impl SubAssign for IVec2
source§fn sub_assign(&mut self, other: IVec2)
fn sub_assign(&mut self, other: IVec2)
-=
operation. Read moresource§impl Vec2Swizzles for IVec2
impl Vec2Swizzles for IVec2
type Vec3 = IVec3
type Vec4 = IVec4
fn xxxx(self) -> IVec4
fn xxxy(self) -> IVec4
fn xxyx(self) -> IVec4
fn xxyy(self) -> IVec4
fn xyxx(self) -> IVec4
fn xyxy(self) -> IVec4
fn xyyx(self) -> IVec4
fn xyyy(self) -> IVec4
fn yxxx(self) -> IVec4
fn yxxy(self) -> IVec4
fn yxyx(self) -> IVec4
fn yxyy(self) -> IVec4
fn yyxx(self) -> IVec4
fn yyxy(self) -> IVec4
fn yyyx(self) -> IVec4
fn yyyy(self) -> IVec4
fn xxx(self) -> IVec3
fn xxy(self) -> IVec3
fn xyx(self) -> IVec3
fn xyy(self) -> IVec3
fn yxx(self) -> IVec3
fn yxy(self) -> IVec3
fn yyx(self) -> IVec3
fn yyy(self) -> IVec3
fn xx(self) -> IVec2
fn yx(self) -> IVec2
fn yy(self) -> IVec2
fn xy(self) -> Self
impl Copy for IVec2
impl Eq for IVec2
Auto Trait Implementations§
impl RefUnwindSafe for IVec2
impl Send for IVec2
impl Sync for IVec2
impl Unpin for IVec2
impl UnwindSafe for IVec2
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