Struct ultraviolet::mat::DMat2
source · [−]Expand description
A 2x2 square matrix.
Useful for performing linear transformations (rotation, scaling) on 2d vectors.
Fields
cols: [DVec2; 2]
Implementations
sourceimpl DMat2
impl DMat2
pub const fn new(col1: DVec2, col2: DVec2) -> Self
pub fn identity() -> Self
sourcepub fn into_homogeneous(self) -> DMat3
pub fn into_homogeneous(self) -> DMat3
Turn this into a homogeneous 2d transformation matrix.
pub fn transpose(&mut self)
pub fn transposed(&self) -> Self
pub fn determinant(&self) -> f64
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.
pub fn layout() -> Layout
pub fn as_array(&self) -> &[f64; 4]
pub fn as_component_array(&self) -> &[DVec2; 2]
pub fn as_slice(&self) -> &[f64]
pub fn as_component_slice(&self) -> &[DVec2]
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 [f64]
pub fn as_mut_component_slice(&mut self) -> &mut [DVec2]
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 const fn as_ptr(&self) -> *const f64
pub const fn as_ptr(&self) -> *const f64
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 f64
pub fn as_mut_ptr(&mut self) -> *mut f64
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<DMat2> for DMat2
impl AddAssign<DMat2> for DMat2
sourcefn add_assign(&mut self, rhs: DMat2)
fn add_assign(&mut self, rhs: DMat2)
Performs the +=
operation. Read more
sourceimpl<'de> Deserialize<'de> for DMat2
impl<'de> Deserialize<'de> for DMat2
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 From<ColumnMatrix2<f64>> for DMat2
impl From<ColumnMatrix2<f64>> for DMat2
sourcefn from(v: ColumnMatrix2<f64>) -> Self
fn from(v: ColumnMatrix2<f64>) -> Self
Performs the conversion.
sourceimpl From<DMat2> for ColumnMatrix2<f64>
impl From<DMat2> for ColumnMatrix2<f64>
impl Copy for DMat2
impl Pod for DMat2
impl StructuralPartialEq for DMat2
Auto Trait Implementations
impl RefUnwindSafe for DMat2
impl Send for DMat2
impl Sync for DMat2
impl Unpin for DMat2
impl UnwindSafe for DMat2
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