pub struct IVec3(/* private fields */);Expand description
A 3-dimensional vector.
Implementations§
source§impl IVec3
impl IVec3
sourcepub fn truncate(self) -> IVec2
pub fn truncate(self) -> IVec2
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: IVec3, if_false: IVec3) -> IVec3
pub fn select(mask: BVec3, if_true: IVec3, if_false: IVec3) -> IVec3
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) -> 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: 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: &[i32]) -> Self
pub fn from_slice(slice: &[i32]) -> 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 [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) -> Self
pub fn abs(self) -> Self
Returns a vector containing the absolute value of each element of self.
Trait Implementations§
source§impl AddAssign<i32> for IVec3
impl AddAssign<i32> for IVec3
source§fn add_assign(&mut self, other: i32)
fn add_assign(&mut self, other: i32)
+= operation. Read moresource§impl AddAssign for IVec3
impl AddAssign for IVec3
source§fn add_assign(&mut self, other: IVec3)
fn add_assign(&mut self, other: IVec3)
+= operation. Read moresource§impl<'de> Deserialize<'de> for IVec3
impl<'de> Deserialize<'de> for IVec3
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<IVec3> for Standard
impl Distribution<IVec3> for Standard
source§impl DivAssign<i32> for IVec3
impl DivAssign<i32> for IVec3
source§fn div_assign(&mut self, other: i32)
fn div_assign(&mut self, other: i32)
/= operation. Read moresource§impl DivAssign for IVec3
impl DivAssign for IVec3
source§fn div_assign(&mut self, other: IVec3)
fn div_assign(&mut self, other: IVec3)
/= operation. Read moresource§impl MulAssign<i32> for IVec3
impl MulAssign<i32> for IVec3
source§fn mul_assign(&mut self, other: i32)
fn mul_assign(&mut self, other: i32)
*= operation. Read moresource§impl MulAssign for IVec3
impl MulAssign for IVec3
source§fn mul_assign(&mut self, other: IVec3)
fn mul_assign(&mut self, other: IVec3)
*= operation. Read moresource§impl PartialEq for IVec3
impl PartialEq for IVec3
source§impl SubAssign<i32> for IVec3
impl SubAssign<i32> for IVec3
source§fn sub_assign(&mut self, other: i32)
fn sub_assign(&mut self, other: i32)
-= operation. Read moresource§impl SubAssign for IVec3
impl SubAssign for IVec3
source§fn sub_assign(&mut self, other: IVec3)
fn sub_assign(&mut self, other: IVec3)
-= operation. Read more