Struct ultraviolet::mat::Mat2x8
source · #[repr(C)]pub struct Mat2x8 {
pub cols: [Vec2x8; 2],
}
Expand description
A 2x2 square matrix.
Useful for performing linear transformations (rotation, scaling) on 2d vectors.
Fields§
§cols: [Vec2x8; 2]
Implementations§
source§impl Mat2x8
impl Mat2x8
pub const fn new(col1: Vec2x8, col2: Vec2x8) -> Self
pub fn identity() -> Self
sourcepub fn into_homogeneous(self) -> Mat3x8
pub fn into_homogeneous(self) -> Mat3x8
Turn this into a homogeneous 2d transformation matrix.
pub fn transpose(&mut self)
pub fn transposed(&self) -> Self
pub fn determinant(&self) -> f32x8
sourcepub fn adjugate(&self) -> Self
pub fn adjugate(&self) -> Self
The adjugate of this matrix, i.e. the transpose of the cofactor matrix.
This is equivalent to the inverse but without dividing by the determinant of the matrix, which can be useful in some contexts for better performance.
One such case is when this matrix is interpreted as a a homogeneous transformation matrix, in which case uniform scaling will not affect the resulting projected 3d version of transformed points or vectors.
sourcepub fn inverse(&mut self)
pub fn inverse(&mut self)
If this matrix is not currently invertable, this function will return an invalid inverse. This status is not checked by the library.
sourcepub fn inversed(&self) -> Self
pub fn inversed(&self) -> Self
If this matrix is not currently invertable, this function will return an invalid inverse. This status is not checked by the library.
sourcepub fn layout() -> Layout
pub fn layout() -> Layout
Get the core::alloc::Layout
of Self
sourcepub fn as_array(&self) -> &[f32x8; 4]
pub fn as_array(&self) -> &[f32x8; 4]
Interpret self
as a statically-sized array of its base numeric type
sourcepub fn as_mut_array(&mut self) -> &mut [f32x8; 4]
pub fn as_mut_array(&mut self) -> &mut [f32x8; 4]
Interpret self
as a statically-sized array of its base numeric type
sourcepub fn as_component_array(&self) -> &[Vec2x8; 2]
pub fn as_component_array(&self) -> &[Vec2x8; 2]
Interpret self
as a statically-sized array of its component (column) vector type
sourcepub fn as_mut_component_array(&mut self) -> &mut [Vec2x8; 2]
pub fn as_mut_component_array(&mut self) -> &mut [Vec2x8; 2]
Interpret self
as a statically-sized array of its component (column) vector type
sourcepub fn as_mut_slice(&mut self) -> &mut [f32x8]
pub fn as_mut_slice(&mut self) -> &mut [f32x8]
Interpret self
as a slice of its base numeric type
sourcepub fn as_component_slice(&self) -> &[Vec2x8]
pub fn as_component_slice(&self) -> &[Vec2x8]
Interpret self
as a slice of its component (column) vector type
sourcepub fn as_mut_component_slice(&mut self) -> &mut [Vec2x8]
pub fn as_mut_component_slice(&mut self) -> &mut [Vec2x8]
Interpret self
as a slice of its component (column) vector type
sourcepub fn as_byte_slice(&self) -> &[u8] ⓘ
pub fn as_byte_slice(&self) -> &[u8] ⓘ
Interpret self
as a slice of bytes
sourcepub fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
pub fn as_mut_byte_slice(&mut self) -> &mut [u8] ⓘ
Interpret self
as a slice of bytes
sourcepub const fn as_ptr(&self) -> *const f32x8
pub const fn as_ptr(&self) -> *const f32x8
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 f32x8
pub fn as_mut_ptr(&mut self) -> *mut f32x8
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§
source§impl AddAssign<Mat2x8> for Mat2x8
impl AddAssign<Mat2x8> for Mat2x8
source§fn add_assign(&mut self, rhs: Mat2x8)
fn add_assign(&mut self, rhs: Mat2x8)
+=
operation. Read more