Struct ultraviolet::int::IVec4
source · [−]Expand description
A set of four coordinates which may be interpreted as a point or vector in 4d space, or as a homogeneous 3d vector or point.
Generally this distinction between a point and vector is more of a pain than it is worth to distinguish on a type level, however when converting to and from homogeneous coordinates it is quite important.
Fields
x: i32
y: i32
z: i32
w: i32
Implementations
sourceimpl IVec4
impl IVec4
pub const fn new(x: i32, y: i32, z: i32, w: i32) -> Self
pub fn broadcast(val: i32) -> Self
pub fn unit_x() -> Self
pub fn unit_y() -> Self
pub fn unit_z() -> Self
pub fn unit_w() -> Self
pub fn dot(&self, other: IVec4) -> i32
pub fn reflect(&mut self, normal: IVec4)
pub fn reflected(&self, normal: IVec4) -> Self
pub fn mag(&self) -> i32
pub fn mag_sq(&self) -> i32
pub fn mul_add(&self, mul: IVec4, add: IVec4) -> Self
pub fn clamp(&mut self, min: Self, max: Self)
pub fn clamped(self, min: Self, max: Self) -> Self
pub fn map<F>(&self, f: F) -> Self where
F: FnMut(i32) -> i32,
pub fn apply<F>(&mut self, f: F) where
F: FnMut(i32) -> i32,
pub fn max_by_component(self, other: Self) -> Self
pub fn min_by_component(self, other: Self) -> Self
pub fn component_max(&self) -> i32
pub fn component_min(&self) -> i32
pub fn zero() -> Self
pub fn one() -> Self
pub fn xy(&self) -> IVec2
pub fn xyz(&self) -> IVec3
pub fn layout() -> Layout
pub fn as_slice(&self) -> &[i32]
pub fn as_array(&self) -> [i32; 4]
pub fn as_byte_slice(&self) -> &[u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
pub fn as_mut_slice(&mut self) -> &mut [i32]
pub fn as_mut_byte_slice(&mut self) -> &mut [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
sourcepub fn as_ptr(&self) -> *const i32
pub fn as_ptr(&self) -> *const i32
Returns a constant unsafe pointer to the underlying data in the underlying type. This function is safe because all types here are repr(C) and can be represented as their underlying type.
Safety
It is up to the caller to correctly use this pointer and its bounds.
sourcepub fn as_mut_ptr(&mut self) -> *mut i32
pub fn as_mut_ptr(&mut self) -> *mut i32
Returns a mutable unsafe pointer to the underlying data in the underlying type. This function is safe because all types here are repr(C) and can be represented as their underlying type.
Safety
It is up to the caller to correctly use this pointer and its bounds.
Trait Implementations
sourceimpl AddAssign<IVec4> for IVec4
impl AddAssign<IVec4> for IVec4
sourcefn add_assign(&mut self, rhs: IVec4)
fn add_assign(&mut self, rhs: IVec4)
Performs the +=
operation. Read more
sourceimpl<'de> Deserialize<'de> for IVec4
impl<'de> Deserialize<'de> for IVec4
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl DivAssign<IVec4> for IVec4
impl DivAssign<IVec4> for IVec4
sourcefn div_assign(&mut self, rhs: IVec4)
fn div_assign(&mut self, rhs: IVec4)
Performs the /=
operation. Read more
sourceimpl DivAssign<i32> for IVec4
impl DivAssign<i32> for IVec4
sourcefn div_assign(&mut self, rhs: i32)
fn div_assign(&mut self, rhs: i32)
Performs the /=
operation. Read more
sourceimpl MulAssign<IVec4> for IVec4
impl MulAssign<IVec4> for IVec4
sourcefn mul_assign(&mut self, rhs: IVec4)
fn mul_assign(&mut self, rhs: IVec4)
Performs the *=
operation. Read more
sourceimpl MulAssign<i32> for IVec4
impl MulAssign<i32> for IVec4
sourcefn mul_assign(&mut self, rhs: i32)
fn mul_assign(&mut self, rhs: i32)
Performs the *=
operation. Read more
sourceimpl SubAssign<IVec4> for IVec4
impl SubAssign<IVec4> for IVec4
sourcefn sub_assign(&mut self, rhs: IVec4)
fn sub_assign(&mut self, rhs: IVec4)
Performs the -=
operation. Read more
sourceimpl TryFrom<DVec4> for IVec4
impl TryFrom<DVec4> for IVec4
sourcefn try_from(v: DVec4) -> Result<Self, Self::Error>
fn try_from(v: DVec4) -> Result<Self, Self::Error>
Tries to convert the source to Self in a lossy way, flooring any float value.
Errors
NaN
- If a float value isNaN
.NotFinite
- If a float value is infinity or negative infinity.PosOverflow
- If a float value would be greater than the the self.component max value.NegOverflow
- If a float value would be less than the self.component min value.
type Error = FloatConversionError
type Error = FloatConversionError
The type returned in the event of a conversion error.
sourceimpl TryFrom<Vec4> for IVec4
impl TryFrom<Vec4> for IVec4
sourcefn try_from(v: Vec4) -> Result<Self, Self::Error>
fn try_from(v: Vec4) -> Result<Self, Self::Error>
Tries to convert the source to Self in a lossy way, flooring any float value.
Errors
NaN
- If a float value isNaN
.NotFinite
- If a float value is infinity or negative infinity.PosOverflow
- If a float value would be greater than the the self.component max value.NegOverflow
- If a float value would be less than the self.component min value.
type Error = FloatConversionError
type Error = FloatConversionError
The type returned in the event of a conversion error.
impl Copy for IVec4
impl Eq for IVec4
impl Pod for IVec4
impl StructuralEq for IVec4
impl StructuralPartialEq for IVec4
Auto Trait Implementations
impl RefUnwindSafe for IVec4
impl Send for IVec4
impl Sync for IVec4
impl Unpin for IVec4
impl UnwindSafe for IVec4
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more