#[repr(C, packed)]pub struct Matrix2<S> {
pub x: Vector2<S>,
pub y: Vector2<S>,
}
Expand description
A 2 x 2, column major matrix
This type is marked as #[repr(C, packed)]
.
Fields§
§x: Vector2<S>
The first column of the matrix.
y: Vector2<S>
The second column of the matrix.
Implementations§
source§impl<S: BaseFloat> Matrix2<S>
impl<S: BaseFloat> Matrix2<S>
sourcepub fn new(c0r0: S, c0r1: S, c1r0: S, c1r1: S) -> Matrix2<S>
pub fn new(c0r0: S, c0r1: S, c1r0: S, c1r1: S) -> Matrix2<S>
Create a new matrix, providing values for each index.
sourcepub fn from_cols(c0: Vector2<S>, c1: Vector2<S>) -> Matrix2<S>
pub fn from_cols(c0: Vector2<S>, c1: Vector2<S>) -> Matrix2<S>
Create a new matrix, providing columns.
sourcepub fn look_at(dir: Vector2<S>, up: Vector2<S>) -> Matrix2<S>
pub fn look_at(dir: Vector2<S>, up: Vector2<S>) -> Matrix2<S>
Create a transformation matrix that will cause a vector to point at
dir
, using up
for orientation.
pub fn from_angle<A: Into<Rad<S>>>(theta: A) -> Matrix2<S>
Trait Implementations§
source§impl<S: BaseFloat + AddAssign<S>> AddAssign<Matrix2<S>> for Matrix2<S>
impl<S: BaseFloat + AddAssign<S>> AddAssign<Matrix2<S>> for Matrix2<S>
source§fn add_assign(&mut self, other: Matrix2<S>)
fn add_assign(&mut self, other: Matrix2<S>)
Performs the
+=
operation. Read moresource§impl<S: BaseFloat + DivAssign<S>> DivAssign<S> for Matrix2<S>
impl<S: BaseFloat + DivAssign<S>> DivAssign<S> for Matrix2<S>
source§fn div_assign(&mut self, scalar: S)
fn div_assign(&mut self, scalar: S)
Performs the
/=
operation. Read moresource§impl<S: BaseFloat> Matrix for Matrix2<S>
impl<S: BaseFloat> Matrix for Matrix2<S>
source§impl<S: BaseFloat + MulAssign<S>> MulAssign<S> for Matrix2<S>
impl<S: BaseFloat + MulAssign<S>> MulAssign<S> for Matrix2<S>
source§fn mul_assign(&mut self, scalar: S)
fn mul_assign(&mut self, scalar: S)
Performs the
*=
operation. Read moresource§impl<S: PartialEq + Copy> PartialEq<Matrix2<S>> for Matrix2<S>
impl<S: PartialEq + Copy> PartialEq<Matrix2<S>> for Matrix2<S>
source§impl<S: BaseFloat + RemAssign<S>> RemAssign<S> for Matrix2<S>
impl<S: BaseFloat + RemAssign<S>> RemAssign<S> for Matrix2<S>
source§fn rem_assign(&mut self, scalar: S)
fn rem_assign(&mut self, scalar: S)
Performs the
%=
operation. Read moresource§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 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 identity() -> Self
fn identity() -> Self
The identity matrix. Multiplying this matrix with another should have
no effect. Read more
source§fn trace(&self) -> Self::Scalar
fn trace(&self) -> Self::Scalar
Return the trace of this matrix. That is, the sum of the diagonal.
source§fn is_invertible(&self) -> bool
fn is_invertible(&self) -> bool
Test if this matrix is invertible.
source§fn is_identity(&self) -> bool
fn is_identity(&self) -> bool
Test if this matrix is the identity matrix. That is, it is diagonal
and every element in the diagonal is one.
source§impl<S: BaseFloat + SubAssign<S>> SubAssign<Matrix2<S>> for Matrix2<S>
impl<S: BaseFloat + SubAssign<S>> SubAssign<Matrix2<S>> for Matrix2<S>
source§fn sub_assign(&mut self, other: Matrix2<S>)
fn sub_assign(&mut self, other: Matrix2<S>)
Performs the
-=
operation. Read moreimpl<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