#[repr(C)]pub struct Size3<T: Unit = f32> {
pub width: T::Scalar,
pub height: T::Scalar,
pub depth: T::Scalar,
}
Expand description
3D size.
Fields§
§width: T::Scalar
Width
height: T::Scalar
Height
depth: T::Scalar
Depth
Implementations§
source§impl<T: Unit> Size3<T>
impl<T: Unit> Size3<T>
sourcepub fn from_vector(vec: Vector3<T>) -> Self
pub fn from_vector(vec: Vector3<T>) -> Self
Interpret vec
as size.
sourcepub fn as_vector_mut(&mut self) -> &mut Vector3<T>
pub fn as_vector_mut(&mut self) -> &mut Vector3<T>
Reinterpret as vector.
sourcepub fn with_width(self, width: T::Scalar) -> Self
pub fn with_width(self, width: T::Scalar) -> Self
Replace the width component with a new value.
sourcepub fn with_height(self, height: T::Scalar) -> Self
pub fn with_height(self, height: T::Scalar) -> Self
Replace the width component with a new value.
source§impl<T: Unit> Size3<T>
impl<T: Unit> Size3<T>
sourcepub fn from_array(array: [T::Scalar; 3]) -> Self
pub fn from_array(array: [T::Scalar; 3]) -> Self
Instantiate from array.
See glam::Vec3::from_array()
.
sourcepub fn to_array(self) -> [T::Scalar; 3]
pub fn to_array(self) -> [T::Scalar; 3]
Convert to array.
See glam::Vec3::to_array()
.
sourcepub fn splat(scalar: T::Scalar) -> Self
pub fn splat(scalar: T::Scalar) -> Self
Instance with all components set to scalar
.
See glam::Vec3::splat()
.
sourcepub fn write_to_slice(self, slice: &mut [T::Scalar])
pub fn write_to_slice(self, slice: &mut [T::Scalar])
Write all components to slice.
sourcepub fn cmpeq(self, other: Self) -> BVec3
pub fn cmpeq(self, other: Self) -> BVec3
Return a mask with the result of a component-wise equals comparison.
See glam::Vec3::cmpeq()
.
sourcepub fn cmpne(self, other: Self) -> BVec3
pub fn cmpne(self, other: Self) -> BVec3
Return a mask with the result of a component-wise not-equal comparison.
See glam::Vec3::cmpne()
.
sourcepub fn cmpge(self, other: Self) -> BVec3
pub fn cmpge(self, other: Self) -> BVec3
Return a mask with the result of a component-wise greater-than-or-equal comparison.
See glam::Vec3::cmpge()
.
sourcepub fn cmpgt(self, other: Self) -> BVec3
pub fn cmpgt(self, other: Self) -> BVec3
Return a mask with the result of a component-wise greater-than comparison.
See glam::Vec3::cmpgt()
.
sourcepub fn cmple(self, other: Self) -> BVec3
pub fn cmple(self, other: Self) -> BVec3
Return a mask with the result of a component-wise less-than-or-equal comparison.
See glam::Vec3::cmple()
.
sourcepub fn cmplt(self, other: Self) -> BVec3
pub fn cmplt(self, other: Self) -> BVec3
Return a mask with the result of a component-wise less-than comparison.
See glam::Vec3::cmplt()
.
sourcepub fn min(self, other: Self) -> Self
pub fn min(self, other: Self) -> Self
Minimum by component.
See glam::Vec3::min()
.
sourcepub fn max(self, other: Self) -> Self
pub fn max(self, other: Self) -> Self
Maximum by component.
See glam::Vec3::max()
.
sourcepub fn min_element(self) -> T::Scalar
pub fn min_element(self) -> T::Scalar
Horizontal minimum (smallest component).
See glam::Vec3::min_element()
.
sourcepub fn max_element(self) -> T::Scalar
pub fn max_element(self) -> T::Scalar
Horizontal maximum (largest component).
See glam::Vec3::max_element()
.
sourcepub fn clamp(self, min: Self, max: Self) -> Self
pub fn clamp(self, min: Self, max: Self) -> Self
Component-wise clamp.
See glam::Vec3::clamp()
.
sourcepub fn select(mask: BVec3, a: Self, b: Self) -> Self
pub fn select(mask: BVec3, a: Self, b: Self) -> Self
Select components from two instances based on a mask.
See glam::Vec3::select()
.
sourcepub fn from_untyped(untyped: Size3<T::Scalar>) -> Size3<T>
pub fn from_untyped(untyped: Size3<T::Scalar>) -> Size3<T>
Bitcast an untyped instance to self.
sourcepub fn to_untyped(self) -> Size3<T::Scalar>
pub fn to_untyped(self) -> Size3<T::Scalar>
Bitcast self to an untyped instance.
sourcepub fn as_untyped(&self) -> &Size3<T::Scalar>
pub fn as_untyped(&self) -> &Size3<T::Scalar>
Reinterpret cast self as the untyped variant.
sourcepub fn as_untyped_mut(&mut self) -> &mut Size3<T::Scalar>
pub fn as_untyped_mut(&mut self) -> &mut Size3<T::Scalar>
Reinterpret cast self as the untyped variant.
sourcepub fn cast<T2>(self) -> Size3<T2>
pub fn cast<T2>(self) -> Size3<T2>
Cast to a different coordinate space with the same underlying scalar type.
sourcepub fn cast_ref<T2>(&self) -> &Size3<T2>
pub fn cast_ref<T2>(&self) -> &Size3<T2>
Cast to a different coordinate space with the same underlying scalar type.
sourcepub fn cast_mut<T2>(&mut self) -> &mut Size3<T2>
pub fn cast_mut<T2>(&mut self) -> &mut Size3<T2>
Cast to a different coordinate space with the same underlying scalar type.
sourcepub fn try_cast<T2>(self) -> Option<Size3<T2>>where
T2: Unit,
pub fn try_cast<T2>(self) -> Option<Size3<T2>>where
T2: Unit,
Cast to a different coordinate space with scalar type conversion. Returns None
if any component could not be converted to the target scalar type.
sourcepub const fn from_tuple(
(width, height, depth): (T::Scalar, T::Scalar, T::Scalar)
) -> Self
pub const fn from_tuple( (width, height, depth): (T::Scalar, T::Scalar, T::Scalar) ) -> Self
Instantiate from tuple.
sourcepub fn as_array_mut(&mut self) -> &mut [T::Scalar; 3]
pub fn as_array_mut(&mut self) -> &mut [T::Scalar; 3]
Reinterpret as mutable array.
sourcepub fn truncate(self) -> Size2<T>
pub fn truncate(self) -> Size2<T>
Truncate to Size2
.
See glam::Vec3::truncate()
.
sourcepub fn with_depth(self, depth: T::Scalar) -> Self
pub fn with_depth(self, depth: T::Scalar) -> Self
Replace the depth component with a new value.
source§impl<T> Size3<T>
impl<T> Size3<T>
sourcepub const NEG_INFINITY: Self = _
pub const NEG_INFINITY: Self = _
All negative infinity.
sourcepub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
True if all components are non-infinity and non-NaN.
See glam::Vec3::is_finite()
.
sourcepub fn is_nan(&self) -> bool
pub fn is_nan(&self) -> bool
True if any component is NaN.
See glam::Vec3::is_nan()
.
sourcepub fn is_nan_mask(&self) -> BVec3
pub fn is_nan_mask(&self) -> BVec3
Return a mask where each bit is set if the corresponding component is NaN.
See glam::Vec3::is_nan_mask()
.
sourcepub fn ceil(self) -> Self
pub fn ceil(self) -> Self
Round all components up.
See glam::Vec3::ceil()
.
sourcepub fn floor(self) -> Self
pub fn floor(self) -> Self
Round all components down.
See glam::Vec3::floor()
.
sourcepub fn round(self) -> Self
pub fn round(self) -> Self
Round all components.
See glam::Vec3::round()
.
sourcepub fn fract(self) -> Self
pub fn fract(self) -> Self
See (e.g.) glam::Vec2::fract()
See glam::Vec3::fract()
.
sourcepub fn fract_gl(self) -> Self
pub fn fract_gl(self) -> Self
See (e.g.) glam::Vec2::fract_gl()
See glam::Vec3::fract_gl()
.
sourcepub fn lerp(self, other: Self, t: T::Scalar) -> Self
pub fn lerp(self, other: Self, t: T::Scalar) -> Self
Linear interpolation.
See glam::Vec3::lerp()
.
Trait Implementations§
source§impl<T: Unit> AbsDiffEq for Size3<T>
impl<T: Unit> AbsDiffEq for Size3<T>
§type Epsilon = <<T as Unit>::Scalar as AbsDiffEq>::Epsilon
type Epsilon = <<T as Unit>::Scalar as AbsDiffEq>::Epsilon
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
source§fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
source§fn abs_diff_ne(&self, other: &Self, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Self, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq
.source§impl<T: Unit> AddAssign for Size3<T>
impl<T: Unit> AddAssign for Size3<T>
source§fn add_assign(&mut self, other: Self)
fn add_assign(&mut self, other: Self)
+=
operation. Read moresource§impl<T> BorrowMut<DVec3> for Size3<T>
impl<T> BorrowMut<DVec3> for Size3<T>
source§fn borrow_mut(&mut self) -> &mut DVec3
fn borrow_mut(&mut self) -> &mut DVec3
source§impl<T> BorrowMut<I64Vec3> for Size3<T>
impl<T> BorrowMut<I64Vec3> for Size3<T>
source§fn borrow_mut(&mut self) -> &mut I64Vec3
fn borrow_mut(&mut self) -> &mut I64Vec3
source§impl<T> BorrowMut<IVec3> for Size3<T>
impl<T> BorrowMut<IVec3> for Size3<T>
source§fn borrow_mut(&mut self) -> &mut IVec3
fn borrow_mut(&mut self) -> &mut IVec3
source§impl<T> BorrowMut<Size3<T>> for DVec3
impl<T> BorrowMut<Size3<T>> for DVec3
source§fn borrow_mut(&mut self) -> &mut Size3<T>
fn borrow_mut(&mut self) -> &mut Size3<T>
source§impl<T> BorrowMut<Size3<T>> for I64Vec3
impl<T> BorrowMut<Size3<T>> for I64Vec3
source§fn borrow_mut(&mut self) -> &mut Size3<T>
fn borrow_mut(&mut self) -> &mut Size3<T>
source§impl<T> BorrowMut<Size3<T>> for IVec3
impl<T> BorrowMut<Size3<T>> for IVec3
source§fn borrow_mut(&mut self) -> &mut Size3<T>
fn borrow_mut(&mut self) -> &mut Size3<T>
source§impl<T> BorrowMut<Size3<T>> for U64Vec3
impl<T> BorrowMut<Size3<T>> for U64Vec3
source§fn borrow_mut(&mut self) -> &mut Size3<T>
fn borrow_mut(&mut self) -> &mut Size3<T>
source§impl<T> BorrowMut<Size3<T>> for UVec3
impl<T> BorrowMut<Size3<T>> for UVec3
source§fn borrow_mut(&mut self) -> &mut Size3<T>
fn borrow_mut(&mut self) -> &mut Size3<T>
source§impl<T> BorrowMut<Size3<T>> for Vec3
impl<T> BorrowMut<Size3<T>> for Vec3
source§fn borrow_mut(&mut self) -> &mut Size3<T>
fn borrow_mut(&mut self) -> &mut Size3<T>
source§impl<T> BorrowMut<U64Vec3> for Size3<T>
impl<T> BorrowMut<U64Vec3> for Size3<T>
source§fn borrow_mut(&mut self) -> &mut U64Vec3
fn borrow_mut(&mut self) -> &mut U64Vec3
source§impl<T> BorrowMut<UVec3> for Size3<T>
impl<T> BorrowMut<UVec3> for Size3<T>
source§fn borrow_mut(&mut self) -> &mut UVec3
fn borrow_mut(&mut self) -> &mut UVec3
source§impl<T> BorrowMut<Vec3> for Size3<T>
impl<T> BorrowMut<Vec3> for Size3<T>
source§fn borrow_mut(&mut self) -> &mut Vec3
fn borrow_mut(&mut self) -> &mut Vec3
source§impl<T: Unit> DivAssign<<T as Unit>::Scalar> for Size3<T>
impl<T: Unit> DivAssign<<T as Unit>::Scalar> for Size3<T>
source§fn div_assign(&mut self, other: T::Scalar)
fn div_assign(&mut self, other: T::Scalar)
/=
operation. Read moresource§impl<T: Unit> From<(<T as Unit>::Scalar, <T as Unit>::Scalar, <T as Unit>::Scalar)> for Size3<T>
impl<T: Unit> From<(<T as Unit>::Scalar, <T as Unit>::Scalar, <T as Unit>::Scalar)> for Size3<T>
source§impl<T: Unit> IntoIterator for Size3<T>
impl<T: Unit> IntoIterator for Size3<T>
source§impl<T: Unit> MulAssign<<T as Unit>::Scalar> for Size3<T>
impl<T: Unit> MulAssign<<T as Unit>::Scalar> for Size3<T>
source§fn mul_assign(&mut self, other: T::Scalar)
fn mul_assign(&mut self, other: T::Scalar)
*=
operation. Read moresource§impl<T: Unit> PartialEq<[<T as Unit>::Scalar; 3]> for Size3<T>
impl<T: Unit> PartialEq<[<T as Unit>::Scalar; 3]> for Size3<T>
source§impl<T: Unit> PartialEq<(<T as Unit>::Scalar, <T as Unit>::Scalar, <T as Unit>::Scalar)> for Size3<T>
impl<T: Unit> PartialEq<(<T as Unit>::Scalar, <T as Unit>::Scalar, <T as Unit>::Scalar)> for Size3<T>
source§impl<T: Unit> PartialEq for Size3<T>
impl<T: Unit> PartialEq for Size3<T>
source§impl<T: Unit> RelativeEq for Size3<T>where
T::Scalar: RelativeEq,
impl<T: Unit> RelativeEq for Size3<T>where
T::Scalar: RelativeEq,
source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
source§fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_eq( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool
source§fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne( &self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool
RelativeEq::relative_eq
.source§impl<T: Unit> RemAssign<<T as Unit>::Scalar> for Size3<T>
impl<T: Unit> RemAssign<<T as Unit>::Scalar> for Size3<T>
source§fn rem_assign(&mut self, other: T::Scalar)
fn rem_assign(&mut self, other: T::Scalar)
%=
operation. Read moresource§impl<T: Unit> SubAssign for Size3<T>
impl<T: Unit> SubAssign for Size3<T>
source§fn sub_assign(&mut self, other: Self)
fn sub_assign(&mut self, other: Self)
-=
operation. Read moresource§impl<T: Unit> TransparentWrapper<<<T as Unit>::Scalar as Scalar>::Vec3> for Size3<T>
impl<T: Unit> TransparentWrapper<<<T as Unit>::Scalar as Scalar>::Vec3> for Size3<T>
source§fn wrap_ref(s: &Inner) -> &Self
fn wrap_ref(s: &Inner) -> &Self
source§fn wrap_mut(s: &mut Inner) -> &mut Self
fn wrap_mut(s: &mut Inner) -> &mut Self
source§fn wrap_slice(s: &[Inner]) -> &[Self]where
Self: Sized,
fn wrap_slice(s: &[Inner]) -> &[Self]where
Self: Sized,
source§fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]where
Self: Sized,
fn wrap_slice_mut(s: &mut [Inner]) -> &mut [Self]where
Self: Sized,
source§fn peel_ref(s: &Self) -> &Inner
fn peel_ref(s: &Self) -> &Inner
source§fn peel_mut(s: &mut Self) -> &mut Inner
fn peel_mut(s: &mut Self) -> &mut Inner
source§impl<T: Unit> UlpsEq for Size3<T>
impl<T: Unit> UlpsEq for Size3<T>
impl<T: Unit> Copy for Size3<T>
impl<T> Eq for Size3<T>
impl<T: Unit> Pod for Size3<T>
SAFETY: All members are Pod
, and we are #[repr(C)]
.
Auto Trait Implementations§
impl<T> Freeze for Size3<T>
impl<T> RefUnwindSafe for Size3<T>
impl<T> Send for Size3<T>
impl<T> Sync for Size3<T>
impl<T> Unpin for Size3<T>
impl<T> UnwindSafe for Size3<T>
Blanket Implementations§
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.