pub struct Matrix2<S> {
pub x: Vector2<S>,
pub y: Vector2<S>,
}
Expand description
A 2 x 2, column major matrix
Fields§
§x: Vector2<S>
§y: Vector2<S>
Implementations§
Trait Implementations§
source§impl<S: BaseFloat> Matrix for Matrix2<S>
impl<S: BaseFloat> Matrix for Matrix2<S>
source§fn swap_columns(&mut self, a: usize, b: usize)
fn swap_columns(&mut self, a: usize, b: usize)
Swap two columns of this array.
source§fn swap_elements(&mut self, a: (usize, usize), b: (usize, usize))
fn swap_elements(&mut self, a: (usize, usize), b: (usize, usize))
Swap the values at index
a
and b
source§fn mul_s(&self, s: S) -> Matrix2<S>
fn mul_s(&self, s: S) -> Matrix2<S>
Multiply this matrix by a scalar, returning the new matrix.
source§fn mul_self_s(&mut self, s: S)
fn mul_self_s(&mut self, s: S)
Multiply this matrix by a scalar, in-place.
source§fn div_self_s(&mut self, s: S)
fn div_self_s(&mut self, s: S)
Divide this matrix by a scalar, in-place.
source§fn as_mut_ptr(&mut self) -> *mut Self::Element
fn as_mut_ptr(&mut self) -> *mut Self::Element
Get a mutable pointer to the first element of the array.
source§impl<S: PartialEq> PartialEq<Matrix2<S>> for Matrix2<S>
impl<S: PartialEq> PartialEq<Matrix2<S>> for Matrix2<S>
source§impl<S: BaseFloat> SquareMatrix for Matrix2<S>
impl<S: BaseFloat> SquareMatrix for Matrix2<S>
source§fn from_value(value: S) -> Matrix2<S>
fn from_value(value: S) -> Matrix2<S>
Create a new diagonal matrix using the supplied value.
source§fn from_diagonal(value: Vector2<S>) -> Matrix2<S>
fn from_diagonal(value: Vector2<S>) -> Matrix2<S>
Create a matrix from a non-uniform scale
source§fn one() -> Matrix2<S>
fn one() -> Matrix2<S>
Create a matrix where the each element of the diagonal is equal to one.
source§fn add_m(&self, m: &Matrix2<S>) -> Matrix2<S>
fn add_m(&self, m: &Matrix2<S>) -> Matrix2<S>
Add this matrix with another matrix, returning the new metrix.
source§fn sub_m(&self, m: &Matrix2<S>) -> Matrix2<S>
fn sub_m(&self, m: &Matrix2<S>) -> Matrix2<S>
Subtract another matrix from this matrix, returning the new matrix.
source§fn add_self_m(&mut self, m: &Matrix2<S>)
fn add_self_m(&mut self, m: &Matrix2<S>)
Add this matrix with another matrix, in-place.
source§fn sub_self_m(&mut self, m: &Matrix2<S>)
fn sub_self_m(&mut self, m: &Matrix2<S>)
Subtract another matrix from this matrix, in-place.
source§fn transpose_self(&mut self)
fn transpose_self(&mut self)
Transpose this matrix in-place.
source§fn determinant(&self) -> S
fn determinant(&self) -> S
Take the determinant of this matrix.
source§fn invert(&self) -> Option<Matrix2<S>>
fn invert(&self) -> Option<Matrix2<S>>
Invert this matrix, returning a new matrix.
m.mul_m(m.invert())
is
the identity matrix. Returns None
if this matrix is not invertible
(has a determinant of zero).source§fn is_diagonal(&self) -> bool
fn is_diagonal(&self) -> bool
Test if this is a diagonal matrix. That is, every element outside of
the diagonal is 0.
source§fn is_symmetric(&self) -> bool
fn is_symmetric(&self) -> bool
Test if this matrix is symmetric. That is, it is equal to its
transpose.
source§fn mul_self_m(&mut self, m: &Self)
fn mul_self_m(&mut self, m: &Self)
Multiply this matrix by another matrix, in-place.
source§fn trace(&self) -> Self::Element
fn trace(&self) -> Self::Element
Return the trace of this matrix. That is, the sum of the diagonal.
source§fn invert_self(&mut self)
fn invert_self(&mut self)
Invert this matrix in-place.
source§fn is_invertible(&self) -> bool
fn is_invertible(&self) -> bool
Test if this matrix is invertible.
impl<S: Copy> Copy for Matrix2<S>
impl<S> StructuralPartialEq for Matrix2<S>
Auto Trait Implementations§
impl<S> RefUnwindSafe for Matrix2<S>where S: RefUnwindSafe,
impl<S> Send for Matrix2<S>where S: Send,
impl<S> Sync for Matrix2<S>where S: Sync,
impl<S> Unpin for Matrix2<S>where S: Unpin,
impl<S> UnwindSafe for Matrix2<S>where S: UnwindSafe,
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
Mutably borrows from an owned value. Read more