pub struct Matrix4<S> {
pub x: Vector4<S>,
pub y: Vector4<S>,
pub z: Vector4<S>,
pub w: Vector4<S>,
}
Expand description
A 4 x 4, column major matrix
Fields§
§x: Vector4<S>
§y: Vector4<S>
§z: Vector4<S>
§w: Vector4<S>
Implementations§
source§impl<S: BaseFloat> Matrix4<S>
impl<S: BaseFloat> Matrix4<S>
sourcepub fn new(
c0r0: S,
c0r1: S,
c0r2: S,
c0r3: S,
c1r0: S,
c1r1: S,
c1r2: S,
c1r3: S,
c2r0: S,
c2r1: S,
c2r2: S,
c2r3: S,
c3r0: S,
c3r1: S,
c3r2: S,
c3r3: S
) -> Matrix4<S>
pub fn new( c0r0: S, c0r1: S, c0r2: S, c0r3: S, c1r0: S, c1r1: S, c1r2: S, c1r3: S, c2r0: S, c2r1: S, c2r2: S, c2r3: S, c3r0: S, c3r1: S, c3r2: S, c3r3: S ) -> Matrix4<S>
Create a new matrix, providing values for each index.
sourcepub fn from_cols(
c0: Vector4<S>,
c1: Vector4<S>,
c2: Vector4<S>,
c3: Vector4<S>
) -> Matrix4<S>
pub fn from_cols( c0: Vector4<S>, c1: Vector4<S>, c2: Vector4<S>, c3: Vector4<S> ) -> Matrix4<S>
Create a new matrix, providing columns.
sourcepub fn from_translation(v: Vector3<S>) -> Matrix4<S>
pub fn from_translation(v: Vector3<S>) -> Matrix4<S>
Create a homogeneous transformation matrix from a translation vector.
sourcepub fn from_scale(value: S) -> Matrix4<S>
pub fn from_scale(value: S) -> Matrix4<S>
Create a homogeneous transformation matrix from a scale value.
sourcepub fn from_nonuniform_scale(x: S, y: S, z: S) -> Matrix4<S>
pub fn from_nonuniform_scale(x: S, y: S, z: S) -> Matrix4<S>
Create a homogeneous transformation matrix from a set of scale values.
Trait Implementations§
source§impl<S: BaseNum> From<AffineMatrix3<S>> for Matrix4<S>
impl<S: BaseNum> From<AffineMatrix3<S>> for Matrix4<S>
source§fn from(aff: AffineMatrix3<S>) -> Matrix4<S>
fn from(aff: AffineMatrix3<S>) -> Matrix4<S>
Converts to this type from the input type.
source§impl<S: BaseFloat> From<Perspective<S>> for Matrix4<S>
impl<S: BaseFloat> From<Perspective<S>> for Matrix4<S>
source§fn from(persp: Perspective<S>) -> Matrix4<S>
fn from(persp: Perspective<S>) -> Matrix4<S>
Converts to this type from the input type.
source§impl<S: BaseFloat> From<PerspectiveFov<S>> for Matrix4<S>
impl<S: BaseFloat> From<PerspectiveFov<S>> for Matrix4<S>
source§fn from(persp: PerspectiveFov<S>) -> Matrix4<S>
fn from(persp: PerspectiveFov<S>) -> Matrix4<S>
Converts to this type from the input type.
source§impl<S: BaseFloat> From<Quaternion<S>> for Matrix4<S>
impl<S: BaseFloat> From<Quaternion<S>> for Matrix4<S>
source§fn from(quat: Quaternion<S>) -> Matrix4<S>
fn from(quat: Quaternion<S>) -> Matrix4<S>
Convert the quaternion to a 4 x 4 rotation matrix
source§impl<S: BaseFloat> Matrix for Matrix4<S>
impl<S: BaseFloat> Matrix for Matrix4<S>
source§impl<S: PartialEq> PartialEq<Matrix4<S>> for Matrix4<S>
impl<S: PartialEq> PartialEq<Matrix4<S>> for Matrix4<S>
source§impl<S: BaseFloat> SquareMatrix for Matrix4<S>
impl<S: BaseFloat> SquareMatrix for Matrix4<S>
source§fn from_value(value: S) -> Matrix4<S>
fn from_value(value: S) -> Matrix4<S>
Create a new diagonal matrix using the supplied value.
source§fn from_diagonal(value: Vector4<S>) -> Matrix4<S>
fn from_diagonal(value: Vector4<S>) -> Matrix4<S>
Create a matrix from a non-uniform scale
source§fn identity() -> Matrix4<S>
fn identity() -> Matrix4<S>
The identity matrix. Multiplying this
matrix with another has no effect.
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<Matrix4<S>>
fn invert(&self) -> Option<Matrix4<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 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.
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.
impl<S: Copy> Copy for Matrix4<S>
impl<S> StructuralPartialEq for Matrix4<S>
Auto Trait Implementations§
impl<S> RefUnwindSafe for Matrix4<S>where S: RefUnwindSafe,
impl<S> Send for Matrix4<S>where S: Send,
impl<S> Sync for Matrix4<S>where S: Sync,
impl<S> Unpin for Matrix4<S>where S: Unpin,
impl<S> UnwindSafe for Matrix4<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